opusenc: fix crash when setting "cbr" property when encoder is not running yet
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Mon, 28 Jan 2013 14:12:56 +0000 (14:12 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Mon, 28 Jan 2013 14:12:56 +0000 (14:12 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=692698

ext/opus/gstopusenc.c

index d6dfa9d1734ceda715217913f26f3f392af15c98..9eefe9ca76ecbf35c2a1970bad6d7458d0a6738b 100644 (file)
@@ -996,7 +996,8 @@ gst_opus_enc_set_property (GObject * object, guint prop_id,
       /* this one has an opposite meaning to the opus ctl... */
       g_mutex_lock (&enc->property_lock);
       enc->cbr = g_value_get_boolean (value);
-      opus_multistream_encoder_ctl (enc->state, OPUS_SET_VBR (!enc->cbr));
+      if (enc->state)
+        opus_multistream_encoder_ctl (enc->state, OPUS_SET_VBR (!enc->cbr));
       g_mutex_unlock (&enc->property_lock);
       break;
     case PROP_CONSTRAINED_VBR: