omxvideodec/enc: delay allocation after the allocation query

Allocating OMX components buffers in set_format() is too early.
Doing it when receiving the first buffers will allow the element to use
the information from the allocation query and/or the first incoming
buffer to pick to best allocation mode.

Tested on raspberry pi with dynamic resolution changes on decoder and
encoder input.

https://bugzilla.gnome.org/show_bug.cgi?id=785967
This commit is contained in:
Guillaume Desmottes 2017-07-24 13:52:35 +02:00 committed by Nicolas Dufresne
parent 90da3c665e
commit 0603e442ce
2 changed files with 11 additions and 6 deletions

View file

@ -2282,9 +2282,6 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
gst_buffer_replace (&self->codec_data, state->codec_data);
self->input_state = gst_video_codec_state_ref (state);
if (!gst_omx_video_dec_enable (self))
return FALSE;
self->downstream_flow_ret = GST_FLOW_OK;
return TRUE;
}
@ -2404,6 +2401,12 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder,
gst_video_decoder_drop_frame (GST_VIDEO_DECODER (self), frame);
return GST_FLOW_OK;
}
if (gst_omx_port_is_flushing (self->dec_out_port)) {
if (!gst_omx_video_dec_enable (self))
return FALSE;
}
GST_DEBUG_OBJECT (self, "Starting task");
gst_pad_start_task (GST_VIDEO_DECODER_SRC_PAD (self),
(GstTaskFunction) gst_omx_video_dec_loop, decoder, NULL);

View file

@ -1283,9 +1283,6 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
gst_video_codec_state_unref (self->input_state);
self->input_state = gst_video_codec_state_ref (state);
if (!gst_omx_video_enc_enable (self))
return FALSE;
self->downstream_flow_ret = GST_FLOW_OK;
return TRUE;
}
@ -1519,6 +1516,11 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
}
if (!self->started) {
if (gst_omx_port_is_flushing (self->enc_out_port)) {
if (!gst_omx_video_enc_enable (self))
return FALSE;
}
GST_DEBUG_OBJECT (self, "Starting task");
gst_pad_start_task (GST_VIDEO_ENCODER_SRC_PAD (self),
(GstTaskFunction) gst_omx_video_enc_loop, self, NULL);