Commit 0d88f271 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

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
parent d46c1df7
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment