diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-01-19 14:57:03 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-01-19 14:57:03 +0200 |
commit | 7927f49ca0a70868244353a083ccd4601580dbc6 (patch) | |
tree | 9fb5a4a96ec54da1d679980cf7b1d06103675b42 | |
parent | 322bdf513628d7faadd9aa17fdb4adc58a28a7ff (diff) |
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.
-rw-r--r-- | gst/wavparse/gstwavparse.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index 5aa86cb6d..138ec1646 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -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 { |