Skip to content

Commit a7edb51

Browse files
committed
[MSE][GStreamer] Only extend first sample when it's a sync sample
This change, already present upstream (where edit list support has been reverted), only applies the "sample extension to start from zero when DTS = 0 and PTS > 0" if the sample is a sync one. Without this, problems happened on MPEG TS streams transmuxed to MSE, where two consecutive samples were having DTS=0 and the correction on the second one broke the first one. After some attempts to fix the problem, we ended up realizing that just by applying the correction on sync samples would solve the problem. See: #1601
1 parent 5fab8b8 commit a7edb51

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ void AppendPipeline::appsinkNewSample(const Track& track, GRefPtr<GstSample>&& s
476476
GST_TRACE_OBJECT(track.appsinkPad.get(), "Mapped buffer to segment, PTS %" GST_TIME_FORMAT " -> %s DTS %" GST_TIME_FORMAT " -> %s",
477477
GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), pts.toString().utf8().data(), GST_TIME_ARGS(GST_BUFFER_DTS(buffer)), dts.toString().utf8().data());
478478
mediaSample->setTimestamps(pts, dts);
479-
} else if (!GST_BUFFER_DTS(buffer) && GST_BUFFER_PTS(buffer) > 0 && GST_BUFFER_PTS(buffer) <= 100'000'000) {
479+
} else if (!GST_BUFFER_DTS(buffer) && GST_BUFFER_PTS(buffer) > 0 && GST_BUFFER_PTS(buffer) <= 100'000'000 && mediaSample->isSync()) {
480480
// Because a track presentation time starting at some close to zero, but not exactly zero time can cause unexpected
481481
// results for applications, we extend the duration of this first sample to the left so that it starts at zero.
482482
// This is relevant for files that should have an edit list but don't, or when using GStreamer < 1.16, where

0 commit comments

Comments
 (0)