Title: [236679] trunk/Source/WebCore
- Revision
- 236679
- Author
- ab...@igalia.com
- Date
- 2018-10-01 11:38:49 -0700 (Mon, 01 Oct 2018)
Log Message
[MSE][GStreamer] Set a minimum sample duration
https://bugs.webkit.org/show_bug.cgi?id=190125
Reviewed by Xabier Rodriguez-Calvar.
The last sample of the audio track in the asset used in this test
player has a tiny duration (100 ns):
http://orange-opensource.github.io/hasplayer.js/1.2.0/player.html?url=""
So small, we were truncating it to zero. We're not supposed to have
frames with zero duration. Instead, lets set a minimum frame duration
for those fringe cases.
* platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
(WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (236678 => 236679)
--- trunk/Source/WebCore/ChangeLog 2018-10-01 18:35:37 UTC (rev 236678)
+++ trunk/Source/WebCore/ChangeLog 2018-10-01 18:38:49 UTC (rev 236679)
@@ -1,3 +1,22 @@
+2018-10-01 Alicia Boya GarcĂa <ab...@igalia.com>
+
+ [MSE][GStreamer] Set a minimum sample duration
+ https://bugs.webkit.org/show_bug.cgi?id=190125
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ The last sample of the audio track in the asset used in this test
+ player has a tiny duration (100 ns):
+
+ http://orange-opensource.github.io/hasplayer.js/1.2.0/player.html?url=""
+
+ So small, we were truncating it to zero. We're not supposed to have
+ frames with zero duration. Instead, lets set a minimum frame duration
+ for those fringe cases.
+
+ * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
+ (WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
+
2018-10-01 Daniel Bates <daba...@apple.com>
[iOS] Special keys are misidentified in DOM keyboard events
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp (236678 => 236679)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp 2018-10-01 18:35:37 UTC (rev 236678)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp 2018-10-01 18:38:49 UTC (rev 236679)
@@ -23,6 +23,8 @@
#include "GStreamerCommon.h"
+#include <algorithm>
+
#if ENABLE(VIDEO) && USE(GSTREAMER)
namespace WebCore {
@@ -34,6 +36,7 @@
, m_trackId(trackId)
, m_presentationSize(presentationSize)
{
+ const GstClockTime minimumDuration = 1000; // 1 us
ASSERT(sample);
GstBuffer* buffer = gst_sample_get_buffer(sample.get());
RELEASE_ASSERT(buffer);
@@ -47,9 +50,14 @@
m_pts = createMediaTime(GST_BUFFER_PTS(buffer));
if (GST_BUFFER_DTS_IS_VALID(buffer) || GST_BUFFER_PTS_IS_VALID(buffer))
m_dts = createMediaTime(GST_BUFFER_DTS_OR_PTS(buffer));
- if (GST_BUFFER_DURATION_IS_VALID(buffer))
- m_duration = createMediaTime(GST_BUFFER_DURATION(buffer));
- else {
+ if (GST_BUFFER_DURATION_IS_VALID(buffer)) {
+ // Sometimes (albeit rarely, so far seen only at the end of a track)
+ // frames have very small durations, so small that may be under the
+ // precision we are working with and be truncated to zero.
+ // SourceBuffer algorithms are not expecting frames with zero-duration,
+ // so let's use something very small instead in those fringe cases.
+ m_duration = createMediaTime(std::max(GST_BUFFER_DURATION(buffer), minimumDuration));
+ } else {
// Unfortunately, sometimes samples don't provide a duration. This can never happen in MP4 because of the way
// the format is laid out, but it's pretty common in WebM.
// The good part is that durations don't matter for playback, just for buffered ranges and coded frame deletion.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes