From 0d88f271084cce54de38907a618368deed843ee8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 4 Sep 2015 19:34:41 +0100 Subject: [PATCH] flacparse: set both pts and dts so baseparse doesn't make up wrong dts after a seek flac contains the sample offset in the frame header, so after a seek without index flacparse will know the exact position we landed on and timestamp buffers accordingly. It only set the pts though, which means the baseparse-set dts which was set to the seek position prevails, and since the seek was based on an estimate, there's likely a discrepancy between where we wanted to land and where we did land, so from here on that dts/pts difference will be maintained, with dts possibly multiple seconds ahead of pts, which is just wrong. The easiest way to fix this is to just set both pts and dts based on the sample offset, but perhaps parsed audio should just not have dts set at all. https://bugzilla.gnome.org/show_bug.cgi?id=752106 --- gst/audioparsers/gstflacparse.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c index 6db5d59..bf598c7 100644 --- a/gst/audioparsers/gstflacparse.c +++ b/gst/audioparsers/gstflacparse.c @@ -1645,16 +1645,18 @@ gst_flac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame, /* also cater for oggmux metadata */ if (flacparse->blocking_strategy == 0) { - GST_BUFFER_TIMESTAMP (buffer) = + GST_BUFFER_PTS (buffer) = gst_util_uint64_scale (flacparse->sample_number, flacparse->block_size * GST_SECOND, flacparse->samplerate); + GST_BUFFER_DTS (buffer) = GST_BUFFER_PTS (buffer); GST_BUFFER_OFFSET_END (buffer) = flacparse->sample_number * flacparse->block_size + flacparse->block_size; } else { - GST_BUFFER_TIMESTAMP (buffer) = + GST_BUFFER_PTS (buffer) = gst_util_uint64_scale (flacparse->sample_number, GST_SECOND, flacparse->samplerate); + GST_BUFFER_DTS (buffer) = GST_BUFFER_PTS (buffer); GST_BUFFER_OFFSET_END (buffer) = flacparse->sample_number + flacparse->block_size; } @@ -1662,7 +1664,7 @@ gst_flac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame, gst_util_uint64_scale (GST_BUFFER_OFFSET_END (buffer), GST_SECOND, flacparse->samplerate); GST_BUFFER_DURATION (buffer) = - GST_BUFFER_OFFSET (buffer) - GST_BUFFER_TIMESTAMP (buffer); + GST_BUFFER_OFFSET (buffer) - GST_BUFFER_PTS (buffer); /* To simplify, we just assume that it's a fixed size header and ignore * subframe headers. The first could lead us to being off by 88 bits and -- 2.7.4