mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-19 20:46:22 +00:00
wavparse: set buffer offsets before using the buffer for the first time
gst_type_find_helper_for_buffer() will need the correct offset set on the buffer (ie. 0) and not the byte offset we started pulling the data from.
This commit is contained in:
parent
815e06ba55
commit
12ec2c3d6d
1 changed files with 10 additions and 10 deletions
|
@ -1858,6 +1858,16 @@ iterate_adapter:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
obtained = GST_BUFFER_SIZE (buf);
|
||||||
|
|
||||||
|
/* our positions in bytes */
|
||||||
|
pos = wav->offset - wav->datastart;
|
||||||
|
nextpos = pos + obtained;
|
||||||
|
|
||||||
|
/* update offsets, does not overflow. */
|
||||||
|
GST_BUFFER_OFFSET (buf) = pos / wav->bytes_per_sample;
|
||||||
|
GST_BUFFER_OFFSET_END (buf) = nextpos / wav->bytes_per_sample;
|
||||||
|
|
||||||
/* first chunk of data? create the source pad. We do this only here so
|
/* first chunk of data? create the source pad. We do this only here so
|
||||||
* we can detect broken .wav files with dts disguised as raw PCM (sigh) */
|
* we can detect broken .wav files with dts disguised as raw PCM (sigh) */
|
||||||
if (G_UNLIKELY (wav->first)) {
|
if (G_UNLIKELY (wav->first)) {
|
||||||
|
@ -1876,16 +1886,6 @@ iterate_adapter:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
obtained = GST_BUFFER_SIZE (buf);
|
|
||||||
|
|
||||||
/* our positions in bytes */
|
|
||||||
pos = wav->offset - wav->datastart;
|
|
||||||
nextpos = pos + obtained;
|
|
||||||
|
|
||||||
/* update offsets, does not overflow. */
|
|
||||||
GST_BUFFER_OFFSET (buf) = pos / wav->bytes_per_sample;
|
|
||||||
GST_BUFFER_OFFSET_END (buf) = nextpos / wav->bytes_per_sample;
|
|
||||||
|
|
||||||
if (wav->bps > 0) {
|
if (wav->bps > 0) {
|
||||||
/* and timestamps if we have a bitrate, be careful for overflows */
|
/* and timestamps if we have a bitrate, be careful for overflows */
|
||||||
timestamp = uint64_ceiling_scale (pos, GST_SECOND, (guint64) wav->bps);
|
timestamp = uint64_ceiling_scale (pos, GST_SECOND, (guint64) wav->bps);
|
||||||
|
|
Loading…
Reference in a new issue