WebKit Bugzilla
Attachment 362380 Details for
Bug 194220
: [MSE][GStreamer] Batch player duration updates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194220-20190219133427.patch (text/plain), 6.50 KB, created by
Alicia Boya García
on 2019-02-19 04:34:29 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alicia Boya García
Created:
2019-02-19 04:34:29 PST
Size:
6.50 KB
patch
obsolete
>Subversion Revision: 241295 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c0ad115de38d87d06e2c7fa39107e038f3baf804..625d868a73f7bb5d3b35bd5610e354fbdeb91e48 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2019-02-04 Alicia Boya GarcÃa <aboya@igalia.com> >+ >+ [MSE][GStreamer] Batch player duration updates >+ https://bugs.webkit.org/show_bug.cgi?id=194220 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This saves up a ton of CPU cycles doing layout unnecessarily when all >+ the appended frames extend the duration of the movie, like in >+ YTTV 2018 59.DASHLatencyVP9. >+ >+ This patch is an optimization that introduces no new behavior. >+ >+ * platform/graphics/gstreamer/mse/AppendPipeline.cpp: >+ (WebCore::CodedFrameProcessingBatchContext::updateDuration): >+ (WebCore::CodedFrameProcessingBatchContext::CodedFrameProcessingBatchContext): >+ (WebCore::CodedFrameProcessingBatchContext::~CodedFrameProcessingBatchContext): >+ (WebCore::CodedFrameProcessingBatchContext::enqueueDurationUpdate): >+ (WebCore::AppendPipeline::consumeAppsinkAvailableSamples): >+ * platform/graphics/gstreamer/mse/AppendPipeline.h: >+ * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: >+ (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged): >+ > 2019-02-12 Zalan Bujtas <zalan@apple.com> > > [LFC] Remove redundant InlineFormattingContext::computeBorderAndPadding >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >index 2d9323811ff3ee96c40befb8e87bab04e014a42b..0511fe7f19451fcda8ff526f528714b1169410ba 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >@@ -27,9 +27,10 @@ > #include "GStreamerCommon.h" > #include "GStreamerEMEUtilities.h" > #include "GStreamerMediaDescription.h" >-#include "MediaSampleGStreamer.h" > #include "InbandTextTrackPrivateGStreamer.h" > #include "MediaDescription.h" >+#include "MediaSampleGStreamer.h" >+#include "PlaybackPipeline.h" > #include "SourceBufferPrivateGStreamer.h" > #include "VideoTrackPrivateGStreamer.h" > #include <functional> >@@ -58,6 +59,48 @@ struct EndOfAppendMeta { > static void free(GstMeta*, GstBuffer*) { } > }; > >+CodedFrameProcessingBatchContext* CodedFrameProcessingBatchContext::s_instance = nullptr; >+ >+void CodedFrameProcessingBatchContext::updateDuration(RefPtr<PlaybackPipeline> playbackPipeline, MediaPlayer* mediaPlayer) >+{ >+ ASSERT(isMainThread()); >+ if (s_instance) { >+ // When processing a batch of samples, perform a single player duration update at the end of the batch, saving lots of time in layout code. >+ s_instance->enqueueDurationUpdate(playbackPipeline, mediaPlayer); >+ } else { >+ // In other case, perform the player duration update immediately. >+ mediaPlayer->durationChanged(); >+ playbackPipeline->notifyDurationChanged(); >+ } >+} >+ >+CodedFrameProcessingBatchContext::CodedFrameProcessingBatchContext() >+{ >+ ASSERT(!s_instance); >+ ASSERT(isMainThread()); >+ s_instance = this; >+} >+ >+CodedFrameProcessingBatchContext::~CodedFrameProcessingBatchContext() >+{ >+ if (m_needsUpdateDuration) { >+ m_mediaPlayer->durationChanged(); >+ m_playbackPipeline->notifyDurationChanged(); >+ } >+ s_instance = nullptr; >+} >+ >+void CodedFrameProcessingBatchContext::enqueueDurationUpdate(RefPtr<PlaybackPipeline> playbackPipeline, MediaPlayer* mediaPlayer) >+{ >+ if (!m_needsUpdateDuration) { >+ m_needsUpdateDuration = true; >+ m_playbackPipeline = playbackPipeline; >+ m_mediaPlayer = mediaPlayer; >+ } >+ ASSERT(m_playbackPipeline == playbackPipeline); >+ ASSERT(m_mediaPlayer == mediaPlayer); >+} >+ > void AppendPipeline::staticInitialization() > { > ASSERT(isMainThread()); >@@ -506,6 +549,8 @@ void AppendPipeline::consumeAppsinkAvailableSamples() > { > ASSERT(isMainThread()); > >+ CodedFrameProcessingBatchContext batchContext; >+ > GRefPtr<GstSample> sample; > int batchedSampleCount = 0; > while ((sample = adoptGRef(gst_app_sink_try_pull_sample(GST_APP_SINK(m_appsink.get()), 0)))) { >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h >index 00211a678816b3257cd84d9bbdfd0276f9f0df9d..9a64e7fd383772b6b73777aab96b4ec28d111706 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h >@@ -44,6 +44,27 @@ struct PadProbeInformation { > }; > #endif > >+class AppendPipeline; >+ >+class CodedFrameProcessingBatchContext { >+public: >+ static void updateDuration(RefPtr<PlaybackPipeline>, MediaPlayer*); >+ >+private: >+ /* This class can only be instantiated by AppendPipeline. */ >+ friend class AppendPipeline; >+ >+ CodedFrameProcessingBatchContext(); >+ virtual ~CodedFrameProcessingBatchContext(); >+ void enqueueDurationUpdate(RefPtr<PlaybackPipeline>, MediaPlayer*); >+ >+ static CodedFrameProcessingBatchContext* s_instance; >+ >+ bool m_needsUpdateDuration { false }; >+ RefPtr<PlaybackPipeline> m_playbackPipeline; >+ MediaPlayer* m_mediaPlayer { nullptr }; >+}; >+ > class AppendPipeline : public ThreadSafeRefCounted<AppendPipeline> { > public: > AppendPipeline(Ref<MediaSourceClientGStreamerMSE>, Ref<SourceBufferPrivateGStreamer>, MediaPlayerPrivateGStreamerMSE&); >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp >index e5b443e6b2d72172f67127e16aab0c3f7e2cb840..2b41b074a1139ecea19cb9028c0e0dd72205c813 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp >@@ -676,8 +676,7 @@ void MediaPlayerPrivateGStreamerMSE::durationChanged() > // Avoid emiting durationchanged in the case where the previous duration was 0 because that case is already handled > // by the HTMLMediaElement. > if (m_mediaTimeDuration != previousDuration && m_mediaTimeDuration.isValid() && previousDuration.isValid()) { >- m_player->durationChanged(); >- m_playbackPipeline->notifyDurationChanged(); >+ CodedFrameProcessingBatchContext::updateDuration(m_playbackPipeline, m_player); > m_mediaSource->durationChanged(m_mediaTimeDuration); > } > }
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 194220
:
361314
|
361317
|
362380
|
362381
|
362607
|
362616
|
362652
|
362742
|
362818
|
362824