Commit 7927f49c authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

wavparse: Don't play anything after the end of the data chunk even when seeking

Especially in push mode we would completely ignore the size of the data chunk
when not stop position is given for the seek. Instead make sure that the end
offset is at most the end of the data chunk if known.

Without this we would output anything after the data chunk, possibly causing
loud noises if the media file is followed by an INFO chunk or an ID3 tag.
parent 322bdf51
......@@ -541,6 +541,9 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event)
if (gst_pad_peer_query_duration (wav->sinkpad, bformat, &upstream_size))
wav->end_offset = MIN (wav->end_offset, upstream_size);
if (wav->datasize > 0 && wav->end_offset > wav->datastart + wav->datasize)
wav->end_offset = wav->datastart + wav->datasize;
/* this is the range of bytes we will use for playback */
wav->offset = MIN (wav->offset, wav->end_offset);
wav->dataleft = wav->end_offset - wav->offset;
......@@ -2420,6 +2423,11 @@ gst_wavparse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
/* and set up streaming thread for next one */
wav->offset = offset;
wav->end_offset = end_offset;
if (wav->datasize > 0 && (wav->end_offset == -1
|| wav->end_offset > wav->datastart + wav->datasize))
wav->end_offset = wav->datastart + wav->datasize;
if (wav->end_offset != -1) {
wav->dataleft = wav->end_offset - wav->offset;
} else {
......
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