WebKit Bugzilla
Attachment 359281 Details for
Bug 193499
: MediaPlayerPrivateAVFoundationObjC can return incorrect paused information
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193499-20190116110419.patch (text/plain), 6.55 KB, created by
Jer Noble
on 2019-01-16 11:04:20 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2019-01-16 11:04:20 PST
Size:
6.55 KB
patch
obsolete
>Subversion Revision: 239927 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a001c4e111166d1c687ce61c2ac32ccafaf0baea..4d7f2d6c585ebf54eaba83c16fc7a3e26a818805 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,33 @@ >+2019-01-16 Jer Noble <jer.noble@apple.com> >+ >+ MediaPlayerPrivateAVFoundationObjC can return incorrect paused information >+ https://bugs.webkit.org/show_bug.cgi?id=193499 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ MediaPlayerPrivateAVFoundation uses rate() as an indicator of whether the player >+ is paused or not. This is incorrect when playback is stalled waiting for more data. >+ For MPPAVFObjC, use the timeControlStatus as a more accurate indicator of whether >+ the player is playing. >+ >+ Now that we have correct play state information, we can remove the handlePlaybackCommand() >+ path when playing remotely for a more direct approach of notifying the HTMLMediaElement >+ that the play state has changed. >+ >+ Drive-by fix: Before throwing away the AVPlayer, clear its output context. This keeps >+ remote devices from keeping the AVPlayer alive. >+ >+ * platform/graphics/MediaPlayer.cpp: >+ * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: >+ (WebCore::MediaPlayerPrivateAVFoundation::paused const): >+ * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: >+ (WebCore::MediaPlayerPrivateAVFoundation::platformPaused const): >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad): >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPaused const): >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange): >+ > 2019-01-14 Jer Noble <jer.noble@apple.com> > > https://bugs.webkit.org/show_bug.cgi?id=193403 >diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp >index f1e5610b91e1d217c84611b56103126c0e9da57d..49c449a2660bb0074266cfdd9ac58c095e0079e0 100644 >--- a/Source/WebCore/platform/graphics/MediaPlayer.cpp >+++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp >@@ -130,7 +130,7 @@ public: > > void setRateDouble(double) override { } > void setPreservesPitch(bool) override { } >- bool paused() const override { return false; } >+ bool paused() const override { return true; } > > void setVolumeDouble(double) override { } > >diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp >index 6ef334206724b5c142ae30d669fbad07ddf9fce0..31030737bbfaccdca67f9c5d98f459b9a86d0db3 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp >+++ b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp >@@ -275,7 +275,7 @@ bool MediaPlayerPrivateAVFoundation::paused() const > if (!metaDataAvailable()) > return true; > >- return rate() == 0; >+ return platformPaused(); > } > > bool MediaPlayerPrivateAVFoundation::seeking() const >diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h >index 7a90365fe167afbbcd1cb2c48ee441afd8388e4e..51a29bd18a94597c4883b447d963e8b3e0626fa1 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h >+++ b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h >@@ -245,6 +245,7 @@ protected: > virtual void platformSetVisible(bool) = 0; > virtual void platformPlay() = 0; > virtual void platformPause() = 0; >+ virtual bool platformPaused() const { return !rate(); } > virtual void checkPlayability() = 0; > virtual void seekToTime(const MediaTime&, const MediaTime& negativeTolerance, const MediaTime& positiveTolerance) = 0; > unsigned long long totalBytes() const override = 0; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >index c7c93030c80e0376e3f8df857f211f7f4b18bed2..a2424dd80da2c43d767f3ade416cb7400bc54a57 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >@@ -167,6 +167,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) >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >index 2241db1522ac2c1b434a416031d23422e9c900ba..a527c4cf5e86f379a4f2793b14b1b9e0ad639701 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >@@ -590,6 +590,7 @@ void MediaPlayerPrivateAVFoundationObjC::cancelLoad() > setShouldObserveTimeControlStatus(false); > > [m_avPlayer replaceCurrentItemWithPlayerItem:nil]; >+ [m_avPlayer setOutputContext:nil]; > m_avPlayer = nil; > } > >@@ -1304,6 +1305,11 @@ void MediaPlayerPrivateAVFoundationObjC::platformPause() > setPlayerRate(0); > } > >+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 >@@ -3267,8 +3273,10 @@ void MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange(int timeCont > return; > > bool playerIsPlaying = m_cachedTimeControlStatus != AVPlayerTimeControlStatusPaused; >- if (playerIsPlaying != m_requestedPlaying) >- player()->handlePlaybackCommand(playerIsPlaying ? PlatformMediaSession::PlayCommand : PlatformMediaSession::PauseCommand); >+ if (playerIsPlaying != m_requestedPlaying) { >+ m_requestedPlaying = playerIsPlaying; >+ player()->playbackStateChanged(); >+ } > #endif > } >
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 193499
:
359281
|
359282
|
359308
|
359321
|
359324
|
359332
|
359333
|
359384