vp8enc: Post an error message on the bus if encoder initialization fails
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 18 May 2010 12:30:15 +0000 (14:30 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 19 May 2010 17:24:03 +0000 (19:24 +0200)
ext/vp8/gstvp8enc.c

index adc6615437ad9ba7ffc07096ad7501059942e4ce..2e183e53106787612e4e047edd789ae2cfc1105e 100644 (file)
@@ -338,7 +338,6 @@ gst_vp8_enc_start (GstBaseVideoEncoder * base_video_encoder)
 
   encoder = GST_VP8_ENC (base_video_encoder);
 
-
   return TRUE;
 }
 
@@ -596,15 +595,16 @@ gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
 
     status = vpx_codec_enc_init (&encoder->encoder, &vpx_codec_vp8_cx_algo,
         &cfg, 0);
-    gst_base_video_encoder_set_latency (base_video_encoder, 0,
-        gst_util_uint64_scale (encoder->max_latency,
-            base_video_encoder->state.fps_d * GST_SECOND,
-            base_video_encoder->state.fps_n));
     if (status) {
-      GST_ERROR ("encoder input error");
+      GST_ELEMENT_ERROR (encoder, LIBRARY, INIT,
+          ("Failed to initialize VP8 encoder"), (NULL));
       return GST_FLOW_ERROR;
     }
 
+    gst_base_video_encoder_set_latency (base_video_encoder, 0,
+        gst_util_uint64_scale (encoder->max_latency,
+            base_video_encoder->state.fps_d * GST_SECOND,
+            base_video_encoder->state.fps_n));
     encoder->inited = TRUE;
   }