Bug 154742 - Add support for playbackControlsManager
Summary: Add support for playbackControlsManager
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 154780
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-26 12:36 PST by Beth Dakin
Modified: 2016-03-02 15:51 PST (History)
5 users (show)

See Also:


Attachments
Patch (33.94 KB, patch)
2016-02-26 12:57 PST, Beth Dakin
no flags Details | Formatted Diff | Diff
Patch (33.95 KB, patch)
2016-02-26 13:06 PST, Beth Dakin
jer.noble: review+
Details | Formatted Diff | Diff
Patch that attempts to resolve crashes (34.81 KB, patch)
2016-03-02 12:44 PST, Beth Dakin
jer.noble: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Beth Dakin 2016-02-26 12:36:05 PST
Add support for playbackControlsManager

rdar://problem/23833753
Comment 1 Beth Dakin 2016-02-26 12:57:22 PST
Created attachment 272360 [details]
Patch
Comment 2 WebKit Commit Bot 2016-02-26 12:59:49 PST
Attachment 272360 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:35:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:36:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:68:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:97:  Tab found; better to use spaces  [whitespace/tab] [1]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:102:  Tab found; better to use spaces  [whitespace/tab] [1]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:112:  Tab found; better to use spaces  [whitespace/tab] [1]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:117:  Tab found; better to use spaces  [whitespace/tab] [1]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:130:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
Total errors found: 8 in 25 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Beth Dakin 2016-02-26 13:06:16 PST
Created attachment 272362 [details]
Patch
Comment 4 WebKit Commit Bot 2016-02-26 13:08:52 PST
Attachment 272362 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:35:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:39:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:69:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:131:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
Total errors found: 4 in 25 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Sam Weinig 2016-02-26 13:11:31 PST
Comment on attachment 272362 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=272362&action=review

> Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm:289
> +    uint64_t contextId;
> +
> +    auto addResult = m_videoElements.add(&videoElement, 0);
> +    if (addResult.isNewEntry)
> +        addResult.iterator->value = nextContextId();
> +    contextId = addResult.iterator->value;

There is new fangled way to do this using HashMap::ensure(..)

uint64_t contextId = m_videoElements.add(&videoElement, [&] { return nextContextId(); }).iterator->value;

or in two lines:

auto addResult = m_videoElements.add(&videoElement, [&] { return nextContextId(); });
auto contextId = addResult.iterator->value;
Comment 6 Eric Carlson 2016-02-26 13:17:14 PST
Comment on attachment 272360 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=272360&action=review

> Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:179
> +    controlsManager.hasEnabledAudio = YES;
> +    controlsManager.hasEnabledVideo = YES;

This isn't necessarily correct, should it have a FIXME?

> Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:209
> +        double start = timeRanges.start(i, exceptionCode);
> +        double end = timeRanges.end(i, exceptionCode);

Can you use ASSERT_NO_EXCEPTION instead of ignoring potential exceptions?

> Source/WebKit2/UIProcess/mac/PageClientImpl.h:217
> +    virtual void isPlayingMediaDidChange() override;

Nit: "virtual" is implied with "override".
Comment 7 Jer Noble 2016-02-26 13:28:03 PST
Comment on attachment 272362 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=272362&action=review

> Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:213
> +        double start = timeRanges.start(i, exceptionCode);
> +        double end = timeRanges.end(i, exceptionCode);
> +        
> +        CMTimeRange range = CMTimeRangeMake(CMTimeMakeWithSeconds(start, 1000), CMTimeMakeWithSeconds(end-start, 1000));
> +        [seekableRanges addObject:[NSValue valueWithCMTimeRange:range]];

You can use timeRanges.ranges() to get a PlatformTimeRanges. This object's start() and end()  methods don't take an exception code, and they return MediaTime objects.  So this would become:

const PlatformTimeRanges& ranges = timeRanges.ranges();
CMTimeRange range = CMTimeRangeMake(toCMTime(ranges.start(i)), toCMTime(ranges.end(i)));

> Source/WebCore/platform/spi/mac/AVFoundationSPI.h:35
> +#import <AVFoundation/AVTime.h>

AVTime.h should be available in the SDK.
Comment 8 Beth Dakin 2016-02-26 14:29:32 PST
Thanks all! I believe that I addressed all comments: http://trac.webkit.org/changeset/197204
Comment 9 Beth Dakin 2016-02-26 14:51:48 PST
Build fix: http://trac.webkit.org/changeset/197207
Comment 10 Beth Dakin 2016-02-26 15:01:55 PST
More build fix: http://trac.webkit.org/changeset/197211
Comment 11 Alexey Proskuryakov 2016-02-27 12:57:03 PST
This caused multiple crashes, will roll out. More info in e-mail.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.WebKit              	0x00000001073e4762 WebKit::WebVideoFullscreenManagerProxy::ensureModelAndInterface(unsigned long long) + 180
1   com.apple.WebKit              	0x00000001073e50a5 WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface() + 13
2   com.apple.WebKit              	0x00000001073e9e5c WebKit::WebViewImpl::updateWebViewImplAdditions() + 310
3   com.apple.WebKit              	0x00000001073730c5 WebKit::WebPageProxy::isPlayingMediaDidChange(unsigned int, unsigned long long) + 51
4   com.apple.WebKit              	0x000000010738672d WebKit::WebPageProxy::didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) + 12389
Comment 12 WebKit Commit Bot 2016-02-27 13:02:17 PST
Re-opened since this is blocked by bug 154780
Comment 13 Beth Dakin 2016-03-02 12:44:28 PST
Created attachment 272680 [details]
Patch that attempts to resolve crashes
Comment 14 WebKit Commit Bot 2016-03-02 12:45:47 PST
Attachment 272680 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:34:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:35:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:38:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:40:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:78:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:83:  Should not have spaces around = in property synthesis.  [whitespace/property] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:84:  Should not have spaces around = in property synthesis.  [whitespace/property] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:85:  Should not have spaces around = in property synthesis.  [whitespace/property] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:86:  Should not have spaces around = in property synthesis.  [whitespace/property] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:87:  Should not have spaces around = in property synthesis.  [whitespace/property] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:88:  Should not have spaces around = in property synthesis.  [whitespace/property] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:89:  Should not have spaces around = in property synthesis.  [whitespace/property] [4]
ERROR: Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm:148:  *SoftLink.h header should be included after all other headers.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm:298:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 14 in 24 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 Beth Dakin 2016-03-02 12:59:41 PST
Thanks Jer! Giving this another go: http://trac.webkit.org/changeset/197461
Comment 16 Beth Dakin 2016-03-02 15:51:00 PST
This caused some new crashes, which I addressed with http://trac.webkit.org/changeset/197469