audioencoder: make stop() vfunc also optional
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 4 Oct 2012 12:40:32 +0000 (13:40 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 4 Oct 2012 12:40:32 +0000 (13:40 +0100)
Just change default value, since we also don't want to fail
if we want to deactivate and aren't active or want to activate
and are already active.

https://bugzilla.gnome.org/show_bug.cgi?id=685490

gst-libs/gst/audio/gstaudioencoder.c

index 73a5f37..27a4f0a 100644 (file)
@@ -1956,7 +1956,7 @@ static gboolean
 gst_audio_encoder_activate (GstAudioEncoder * enc, gboolean active)
 {
   GstAudioEncoderClass *klass;
-  gboolean result = FALSE;
+  gboolean result = TRUE;
 
   klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
 
@@ -1971,12 +1971,8 @@ gst_audio_encoder_activate (GstAudioEncoder * enc, gboolean active)
     enc->priv->tags = gst_tag_list_new_empty ();
     enc->priv->tags_changed = FALSE;
 
-    if (!enc->priv->active) {
-      if (klass->start)
-        result = klass->start (enc);
-      else
-        result = TRUE;
-    }
+    if (!enc->priv->active && klass->start)
+      result = klass->start (enc);
   } else {
     /* We must make sure streaming has finished before resetting things
      * and calling the ::stop vfunc */