mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
omxaudioenc: Forward downstream flow returns to upstream
This commit is contained in:
parent
21faf556ff
commit
f93a45fb66
3 changed files with 32 additions and 1 deletions
|
@ -336,6 +336,7 @@ gst_omx_audio_enc_change_state (GstElement * element, GstStateChange transition)
|
|||
gst_omx_port_set_flushing (self->in_port, FALSE);
|
||||
if (self->out_port)
|
||||
gst_omx_port_set_flushing (self->out_port, FALSE);
|
||||
self->downstream_flow_ret = GST_FLOW_OK;
|
||||
break;
|
||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||
break;
|
||||
|
@ -361,6 +362,7 @@ gst_omx_audio_enc_change_state (GstElement * element, GstStateChange transition)
|
|||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||
break;
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
self->downstream_flow_ret = GST_FLOW_WRONG_STATE;
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
if (!gst_omx_audio_enc_close (self))
|
||||
|
@ -487,6 +489,8 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self)
|
|||
|
||||
gst_omx_port_release_buffer (port, buf);
|
||||
|
||||
self->downstream_flow_ret = flow_ret;
|
||||
|
||||
if (flow_ret != GST_FLOW_OK)
|
||||
goto flow_error;
|
||||
|
||||
|
@ -501,12 +505,14 @@ component_error:
|
|||
gst_pad_push_event (GST_BASE_AUDIO_ENCODER_SRC_PAD (self),
|
||||
gst_event_new_eos ());
|
||||
gst_pad_pause_task (GST_BASE_AUDIO_ENCODER_SRC_PAD (self));
|
||||
self->downstream_flow_ret = GST_FLOW_ERROR;
|
||||
return;
|
||||
}
|
||||
flushing:
|
||||
{
|
||||
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
|
||||
gst_pad_pause_task (GST_BASE_AUDIO_ENCODER_SRC_PAD (self));
|
||||
self->downstream_flow_ret = GST_FLOW_WRONG_STATE;
|
||||
return;
|
||||
}
|
||||
flow_error:
|
||||
|
@ -535,6 +541,7 @@ reconfigure_error:
|
|||
gst_pad_push_event (GST_BASE_AUDIO_ENCODER_SRC_PAD (self),
|
||||
gst_event_new_eos ());
|
||||
gst_pad_pause_task (GST_BASE_AUDIO_ENCODER_SRC_PAD (self));
|
||||
self->downstream_flow_ret = GST_FLOW_NOT_NEGOTIATED;
|
||||
return;
|
||||
}
|
||||
caps_failed:
|
||||
|
@ -543,6 +550,7 @@ caps_failed:
|
|||
gst_pad_push_event (GST_BASE_AUDIO_ENCODER_SRC_PAD (self),
|
||||
gst_event_new_eos ());
|
||||
gst_pad_pause_task (GST_BASE_AUDIO_ENCODER_SRC_PAD (self));
|
||||
self->downstream_flow_ret = GST_FLOW_NOT_NEGOTIATED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -555,6 +563,7 @@ gst_omx_audio_enc_start (GstBaseAudioEncoder * encoder)
|
|||
|
||||
self = GST_OMX_AUDIO_ENC (encoder);
|
||||
|
||||
self->downstream_flow_ret = GST_FLOW_OK;
|
||||
ret =
|
||||
gst_pad_start_task (GST_BASE_AUDIO_ENCODER_SRC_PAD (self),
|
||||
(GstTaskFunction) gst_omx_audio_enc_loop, self);
|
||||
|
@ -574,6 +583,7 @@ gst_omx_audio_enc_stop (GstBaseAudioEncoder * encoder)
|
|||
if (gst_omx_component_get_state (self->component, 0) > OMX_StateIdle)
|
||||
gst_omx_component_set_state (self->component, OMX_StateIdle);
|
||||
|
||||
self->downstream_flow_ret = GST_FLOW_WRONG_STATE;
|
||||
gst_omx_port_set_flushing (self->in_port, TRUE);
|
||||
gst_omx_port_set_flushing (self->out_port, TRUE);
|
||||
|
||||
|
@ -735,6 +745,7 @@ gst_omx_audio_enc_set_format (GstBaseAudioEncoder * encoder,
|
|||
}
|
||||
|
||||
/* Start the srcpad loop again */
|
||||
self->downstream_flow_ret = GST_FLOW_OK;
|
||||
gst_pad_start_task (GST_BASE_AUDIO_ENCODER_SRC_PAD (self),
|
||||
(GstTaskFunction) gst_omx_audio_enc_loop, encoder);
|
||||
|
||||
|
@ -763,6 +774,7 @@ gst_omx_audio_enc_flush (GstBaseAudioEncoder * encoder)
|
|||
}
|
||||
|
||||
/* Start the srcpad loop again */
|
||||
self->downstream_flow_ret = GST_FLOW_OK;
|
||||
gst_pad_start_task (GST_BASE_AUDIO_ENCODER_SRC_PAD (self),
|
||||
(GstTaskFunction) gst_omx_audio_enc_loop, encoder);
|
||||
}
|
||||
|
@ -779,6 +791,13 @@ gst_omx_audio_enc_handle_frame (GstBaseAudioEncoder * encoder,
|
|||
|
||||
self = GST_OMX_AUDIO_ENC (encoder);
|
||||
|
||||
if (self->downstream_flow_ret != GST_FLOW_OK) {
|
||||
GST_ERROR_OBJECT (self, "Downstream returned %s",
|
||||
gst_flow_get_name (self->downstream_flow_ret));
|
||||
|
||||
return self->downstream_flow_ret;
|
||||
}
|
||||
|
||||
if (inbuf == NULL)
|
||||
return GST_FLOW_OK;
|
||||
|
||||
|
@ -811,6 +830,14 @@ gst_omx_audio_enc_handle_frame (GstBaseAudioEncoder * encoder,
|
|||
|
||||
g_assert (acq_ret == GST_OMX_ACQUIRE_BUFFER_OK && buf != NULL);
|
||||
|
||||
if (self->downstream_flow_ret != GST_FLOW_OK) {
|
||||
GST_ERROR_OBJECT (self, "Downstream returned %s",
|
||||
gst_flow_get_name (self->downstream_flow_ret));
|
||||
|
||||
gst_omx_port_release_buffer (self->in_port, buf);
|
||||
return self->downstream_flow_ret;
|
||||
}
|
||||
|
||||
if (buf->omx_buf->nAllocLen - buf->omx_buf->nOffset <= 0)
|
||||
goto full_buffer;
|
||||
|
||||
|
@ -846,7 +873,7 @@ gst_omx_audio_enc_handle_frame (GstBaseAudioEncoder * encoder,
|
|||
gst_omx_port_release_buffer (self->in_port, buf);
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
return self->downstream_flow_ret;
|
||||
|
||||
full_buffer:
|
||||
{
|
||||
|
|
|
@ -57,6 +57,8 @@ struct _GstOMXAudioEnc
|
|||
/* TRUE if the component is configured and saw
|
||||
* the first buffer */
|
||||
gboolean started;
|
||||
|
||||
GstFlowReturn downstream_flow_ret;
|
||||
};
|
||||
|
||||
struct _GstOMXAudioEncClass
|
||||
|
|
|
@ -64,6 +64,8 @@ struct _GstOMXVideoEnc
|
|||
guint32 quant_i_frames;
|
||||
guint32 quant_p_frames;
|
||||
guint32 quant_b_frames;
|
||||
|
||||
GstFlowReturn downstream_flow_ret;
|
||||
};
|
||||
|
||||
struct _GstOMXVideoEncClass
|
||||
|
|
Loading…
Reference in a new issue