theoraenc: Do nothing when flushing the encoder when no caps were set
authorThibault Saunier <thibault.saunier@collabora.com>
Thu, 10 Oct 2013 18:56:32 +0000 (15:56 -0300)
committerThibault Saunier <thibault.saunier@collabora.com>
Mon, 14 Oct 2013 20:49:59 +0000 (17:49 -0300)
In case we receive a flush event before having our caps set, we will
end up trying to create a theora encoder even though we are not ready.
Avoid that situation making sure we are initialized before accepting to
be flushed.

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

ext/theora/gsttheoraenc.c

index f830ecc..f996c2c 100644 (file)
@@ -364,6 +364,13 @@ theora_enc_flush (GstVideoEncoder * encoder)
   ogg_uint32_t keyframe_force;
   int rate_flags;
 
+
+  if (enc->input_state == NULL) {
+    GST_INFO_OBJECT (enc, "Not configured yet, returning FALSE");
+
+    return FALSE;
+  }
+
   GST_OBJECT_LOCK (enc);
   enc->info.target_bitrate = enc->video_bitrate;
   enc->info.quality = enc->video_quality;