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:49:37 +0000 (14:49 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=692698

ext/opus/gstopusenc.c

index 2948754dea77f36abfc165632e3ce2c91acf87ff..1e71cf2f98d05210c71f6051f36dc68066632049 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: