mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
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
This commit is contained in:
parent
d46c1df745
commit
0d88f27108
1 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue