Fix: don't try to mangle a read-only buffer. This was causing SEGV when volume fed...
authorjim thornton <jthornton@parc.com>
Tue, 2 Apr 2002 16:43:08 +0000 (16:43 +0000)
committerAndy Wingo <wingo@pobox.com>
Tue, 2 Apr 2002 16:43:08 +0000 (16:43 +0000)
Original commit message from CVS:
patch from jim thornton <jthornton@parc.com>:

Fix: don't try to mangle a read-only buffer.  This was causing SEGV when
volume fed from wavparse from filesrc (which mmaps the file read-only)

common
gst/volume/gstvolume.c

diff --git a/common b/common
index 38267ab..6148068 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 38267abf56a3428093cea71429dca6a24a927547
+Subproject commit 6148068f2318e85d8e66df485342b630d8fb49ac
index 5ed2238..02f8561 100644 (file)
@@ -255,6 +255,9 @@ volume_chain (GstPad *pad, GstBuffer *buf)
   g_return_if_fail(filter != NULL);
   g_return_if_fail(GST_IS_VOLUME(filter));
   
+  if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_READONLY))
+    buf = gst_buffer_copy (buf);
+  
   switch (filter->format) {
   case GST_VOLUME_FORMAT_INT:
     int_data = (gint16 *)GST_BUFFER_DATA(buf);
@@ -314,6 +317,7 @@ volume_set_property (GObject *object, guint prop_id, const GValue *value, GParam
     filter->volume_i       = filter->volume_f*8192;
     break;
   default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     break;
   }
 }