summaryrefslogtreecommitdiff
path: root/gst/dvdlpcmdec
diff options
context:
space:
mode:
authorMichael Smith <msmith@xiph.org>2006-05-11 14:34:10 +0000
committerMichael Smith <msmith@xiph.org>2006-05-11 14:34:10 +0000
commit313be6faccff4db631a22d28dad268539672b913 (patch)
tree4f6e834693888b576241c47887d668c482af4573 /gst/dvdlpcmdec
parent1efcd72335a8c0f2147d2c4c851c9d7c3ea23077 (diff)
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.
Diffstat (limited to 'gst/dvdlpcmdec')
-rw-r--r--gst/dvdlpcmdec/gstdvdlpcmdec.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/gst/dvdlpcmdec/gstdvdlpcmdec.c b/gst/dvdlpcmdec/gstdvdlpcmdec.c
index f10337a8..6b476f45 100644
--- a/gst/dvdlpcmdec/gstdvdlpcmdec.c
+++ b/gst/dvdlpcmdec/gstdvdlpcmdec.c
@@ -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);
}