omxvideoenc: Make srcpad caps setting threadsafe
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 10 Nov 2011 14:17:56 +0000 (15:17 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 10 Nov 2011 14:17:56 +0000 (15:17 +0100)
omx/gstomxvideoenc.c

index ee4a9d2..f91e87d 100644 (file)
@@ -727,12 +727,15 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self)
     GstVideoState *state = &GST_BASE_VIDEO_CODEC (self)->state;
     GstCaps *caps;
 
+    GST_BASE_VIDEO_CODEC_STREAM_LOCK (self);
+
     GST_DEBUG_OBJECT (self, "Port settings have changed, updating caps");
 
     caps = klass->get_caps (self, self->out_port, state);
     if (!caps) {
       if (buf)
         gst_omx_port_release_buffer (self->out_port, buf);
+      GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
       goto caps_failed;
     }
 
@@ -740,10 +743,13 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self)
       gst_caps_unref (caps);
       if (buf)
         gst_omx_port_release_buffer (self->out_port, buf);
+      GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
       goto caps_failed;
     }
     gst_caps_unref (caps);
 
+    GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
+
     /* Now get a buffer */
     if (acq_return != GST_OMX_ACQUIRE_BUFFER_OK)
       return;