mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
omxvideodec: Release basevideocodec stream lock while waiting for a buffer
This prevents deadlocks if no empty input buffers are available and releasing input buffers requires the loop function to handle some output buffers first.
This commit is contained in:
parent
e494792ca4
commit
e583c48222
1 changed files with 9 additions and 4 deletions
|
@ -374,7 +374,7 @@ _find_nearest_frame (GstOMXVideoDec * self, GstOMXBuffer * buf)
|
|||
guint64 best_diff = G_MAXUINT64;
|
||||
BufferIdentification *best_id = NULL;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
GST_BASE_VIDEO_CODEC_STREAM_LOCK (self);
|
||||
for (l = GST_BASE_VIDEO_CODEC (self)->frames; l; l = l->next) {
|
||||
GstVideoFrame *tmp = l->data;
|
||||
BufferIdentification *id = tmp->coder_hook;
|
||||
|
@ -429,7 +429,7 @@ _find_nearest_frame (GstOMXVideoDec * self, GstOMXBuffer * buf)
|
|||
}
|
||||
}
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
|
||||
|
||||
if (finish_frames) {
|
||||
g_warning ("Too old frames, bug in decoder -- please file a bug");
|
||||
|
@ -924,12 +924,12 @@ gst_omx_video_dec_reset (GstBaseVideoDecoder * decoder)
|
|||
/* FIXME: Workaround for
|
||||
* https://bugzilla.gnome.org/show_bug.cgi?id=654529
|
||||
*/
|
||||
GST_OBJECT_LOCK (self);
|
||||
GST_BASE_VIDEO_CODEC_STREAM_LOCK (self);
|
||||
g_list_foreach (GST_BASE_VIDEO_CODEC (self)->frames,
|
||||
(GFunc) gst_base_video_codec_free_frame, NULL);
|
||||
g_list_free (GST_BASE_VIDEO_CODEC (self)->frames);
|
||||
GST_BASE_VIDEO_CODEC (self)->frames = NULL;
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
|
||||
|
||||
if (self->started) {
|
||||
gst_omx_port_set_flushing (self->in_port, TRUE);
|
||||
|
@ -975,7 +975,12 @@ gst_omx_video_dec_handle_frame (GstBaseVideoDecoder * decoder,
|
|||
duration = frame->presentation_duration;
|
||||
|
||||
while (offset < GST_BUFFER_SIZE (frame->sink_buffer)) {
|
||||
/* Make sure to release the base class stream lock, otherwise
|
||||
* _loop() can't call _finish_frame() and we might block forever
|
||||
* because no input buffers are released */
|
||||
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
|
||||
acq_ret = gst_omx_port_acquire_buffer (self->in_port, &buf);
|
||||
GST_BASE_VIDEO_CODEC_STREAM_LOCK (self);
|
||||
|
||||
if (acq_ret == GST_OMX_ACQUIRE_BUFFER_ERROR) {
|
||||
goto component_error;
|
||||
|
|
Loading…
Reference in a new issue