omxvideodec: Fix minor race condition when draining after upstream signalled EOS

This commit is contained in:
Sebastian Dröge 2011-11-09 15:45:20 +01:00
parent 92c26f684a
commit 60a6c1b49f

View file

@ -725,7 +725,6 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
if (!gst_omx_video_dec_fill_buffer (self, buf, outbuf)) { if (!gst_omx_video_dec_fill_buffer (self, buf, outbuf)) {
gst_buffer_unref (outbuf); gst_buffer_unref (outbuf);
gst_omx_port_release_buffer (self->out_port, buf); gst_omx_port_release_buffer (self->out_port, buf);
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
goto invalid_buffer; goto invalid_buffer;
} }
} else if (buf->omx_buf->nFilledLen > 0) { } else if (buf->omx_buf->nFilledLen > 0) {
@ -749,7 +748,6 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self), gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self),
frame); frame);
gst_omx_port_release_buffer (self->out_port, buf); gst_omx_port_release_buffer (self->out_port, buf);
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
goto invalid_buffer; goto invalid_buffer;
} }
} }
@ -761,7 +759,6 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self), gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self),
frame); frame);
} }
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
if ((flow_ret == GST_FLOW_OK && (buf->omx_buf->nFlags & OMX_BUFFERFLAG_EOS)) if ((flow_ret == GST_FLOW_OK && (buf->omx_buf->nFlags & OMX_BUFFERFLAG_EOS))
|| flow_ret == GST_FLOW_UNEXPECTED) { || flow_ret == GST_FLOW_UNEXPECTED) {
@ -786,6 +783,8 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
if (flow_ret != GST_FLOW_OK) if (flow_ret != GST_FLOW_OK)
goto flow_error; goto flow_error;
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
return; return;
component_error: component_error:
@ -829,6 +828,7 @@ flow_error:
gst_pad_pause_task (GST_BASE_VIDEO_CODEC_SRC_PAD (self)); gst_pad_pause_task (GST_BASE_VIDEO_CODEC_SRC_PAD (self));
} }
self->started = FALSE; self->started = FALSE;
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
return; return;
} }
@ -853,6 +853,7 @@ invalid_buffer:
gst_pad_pause_task (GST_BASE_VIDEO_CODEC_SRC_PAD (self)); gst_pad_pause_task (GST_BASE_VIDEO_CODEC_SRC_PAD (self));
self->downstream_flow_ret = GST_FLOW_NOT_NEGOTIATED; self->downstream_flow_ret = GST_FLOW_NOT_NEGOTIATED;
self->started = FALSE; self->started = FALSE;
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
return; return;
} }