Bug 144332 - [Mac] Simplify code to support media engines which do not support target playback
Summary: [Mac] Simplify code to support media engines which do not support target play...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-04-28 08:35 PDT by Eric Carlson
Modified: 2015-04-28 14:42 PDT (History)
2 users (show)

See Also:


Attachments
Proposed patch (24.01 KB, patch)
2015-04-28 11:24 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Rebased patch. (23.30 KB, patch)
2015-04-28 12:07 PDT, Eric Carlson
jer.noble: review+
Details | Formatted Diff | Diff
Patch for landing (22.39 KB, patch)
2015-04-28 14:34 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2015-04-28 08:35:54 PDT
Simplify the code added in r182240 to support media engines that do not support a playback target.
Comment 1 Radar WebKit Bug Importer 2015-04-28 08:37:57 PDT
<rdar://problem/20727457>
Comment 2 Eric Carlson 2015-04-28 11:24:19 PDT
Created attachment 251868 [details]
Proposed patch
Comment 3 Eric Carlson 2015-04-28 12:07:54 PDT
Created attachment 251873 [details]
Rebased patch.
Comment 4 WebKit Commit Bot 2015-04-28 12:10:06 PDT
Attachment 251873 [details] did not pass style-queue:


ERROR: Source/WebCore/html/HTMLMediaSession.cpp:207:  Missing space before {  [whitespace/braces] [5]
Total errors found: 1 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Jer Noble 2015-04-28 12:36:26 PDT
Comment on attachment 251873 [details]
Rebased patch.

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

r=me, with nits:

> Source/WebCore/html/HTMLMediaElement.cpp:748
> +    if (m_pendingActionFlags & StopPlayingToTarget) {
> +        if (m_player && m_player->isCurrentPlaybackTargetWireless() && !m_player->canPlayToWirelessPlaybackTarget()) {

No need to nest these if statements.

> Source/WebCore/html/HTMLMediaElement.cpp:4899
> +    RefPtr<Event> event = prpEvent;
> +    bool cancelled = HTMLElement::dispatchEvent(event);
> +
> +    if (event->type() != eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent)
> +        return cancelled;
> +    if (!m_player || !m_player->isCurrentPlaybackTargetWireless() || m_player->canPlayToWirelessPlaybackTarget())
> +        return cancelled;
> +
> +    scheduleDelayedAction(StopPlayingToTarget);

Since we have to double check these have to be double-checked anyway inside of pendingActionTimerFired(), could we just re-write this to be?:

if (event->type() == eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent)
    scheduleDelayedAction(StopPlayingToTarget);
return HTMLElement::dispatchEvent(event);

> Source/WebCore/html/HTMLMediaElement.cpp:5905
> -    return potentiallyPlaying() ? requestedPlaybackRate() : 0;
> +    double requestedPlaybackRate = this->requestedPlaybackRate();
> +    bool potentiallyPlaying = this->potentiallyPlaying();
> +    LOG(Media, "HTMLMediaElement::mediaPlayerRequestedPlaybackRate(%p) - potentiallyPlaying = %s, returning %f", this, boolString(potentiallyPlaying), requestedPlaybackRate);
> +    return potentiallyPlaying ? requestedPlaybackRate : 0;

Seems like this logging may potentially be very noisy.

> Source/WebCore/html/HTMLMediaSession.cpp:385
> -    setWirelessVideoPlaybackDisabled(element, m_restrictions & WirelessVideoPlaybackDisabled);
> +    if (m_restrictions & WirelessVideoPlaybackDisabled)
> +        setWirelessVideoPlaybackDisabled(element, true);

Is there some reason we're no longer setting this to false if the restriction has been lifted?
Comment 6 Eric Carlson 2015-04-28 14:34:24 PDT
Created attachment 251888 [details]
Patch for landing
Comment 7 Eric Carlson 2015-04-28 14:42:08 PDT
Committed r183509: https://trac.webkit.org/r183509