video: Correct usage of the base class stream lock

And also renegotiate if the srcpad requires reconfiguration
This commit is contained in:
Sebastian Dröge 2012-07-23 11:50:11 +02:00
parent 7b06c34868
commit df08e333d2
2 changed files with 6 additions and 4 deletions

View file

@ -2172,12 +2172,12 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder,
GST_LOG_OBJECT (decoder, "finish frame %p", frame); GST_LOG_OBJECT (decoder, "finish frame %p", frame);
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
if (G_UNLIKELY (priv->output_state_changed || (priv->output_state if (G_UNLIKELY (priv->output_state_changed || (priv->output_state
&& gst_pad_check_reconfigure (decoder->srcpad)))) && gst_pad_check_reconfigure (decoder->srcpad))))
gst_video_decoder_negotiate (decoder); gst_video_decoder_negotiate (decoder);
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
gst_video_decoder_prepare_finish_frame (decoder, frame, FALSE); gst_video_decoder_prepare_finish_frame (decoder, frame, FALSE);
priv->processed++; priv->processed++;
@ -2827,13 +2827,13 @@ gst_video_decoder_allocate_output_frame (GstVideoDecoder *
g_return_val_if_fail (num_bytes != 0, GST_FLOW_ERROR); g_return_val_if_fail (num_bytes != 0, GST_FLOW_ERROR);
g_return_val_if_fail (frame->output_buffer == NULL, GST_FLOW_ERROR); g_return_val_if_fail (frame->output_buffer == NULL, GST_FLOW_ERROR);
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
if (G_UNLIKELY (decoder->priv->output_state_changed if (G_UNLIKELY (decoder->priv->output_state_changed
|| (decoder->priv->output_state || (decoder->priv->output_state
&& gst_pad_check_reconfigure (decoder->srcpad)))) && gst_pad_check_reconfigure (decoder->srcpad))))
gst_video_decoder_negotiate (decoder); gst_video_decoder_negotiate (decoder);
GST_LOG_OBJECT (decoder, "alloc buffer size %d", num_bytes); GST_LOG_OBJECT (decoder, "alloc buffer size %d", num_bytes);
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
flow_ret = gst_buffer_pool_acquire_buffer (decoder->priv->pool, flow_ret = gst_buffer_pool_acquire_buffer (decoder->priv->pool,
&frame->output_buffer, NULL); &frame->output_buffer, NULL);

View file

@ -1507,9 +1507,11 @@ gst_video_encoder_finish_frame (GstVideoEncoder * encoder,
GST_VIDEO_ENCODER_STREAM_LOCK (encoder); GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
if (G_UNLIKELY (priv->output_state_changed)) if (G_UNLIKELY (priv->output_state_changed || (priv->output_state
&& gst_pad_check_reconfigure (encoder->srcpad))))
gst_video_encoder_set_src_caps (encoder); gst_video_encoder_set_src_caps (encoder);
if (G_UNLIKELY (priv->output_state == NULL)) if (G_UNLIKELY (priv->output_state == NULL))
goto no_output_state; goto no_output_state;