mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
omx: Wait until the Executing state is reached before calling OMX_FillThisBuffer()
This correctly works around the QCOM race condition that happens when calling FTB after setting the new state and before reaching it.
This commit is contained in:
parent
3ba45aa0af
commit
f0fe1148b7
5 changed files with 15 additions and 20 deletions
|
@ -1175,9 +1175,6 @@ gst_omx_port_set_flushing (GstOMXPort * port, gboolean flush)
|
||||||
if (port->port_def.eDir == OMX_DirOutput && port->buffers) {
|
if (port->port_def.eDir == OMX_DirOutput && port->buffers) {
|
||||||
GstOMXBuffer *buf;
|
GstOMXBuffer *buf;
|
||||||
|
|
||||||
if (comp->hacks & GST_OMX_HACK_QCOM_7x30_FILL_THIS_BUFFER_RACE)
|
|
||||||
g_usleep (G_USEC_PER_SEC / 10);
|
|
||||||
|
|
||||||
/* Enqueue all buffers for the component to fill */
|
/* Enqueue all buffers for the component to fill */
|
||||||
while ((buf = g_queue_pop_head (port->pending_buffers))) {
|
while ((buf = g_queue_pop_head (port->pending_buffers))) {
|
||||||
g_assert (!buf->used);
|
g_assert (!buf->used);
|
||||||
|
@ -1564,9 +1561,6 @@ gst_omx_port_set_enabled_unlocked (GstOMXPort * port, gboolean enabled)
|
||||||
if (enabled && port->port_def.eDir == OMX_DirOutput) {
|
if (enabled && port->port_def.eDir == OMX_DirOutput) {
|
||||||
GstOMXBuffer *buf;
|
GstOMXBuffer *buf;
|
||||||
|
|
||||||
if (comp->hacks & GST_OMX_HACK_QCOM_7x30_FILL_THIS_BUFFER_RACE)
|
|
||||||
g_usleep (G_USEC_PER_SEC / 10);
|
|
||||||
|
|
||||||
/* Enqueue all buffers for the component to fill */
|
/* Enqueue all buffers for the component to fill */
|
||||||
while ((buf = g_queue_pop_head (port->pending_buffers))) {
|
while ((buf = g_queue_pop_head (port->pending_buffers))) {
|
||||||
g_assert (!buf->used);
|
g_assert (!buf->used);
|
||||||
|
@ -1894,8 +1888,6 @@ gst_omx_parse_hacks (gchar ** hacks)
|
||||||
hacks_flags |= GST_OMX_HACK_VIDEO_FRAMERATE_INTEGER;
|
hacks_flags |= GST_OMX_HACK_VIDEO_FRAMERATE_INTEGER;
|
||||||
else if (g_str_equal (*hacks, "syncframe-flag-not-used"))
|
else if (g_str_equal (*hacks, "syncframe-flag-not-used"))
|
||||||
hacks_flags |= GST_OMX_HACK_SYNCFRAME_FLAG_NOT_USED;
|
hacks_flags |= GST_OMX_HACK_SYNCFRAME_FLAG_NOT_USED;
|
||||||
else if (g_str_equal (*hacks, "qcom-7x30-fill-this-buffer-race"))
|
|
||||||
hacks_flags |= GST_OMX_HACK_QCOM_7x30_FILL_THIS_BUFFER_RACE;
|
|
||||||
else
|
else
|
||||||
GST_WARNING ("Unknown hack: %s", *hacks);
|
GST_WARNING ("Unknown hack: %s", *hacks);
|
||||||
hacks++;
|
hacks++;
|
||||||
|
|
|
@ -55,12 +55,6 @@ G_BEGIN_DECLS
|
||||||
* Happens with the Bellagio ffmpegdist video encoder.
|
* Happens with the Bellagio ffmpegdist video encoder.
|
||||||
*/
|
*/
|
||||||
#define GST_OMX_HACK_SYNCFRAME_FLAG_NOT_USED G_GUINT64_CONSTANT (0x0000000000000008)
|
#define GST_OMX_HACK_SYNCFRAME_FLAG_NOT_USED G_GUINT64_CONSTANT (0x0000000000000008)
|
||||||
/* Qualcomm 7x30 sometimes fails with an undefined error after
|
|
||||||
* allocating buffers, setting the state to Idle when calling
|
|
||||||
* OMX_FillThisBuffer() on all output buffers too early.
|
|
||||||
*/
|
|
||||||
#define GST_OMX_HACK_QCOM_7x30_FILL_THIS_BUFFER_RACE G_GUINT64_CONSTANT (0x0000000000000010)
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GstOMXCore GstOMXCore;
|
typedef struct _GstOMXCore GstOMXCore;
|
||||||
typedef struct _GstOMXPort GstOMXPort;
|
typedef struct _GstOMXPort GstOMXPort;
|
||||||
|
|
|
@ -713,6 +713,10 @@ gst_omx_audio_enc_set_format (GstBaseAudioEncoder * encoder,
|
||||||
if (gst_omx_component_set_state (self->component,
|
if (gst_omx_component_set_state (self->component,
|
||||||
OMX_StateExecuting) != OMX_ErrorNone)
|
OMX_StateExecuting) != OMX_ErrorNone)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (gst_omx_component_get_state (self->component,
|
||||||
|
GST_CLOCK_TIME_NONE) != OMX_StateExecuting)
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unset flushing to allow ports to accept data again */
|
/* Unset flushing to allow ports to accept data again */
|
||||||
|
@ -730,8 +734,7 @@ gst_omx_audio_enc_set_format (GstBaseAudioEncoder * encoder,
|
||||||
gst_pad_start_task (GST_BASE_AUDIO_ENCODER_SRC_PAD (self),
|
gst_pad_start_task (GST_BASE_AUDIO_ENCODER_SRC_PAD (self),
|
||||||
(GstTaskFunction) gst_omx_audio_enc_loop, encoder);
|
(GstTaskFunction) gst_omx_audio_enc_loop, encoder);
|
||||||
|
|
||||||
return (gst_omx_component_get_state (self->component,
|
return TRUE;
|
||||||
GST_CLOCK_TIME_NONE) == OMX_StateExecuting);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1019,6 +1019,10 @@ gst_omx_video_dec_set_format (GstBaseVideoDecoder * decoder,
|
||||||
if (gst_omx_component_set_state (self->component,
|
if (gst_omx_component_set_state (self->component,
|
||||||
OMX_StateExecuting) != OMX_ErrorNone)
|
OMX_StateExecuting) != OMX_ErrorNone)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (gst_omx_component_get_state (self->component,
|
||||||
|
GST_CLOCK_TIME_NONE) != OMX_StateExecuting)
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unset flushing to allow ports to accept data again */
|
/* Unset flushing to allow ports to accept data again */
|
||||||
|
@ -1036,8 +1040,7 @@ gst_omx_video_dec_set_format (GstBaseVideoDecoder * decoder,
|
||||||
gst_pad_start_task (GST_BASE_VIDEO_CODEC_SRC_PAD (self),
|
gst_pad_start_task (GST_BASE_VIDEO_CODEC_SRC_PAD (self),
|
||||||
(GstTaskFunction) gst_omx_video_dec_loop, decoder);
|
(GstTaskFunction) gst_omx_video_dec_loop, decoder);
|
||||||
|
|
||||||
return (gst_omx_component_get_state (self->component,
|
return TRUE;
|
||||||
GST_CLOCK_TIME_NONE) == OMX_StateExecuting);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -954,6 +954,10 @@ gst_omx_video_enc_set_format (GstBaseVideoEncoder * encoder,
|
||||||
if (gst_omx_component_set_state (self->component,
|
if (gst_omx_component_set_state (self->component,
|
||||||
OMX_StateExecuting) != OMX_ErrorNone)
|
OMX_StateExecuting) != OMX_ErrorNone)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (gst_omx_component_get_state (self->component,
|
||||||
|
GST_CLOCK_TIME_NONE) != OMX_StateExecuting)
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unset flushing to allow ports to accept data again */
|
/* Unset flushing to allow ports to accept data again */
|
||||||
|
@ -971,8 +975,7 @@ gst_omx_video_enc_set_format (GstBaseVideoEncoder * encoder,
|
||||||
gst_pad_start_task (GST_BASE_VIDEO_CODEC_SRC_PAD (self),
|
gst_pad_start_task (GST_BASE_VIDEO_CODEC_SRC_PAD (self),
|
||||||
(GstTaskFunction) gst_omx_video_enc_loop, encoder);
|
(GstTaskFunction) gst_omx_video_enc_loop, encoder);
|
||||||
|
|
||||||
return (gst_omx_component_get_state (self->component,
|
return TRUE;
|
||||||
GST_CLOCK_TIME_NONE) == OMX_StateExecuting);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue