gst/dvdlpcmdec/gstdvdlpcmdec.c: Fix timestamping for cases where the first_access parameter is 4.

Original commit message from CVS:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_chain_dvd):
Fix timestamping for cases where the first_access parameter is 4.
Ensure we don't overrun buffers in other cases.
This commit is contained in:
Michael Smith 2006-05-11 14:34:10 +00:00
parent 1efcd72335
commit 313be6facc
2 changed files with 26 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2006-05-11 Michael Smith <msmith@fluendo.com>
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_chain_dvd):
Fix timestamping for cases where the first_access parameter is 4.
Ensure we don't overrun buffers in other cases.
2006-05-10 Tim-Philipp Müller <tim at centricular dot net>
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_get_string):

View file

@ -389,21 +389,28 @@ gst_dvdlpcmdec_chain_dvd (GstPad * pad, GstBuffer * buf)
off = 5;
if (first_access > 4) {
/* length of first blength before access unit */
/* length of first buffer */
len = first_access - 4;
GST_LOG_OBJECT (dvdlpcmdec, "Creating first sub-buffer off %d, len %d", off,
len);
/* see if we need a subbuffer without timestamp */
if (len > 0) {
subbuf = gst_buffer_create_sub (buf, off, len);
GST_BUFFER_TIMESTAMP (subbuf) = GST_CLOCK_TIME_NONE;
ret = gst_dvdlpcmdec_chain_raw (pad, subbuf);
if (ret != GST_FLOW_OK)
goto done;
if (off + len > size) {
GST_WARNING_OBJECT (pad, "Bad first_access parameter in buffer");
GST_ELEMENT_ERROR (dvdlpcmdec, STREAM, DECODE,
(NULL),
("first_access parameter out of range: bad buffer from " "demuxer"));
ret = GST_FLOW_ERROR;
goto done;
}
subbuf = gst_buffer_create_sub (buf, off, len);
GST_BUFFER_TIMESTAMP (subbuf) = GST_CLOCK_TIME_NONE;
ret = gst_dvdlpcmdec_chain_raw (pad, subbuf);
if (ret != GST_FLOW_OK)
goto done;
/* then the buffer with new timestamp */
off += len;
len = size - off;
@ -411,16 +418,17 @@ gst_dvdlpcmdec_chain_dvd (GstPad * pad, GstBuffer * buf)
GST_LOG_OBJECT (dvdlpcmdec, "Creating next sub-buffer off %d, len %d", off,
len);
subbuf = gst_buffer_create_sub (buf, off, len);
GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buf);
if (len > 0) {
subbuf = gst_buffer_create_sub (buf, off, len);
GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buf);
ret = gst_dvdlpcmdec_chain_raw (pad, subbuf);
ret = gst_dvdlpcmdec_chain_raw (pad, subbuf);
}
} else {
GST_LOG_OBJECT (dvdlpcmdec, "Creating single sub-buffer off %d, len %d",
off, size - off);
/* We don't have a valid timestamp at all */
subbuf = gst_buffer_create_sub (buf, off, size - off);
GST_BUFFER_TIMESTAMP (subbuf) = GST_CLOCK_TIME_NONE;
GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buf);
ret = gst_dvdlpcmdec_chain_raw (pad, subbuf);
}