gst/dvdlpcmdec/gstdvdlpcmdec.c: Make sure we only write to writable buffers

Original commit message from CVS:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_chain):
Make sure we only write to writable buffers
This commit is contained in:
Jan Schmidt 2005-02-20 15:26:04 +00:00
parent 3e0d9912cf
commit 4cba588b1d
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,7 @@
2005-02-21 Jan Schmidt <thaytan@mad.scientist.com>
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_chain):
Make sure we only write to writable buffers
2005-02-20 Tim-Philipp Müller <tim at centricular dot net> 2005-02-20 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/riff/riff-media.c: * gst-libs/gst/riff/riff-media.c:

View file

@ -229,7 +229,6 @@ gst_dvdlpcmdec_chain (GstPad * pad, GstData * _data)
{ {
GstBuffer *buf = GST_BUFFER (_data); GstBuffer *buf = GST_BUFFER (_data);
GstDvdLpcmDec *dvdlpcmdec; GstDvdLpcmDec *dvdlpcmdec;
guchar *data;
gint64 size; gint64 size;
g_return_if_fail (pad != NULL); g_return_if_fail (pad != NULL);
@ -238,7 +237,6 @@ gst_dvdlpcmdec_chain (GstPad * pad, GstData * _data)
dvdlpcmdec = GST_DVDLPCMDEC (gst_pad_get_parent (pad)); dvdlpcmdec = GST_DVDLPCMDEC (gst_pad_get_parent (pad));
data = GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf); size = GST_BUFFER_SIZE (buf);
GST_LOG_OBJECT (dvdlpcmdec, "got buffer %p of size %" G_GINT64_FORMAT, buf, GST_LOG_OBJECT (dvdlpcmdec, "got buffer %p of size %" G_GINT64_FORMAT, buf,
@ -290,7 +288,7 @@ gst_dvdlpcmdec_chain (GstPad * pad, GstData * _data)
} }
gst_buffer_stamp (outbuf, buf); gst_buffer_stamp (outbuf, buf);
src = data; src = GST_BUFFER_DATA (buf);;
dest = GST_BUFFER_DATA (outbuf); dest = GST_BUFFER_DATA (outbuf);
/* Copy 20-bit LPCM format to 24-bit buffers, with 0x00 in the lowest /* Copy 20-bit LPCM format to 24-bit buffers, with 0x00 in the lowest
@ -324,7 +322,11 @@ gst_dvdlpcmdec_chain (GstPad * pad, GstData * _data)
* and last byte are already correct */ * and last byte are already correct */
gint64 count = size / 12; gint64 count = size / 12;
gint64 i; gint64 i;
guchar *src = data; guchar *src;
/* Ensure our output buffer is writable */
buf = gst_buffer_copy_on_write (buf);
src = GST_BUFFER_DATA (buf);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
guchar temp[9]; guchar temp[9];