WebKit Bugzilla
Attachment 358737 Details for
Bug 193295
: <video> elements do not enter 'paused' state when playing to end over AirPlay
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193295-20190109134942.patch (text/plain), 7.68 KB, created by
Jer Noble
on 2019-01-09 13:49:43 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2019-01-09 13:49:43 PST
Size:
7.68 KB
patch
obsolete
>Subversion Revision: 239644 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3efdb59b4f202e913fdccb506a26f490938c9215..57ff5fcd71b7b77bcfae1a72004fa5f82c17f060 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,30 @@ >+2019-01-09 Jer Noble <jer.noble@apple.com> >+ >+ <video> elements do not enter 'paused' state when playing to end over AirPlay >+ https://bugs.webkit.org/show_bug.cgi?id=193295 >+ <rdar://problem/46708670> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adopt the -[AVPlayer timeControlStatus] API, which reports whether the AVPlayer is paused, playing, or blocked waiting >+ for more data before playing. AirPlay devices report this state back from the remote device, and this allows the >+ MediaPlayerPrivateAVFoundationObjC to differentiate between user-generated pauses and simple stalling. >+ >+ Adopting this API allows us to remove the heuristic from rateChanged() which inteprets a rate change when the >+ readyState > HAVE_ENOUGH as an intentional pause. >+ >+ * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: >+ (WebCore::MediaPlayerPrivateAVFoundation::paused const): >+ (WebCore::MediaPlayerPrivateAVFoundation::rateChanged): >+ * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: >+ (WebCore::MediaPlayerPrivateAVFoundation::platformPaused const): >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPaused const): >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange): >+ (WebCore::playerKVOProperties): >+ (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): >+ > 2019-01-07 Jer Noble <jer.noble@apple.com> > > REGRESSION (r239519): ASSERTION FAILED: !m_adoptionIsRequired in com.apple.WebCore: void WTF::refIfNotNull<WebCore::CDMSessionMediaSourceAVFObjC> + 53 >diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp >index 8bb0761900ba1818349dbabdd7f3eb26613223d7..b1b2274c0b91df6582c4aafb323baf2c2248f484 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp >+++ b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp >@@ -285,7 +285,7 @@ bool MediaPlayerPrivateAVFoundation::paused() const > if (!metaDataAvailable()) > return true; > >- return rate() == 0; >+ return platformPaused(); > } > > bool MediaPlayerPrivateAVFoundation::seeking() const >@@ -623,17 +623,6 @@ void MediaPlayerPrivateAVFoundation::metadataLoaded() > > void MediaPlayerPrivateAVFoundation::rateChanged() > { >- >-#if ENABLE(WIRELESS_PLAYBACK_TARGET) && PLATFORM(IOS_FAMILY) >- if (isCurrentPlaybackTargetWireless() && playerItemStatus() >= MediaPlayerAVPlayerItemStatusPlaybackBufferFull) { >- double rate = this->rate(); >- if (rate != requestedRate()) { >- m_player->handlePlaybackCommand(rate ? PlatformMediaSession::PlayCommand : PlatformMediaSession::PauseCommand); >- return; >- } >- } >-#endif >- > m_player->rateChanged(); > } > >diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h >index 3fbcdafac7ae41d1b26b4a95b048e6b7242f0b0b..e5ddf9e8bbf79944cd29c1582452309ef8f39a29 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h >+++ b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h >@@ -253,6 +253,7 @@ protected: > virtual MediaTime platformMinTimeSeekable() const = 0; > virtual MediaTime platformMaxTimeLoaded() const = 0; > virtual MediaTime platformDuration() const = 0; >+ virtual bool platformPaused() const { return !rate(); } > > virtual void beginLoadingMetadata() = 0; > virtual void sizeChanged() = 0; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >index e5bd79d10c53a5cbb88b2a47cd79e93e93f5b25b..af206cd8525ffe26007d5fd9d2f2210f7ee35f85 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >@@ -113,6 +113,7 @@ public: > void presentationSizeDidChange(FloatSize); > void durationDidChange(const MediaTime&); > void rateDidChange(double); >+ void timeControlStatusDidChange(int); > void metadataDidArrive(const RetainPtr<NSArray>&, const MediaTime&); > void firstFrameAvailableDidChange(bool); > void trackEnabledDidChange(bool); >@@ -165,6 +166,7 @@ private: > void platformSetVisible(bool) override; > void platformPlay() override; > void platformPause() override; >+ bool platformPaused() const override; > MediaTime currentMediaTime() const override; > void setVolume(float) override; > #if PLATFORM(IOS_FAMILY) >@@ -415,6 +417,7 @@ private: > MediaTime m_cachedDuration; > RefPtr<SharedBuffer> m_keyID; > double m_cachedRate; >+ int m_cachedTimeControlStatus { 0 }; > mutable long long m_cachedTotalBytes; > unsigned m_pendingStatusChanges; > int m_cachedItemStatus; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >index c1f38e3bbcf059a392cb5543bc47dde266bc6329..7e24ffe972d6a7442eb9732c2639ef7052c8da21 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >@@ -1298,6 +1298,11 @@ void MediaPlayerPrivateAVFoundationObjC::platformPause() > setDelayCallbacks(false); > } > >+bool MediaPlayerPrivateAVFoundationObjC::platformPaused() const >+{ >+ return m_cachedTimeControlStatus == AVPlayerTimeControlStatusPaused; >+} >+ > MediaTime MediaPlayerPrivateAVFoundationObjC::platformDuration() const > { > // Do not ask the asset for duration before it has been loaded or it will fetch the >@@ -3234,6 +3239,14 @@ void MediaPlayerPrivateAVFoundationObjC::rateDidChange(double rate) > rateChanged(); > } > >+void MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange(int timeControlStatus) >+{ >+ m_cachedTimeControlStatus = timeControlStatus; >+ >+ updateStates(); >+ player()->playbackStateChanged(); >+} >+ > #if ENABLE(WIRELESS_PLAYBACK_TARGET) > > void MediaPlayerPrivateAVFoundationObjC::playbackTargetIsWirelessDidChange() >@@ -3357,6 +3370,7 @@ NSArray* playerKVOProperties() > { > static NSArray* keys = [[NSArray alloc] initWithObjects: > @"rate", >+ @"timeControlStatus", > #if ENABLE(WIRELESS_PLAYBACK_TARGET) > @"externalPlaybackActive", > @"allowsExternalPlayback", >@@ -3473,6 +3487,8 @@ - (void)observeValueForKeyPath:keyPath ofObject:(id)object change:(NSDictionary > // A value changed for an AVPlayer. > if ([keyPath isEqualToString:@"rate"]) > player->rateDidChange([newValue doubleValue]); >+ else if ([keyPath isEqualToString:@"timeControlStatus"]) >+ player->timeControlStatusDidChange([newValue intValue]); > #if ENABLE(WIRELESS_PLAYBACK_TARGET) > else if ([keyPath isEqualToString:@"externalPlaybackActive"] || [keyPath isEqualToString:@"allowsExternalPlayback"]) > player->playbackTargetIsWirelessDidChange();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193295
:
358737
|
358739
|
358744
|
358754
|
358835
|
358854