Changeset 242034 in webkit
- Timestamp:
- Feb 25, 2019 2:11:57 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r242033 r242034 1 2019-02-25 Alicia Boya García <aboya@igalia.com> 2 3 [MSE][GStreamer] Batch player duration updates 4 https://bugs.webkit.org/show_bug.cgi?id=194220 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 This saves up a ton of CPU cycles doing layout unnecessarily when all 9 the appended frames extend the duration of the movie, like in 10 YTTV 2018 59.DASHLatencyVP9. 11 12 This patch is an optimization that introduces no new behavior. 13 14 * platform/graphics/gstreamer/mse/AppendPipeline.cpp: 15 (WebCore::AppendPipeline::consumeAppsinkAvailableSamples): 16 * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: 17 (WebCore::MediaPlayerPrivateGStreamerMSE::blockDurationChanges): 18 (WebCore::MediaPlayerPrivateGStreamerMSE::unblockDurationChanges): 19 (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged): 20 * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: 21 1 22 2019-02-25 Miguel Gomez <magomez@igalia.com> 2 23 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
r241587 r242034 513 513 GRefPtr<GstSample> sample; 514 514 int batchedSampleCount = 0; 515 // In some cases each frame increases the duration of the movie. 516 // Batch duration changes so that if we pick 100 of such samples we don't have to run 100 times 517 // layout for the video controls, but only once. 518 m_playerPrivate->blockDurationChanges(); 515 519 while ((sample = adoptGRef(gst_app_sink_try_pull_sample(GST_APP_SINK(m_appsink.get()), 0)))) { 516 520 appsinkNewSample(WTFMove(sample)); 517 521 batchedSampleCount++; 518 522 } 523 m_playerPrivate->unblockDurationChanges(); 519 524 520 525 GST_TRACE_OBJECT(m_pipeline.get(), "batchedSampleCount = %d", batchedSampleCount); -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
r241587 r242034 662 662 } 663 663 664 void MediaPlayerPrivateGStreamerMSE::blockDurationChanges() 665 { 666 ASSERT(isMainThread()); 667 m_areDurationChangesBlocked = true; 668 m_shouldReportDurationWhenUnblocking = false; 669 } 670 671 void MediaPlayerPrivateGStreamerMSE::unblockDurationChanges() 672 { 673 ASSERT(isMainThread()); 674 if (m_shouldReportDurationWhenUnblocking) { 675 m_player->durationChanged(); 676 m_playbackPipeline->notifyDurationChanged(); 677 m_shouldReportDurationWhenUnblocking = false; 678 } 679 680 m_areDurationChangesBlocked = false; 681 } 682 664 683 void MediaPlayerPrivateGStreamerMSE::durationChanged() 665 684 { 685 ASSERT(isMainThread()); 666 686 if (!m_mediaSourceClient) { 667 687 GST_DEBUG("m_mediaSourceClient is null, doing nothing"); … … 677 697 // by the HTMLMediaElement. 678 698 if (m_mediaTimeDuration != previousDuration && m_mediaTimeDuration.isValid() && previousDuration.isValid()) { 679 m_player->durationChanged(); 680 m_playbackPipeline->notifyDurationChanged(); 699 if (!m_areDurationChangesBlocked) { 700 m_player->durationChanged(); 701 m_playbackPipeline->notifyDurationChanged(); 702 } else 703 m_shouldReportDurationWhenUnblocking = true; 681 704 m_mediaSource->durationChanged(m_mediaTimeDuration); 682 705 } -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h
r241585 r242034 83 83 void notifySeekNeedsDataForTime(const MediaTime&); 84 84 85 void blockDurationChanges(); 86 void unblockDurationChanges(); 87 85 88 private: 86 89 static void getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>&); … … 112 115 MediaTime m_mediaTimeDuration; 113 116 bool m_mseSeekCompleted = true; 117 bool m_areDurationChangesBlocked = false; 118 bool m_shouldReportDurationWhenUnblocking = false; 114 119 RefPtr<PlaybackPipeline> m_playbackPipeline; 115 120 };
Note: See TracChangeset
for help on using the changeset viewer.