WebKit Bugzilla
Attachment 362381 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-20190219141449.patch (text/plain), 6.36 KB, created by
Alicia Boya García
on 2019-02-19 05:14:50 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alicia Boya García
Created:
2019-02-19 05:14:50 PST
Size:
6.36 KB
patch
obsolete
>Subversion Revision: 241760 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 5bdc6d3fa0a049d3046409362ea006d8fefb7ab0..fb48cd2328de4ff222329a1b932df2cb8b020af8 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-16 Darin Adler <darin@apple.com> > > Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc. >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >index 97fc42a57a3fcf5136ca0bbe9cb1db9ad2de7574..691620ea0ca28f231522298cf4e54f62373baf76 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >@@ -31,6 +31,7 @@ > #include "MediaSampleGStreamer.h" > #include "InbandTextTrackPrivateGStreamer.h" > #include "MediaDescription.h" >+#include "PlaybackPipeline.h" > #include "SourceBufferPrivateGStreamer.h" > #include "VideoTrackPrivateGStreamer.h" > #include <functional> >@@ -60,6 +61,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()); >@@ -510,6 +553,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 8769b524fd4490a21e5f9b8ce7b6b197fc7b415f..88e0719ebb4c5f2962da4b8da46822e1f52cfa17 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