mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
ext/mad/gstmad.c: don't overflow data buffer. Flush not needed sync data when syncing failed.
Original commit message from CVS: * ext/mad/gstmad.c: (gst_mad_chain): don't overflow data buffer. Flush not needed sync data when syncing failed.
This commit is contained in:
parent
5509374caf
commit
3824908ab3
2 changed files with 23 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2004-11-05 Benjamin Otte <otte@gnome.org>
|
||||||
|
|
||||||
|
* ext/mad/gstmad.c: (gst_mad_chain):
|
||||||
|
don't overflow data buffer. Flush not needed sync data when syncing
|
||||||
|
failed.
|
||||||
|
|
||||||
2004-11-04 Wim Taymans <wim@fluendo.com>
|
2004-11-04 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/alpha/gstalpha.c: (gst_alpha_method_get_type),
|
* gst/alpha/gstalpha.c: (gst_alpha_method_get_type),
|
||||||
|
|
|
@ -1246,7 +1246,15 @@ gst_mad_chain (GstPad * pad, GstData * _data)
|
||||||
gint tocopy;
|
gint tocopy;
|
||||||
guchar *mad_input_buffer; /* convenience pointer to tempbuffer */
|
guchar *mad_input_buffer; /* convenience pointer to tempbuffer */
|
||||||
|
|
||||||
tocopy = MIN (MAD_BUFFER_MDLEN, size);
|
tocopy =
|
||||||
|
MIN (MAD_BUFFER_MDLEN, MIN (size,
|
||||||
|
MAD_BUFFER_MDLEN * 3 - mad->tempsize));
|
||||||
|
if (tocopy == 0) {
|
||||||
|
GST_ELEMENT_ERROR (mad, STREAM, DECODE, (NULL),
|
||||||
|
("mad claims to need more data than %u bytes, we don't have that much",
|
||||||
|
MAD_BUFFER_MDLEN * 3));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* append the chunk to process to our internal temporary buffer */
|
/* append the chunk to process to our internal temporary buffer */
|
||||||
GST_LOG ("tempbuffer size %d, copying %d bytes from incoming buffer",
|
GST_LOG ("tempbuffer size %d, copying %d bytes from incoming buffer",
|
||||||
|
@ -1287,9 +1295,14 @@ gst_mad_chain (GstPad * pad, GstData * _data)
|
||||||
|
|
||||||
/* not enough data, need to wait for next buffer? */
|
/* not enough data, need to wait for next buffer? */
|
||||||
if (mad->stream.error == MAD_ERROR_BUFLEN) {
|
if (mad->stream.error == MAD_ERROR_BUFLEN) {
|
||||||
|
if (mad->stream.next_frame == mad_input_buffer) {
|
||||||
GST_LOG ("not enough data in tempbuffer (%d), breaking to get more",
|
GST_LOG ("not enough data in tempbuffer (%d), breaking to get more",
|
||||||
mad->tempsize);
|
mad->tempsize);
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
GST_LOG ("sync error, flushing unneeded data");
|
||||||
|
goto next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* we are in an error state */
|
/* we are in an error state */
|
||||||
mad->in_error = TRUE;
|
mad->in_error = TRUE;
|
||||||
|
|
Loading…
Reference in a new issue