Title: [295480] trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp
Revision
295480
Author
[email protected]
Date
2022-06-12 20:22:25 -0700 (Sun, 12 Jun 2022)

Log Message

Handle case where only a single video frame was appended.
https://bugs.webkit.org/show_bug.cgi?id=241453

Reviewed by Jer Noble.

Under some circumstances, only a single frame will be appended.
When the queue of pending samples gets flushed we can't rely on the last sample's time
nor the last duration.

* Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::WebMParser::VideoTrackData::flushPendingSamples):

Canonical link: https://commits.webkit.org/251485@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp (295479 => 295480)


--- trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp	2022-06-13 02:40:04 UTC (rev 295479)
+++ trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp	2022-06-13 03:22:25 UTC (rev 295480)
@@ -1157,17 +1157,16 @@
     // We set its duration to the track's default duration, or if not known the time of the last sample processed.
     if (!m_pendingMediaSamples.size())
         return;
-    ASSERT(m_lastPresentationTime);
     auto track = this->track();
 
+    MediaTime presentationTime = m_lastPresentationTime ? *m_lastPresentationTime : m_pendingMediaSamples.first().presentationTime;
     MediaTime duration;
     if (track.default_duration.is_present())
-        duration = MediaTime(track.default_duration.value() * m_lastPresentationTime->timeScale() / k_us_in_seconds, m_lastPresentationTime->timeScale());
+        duration = MediaTime(track.default_duration.value() * presentationTime.timeScale() / k_us_in_seconds, presentationTime.timeScale());
     else if (m_lastDuration)
         duration = *m_lastDuration;
-    processPendingMediaSamples(*m_lastPresentationTime + duration);
+    processPendingMediaSamples(presentationTime + duration);
     m_lastPresentationTime.reset();
-    m_lastDuration.reset();
 }
 
 void WebMParser::AudioTrackData::resetCompletedFramesState()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to