omx: Improve debug output

This commit is contained in:
Sebastian Dröge 2012-12-20 12:20:31 +01:00
parent f6f078e847
commit f90a6ed9e9
3 changed files with 82 additions and 0 deletions

View file

@ -292,6 +292,8 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self)
goto caps_failed; goto caps_failed;
} }
GST_DEBUG_OBJECT (self, "Setting output caps: %" GST_PTR_FORMAT, caps);
if (!gst_pad_set_caps (GST_AUDIO_ENCODER_SRC_PAD (self), caps)) { if (!gst_pad_set_caps (GST_AUDIO_ENCODER_SRC_PAD (self), caps)) {
gst_caps_unref (caps); gst_caps_unref (caps);
if (buf) if (buf)
@ -333,6 +335,7 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self)
GstBuffer *codec_data; GstBuffer *codec_data;
GstMapInfo map = GST_MAP_INFO_INIT; GstMapInfo map = GST_MAP_INFO_INIT;
GST_DEBUG_OBJECT (self, "Handling codec data");
caps = caps =
gst_caps_copy (gst_pad_get_current_caps (GST_AUDIO_ENCODER_SRC_PAD gst_caps_copy (gst_pad_get_current_caps (GST_AUDIO_ENCODER_SRC_PAD
(self))); (self)));
@ -359,6 +362,8 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self)
GstBuffer *outbuf; GstBuffer *outbuf;
guint n_samples; guint n_samples;
GST_DEBUG_OBJECT (self, "Handling output data");
n_samples = n_samples =
klass->get_num_samples (self, self->out_port, klass->get_num_samples (self, self->out_port,
gst_audio_encoder_get_audio_info (GST_AUDIO_ENCODER (self)), buf); gst_audio_encoder_get_audio_info (GST_AUDIO_ENCODER (self)), buf);
@ -391,6 +396,8 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self)
outbuf, n_samples); outbuf, n_samples);
} }
GST_DEBUG_OBJECT (self, "Handled output data");
if (is_eos || flow_ret == GST_FLOW_EOS) { if (is_eos || flow_ret == GST_FLOW_EOS) {
g_mutex_lock (&self->drain_lock); g_mutex_lock (&self->drain_lock);
if (self->draining) { if (self->draining) {
@ -565,17 +572,23 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
* format change happened we can just exit here. * format change happened we can just exit here.
*/ */
if (needs_disable) { if (needs_disable) {
GST_DEBUG_OBJECT (self, "Need to disable and drain encoder");
gst_omx_audio_enc_drain (self); gst_omx_audio_enc_drain (self);
if (gst_omx_port_manual_reconfigure (self->in_port, TRUE) != OMX_ErrorNone) if (gst_omx_port_manual_reconfigure (self->in_port, TRUE) != OMX_ErrorNone)
return FALSE; return FALSE;
if (gst_omx_port_set_enabled (self->in_port, FALSE) != OMX_ErrorNone) if (gst_omx_port_set_enabled (self->in_port, FALSE) != OMX_ErrorNone)
return FALSE; return FALSE;
GST_DEBUG_OBJECT (self, "Encoder drained and disabled");
} }
port_def.format.audio.eEncoding = OMX_AUDIO_CodingPCM; port_def.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
GST_DEBUG_OBJECT (self, "Setting inport port definition");
if (!gst_omx_port_update_port_definition (self->in_port, &port_def)) if (!gst_omx_port_update_port_definition (self->in_port, &port_def))
return FALSE; return FALSE;
GST_DEBUG_OBJECT (self, "Setting outport port definition");
if (!gst_omx_port_update_port_definition (self->out_port, NULL)) if (!gst_omx_port_update_port_definition (self->out_port, NULL))
return FALSE; return FALSE;
@ -632,6 +645,7 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
pcm_param.eChannelMapping[i] = pos; pcm_param.eChannelMapping[i] = pos;
} }
GST_DEBUG_OBJECT (self, "Setting PCM parameters");
err = err =
gst_omx_component_set_parameter (self->component, OMX_IndexParamAudioPcm, gst_omx_component_set_parameter (self->component, OMX_IndexParamAudioPcm,
&pcm_param); &pcm_param);
@ -648,6 +662,7 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
} }
} }
GST_DEBUG_OBJECT (self, "Enabling component");
if (needs_disable) { if (needs_disable) {
if (gst_omx_port_set_enabled (self->in_port, TRUE) != OMX_ErrorNone) if (gst_omx_port_set_enabled (self->in_port, TRUE) != OMX_ErrorNone)
return FALSE; return FALSE;
@ -689,6 +704,7 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
} }
/* Start the srcpad loop again */ /* Start the srcpad loop again */
GST_DEBUG_OBJECT (self, "Starting task again");
self->downstream_flow_ret = GST_FLOW_OK; self->downstream_flow_ret = GST_FLOW_OK;
gst_pad_start_task (GST_AUDIO_ENCODER_SRC_PAD (self), gst_pad_start_task (GST_AUDIO_ENCODER_SRC_PAD (self),
(GstTaskFunction) gst_omx_audio_enc_loop, encoder, NULL); (GstTaskFunction) gst_omx_audio_enc_loop, encoder, NULL);
@ -797,6 +813,8 @@ gst_omx_audio_enc_handle_frame (GstAudioEncoder * encoder, GstBuffer * inbuf)
goto full_buffer; goto full_buffer;
} }
GST_DEBUG_OBJECT (self, "Handling frame at offset %d", offset);
/* Copy the buffer content in chunks of size as requested /* Copy the buffer content in chunks of size as requested
* by the port */ * by the port */
buf->omx_buf->nFilledLen = buf->omx_buf->nFilledLen =
@ -828,6 +846,8 @@ gst_omx_audio_enc_handle_frame (GstAudioEncoder * encoder, GstBuffer * inbuf)
gst_omx_port_release_buffer (self->in_port, buf); gst_omx_port_release_buffer (self->in_port, buf);
} }
GST_DEBUG_OBJECT (self, "Passed frame to component");
return self->downstream_flow_ret; return self->downstream_flow_ret;
full_buffer: full_buffer:

View file

@ -552,9 +552,13 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
switch (port_def.format.video.eColorFormat) { switch (port_def.format.video.eColorFormat) {
case OMX_COLOR_FormatYUV420Planar: case OMX_COLOR_FormatYUV420Planar:
case OMX_COLOR_FormatYUV420PackedPlanar: case OMX_COLOR_FormatYUV420PackedPlanar:
GST_DEBUG_OBJECT (self, "Output is I420 (%d)",
port_def.format.video.eColorFormat);
format = GST_VIDEO_FORMAT_I420; format = GST_VIDEO_FORMAT_I420;
break; break;
case OMX_COLOR_FormatYUV420SemiPlanar: case OMX_COLOR_FormatYUV420SemiPlanar:
GST_DEBUG_OBJECT (self, "Output is NV12 (%d)",
port_def.format.video.eColorFormat);
format = GST_VIDEO_FORMAT_NV12; format = GST_VIDEO_FORMAT_NV12;
break; break;
default: default:
@ -567,6 +571,11 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
break; break;
} }
GST_DEBUG_OBJECT (self,
"Setting output state: format %s, width %d, height %d",
gst_video_format_to_string (format), port_def.format.video.nFrameWidth,
port_def.format.video.nFrameHeight);
state = gst_video_decoder_set_output_state (GST_VIDEO_DECODER (self), state = gst_video_decoder_set_output_state (GST_VIDEO_DECODER (self),
format, port_def.format.video.nFrameWidth, format, port_def.format.video.nFrameWidth,
port_def.format.video.nFrameHeight, self->input_state); port_def.format.video.nFrameHeight, self->input_state);
@ -659,6 +668,8 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
gst_video_decoder_finish_frame (GST_VIDEO_DECODER (self), frame); gst_video_decoder_finish_frame (GST_VIDEO_DECODER (self), frame);
} }
GST_DEBUG_OBJECT (self, "Read frame from component");
if (is_eos || flow_ret == GST_FLOW_EOS) { if (is_eos || flow_ret == GST_FLOW_EOS) {
g_mutex_lock (&self->drain_lock); g_mutex_lock (&self->drain_lock);
if (self->draining) { if (self->draining) {
@ -853,8 +864,13 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
GstStructure *s; GstStructure *s;
const gchar *format_str; const gchar *format_str;
GST_DEBUG_OBJECT (self, "Trying to negotiate a video format with downstream");
intersection = gst_pad_get_allowed_caps (GST_VIDEO_DECODER_SRC_PAD (self)); intersection = gst_pad_get_allowed_caps (GST_VIDEO_DECODER_SRC_PAD (self));
GST_DEBUG_OBJECT (self, "Allowed downstream caps: %" GST_PTR_FORMAT,
intersection);
GST_OMX_INIT_STRUCT (&param); GST_OMX_INIT_STRUCT (&param);
param.nPortIndex = port->index; param.nPortIndex = port->index;
param.nIndex = 0; param.nIndex = 0;
@ -890,6 +906,8 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
gst_caps_append_structure (comp_supported_caps, gst_caps_append_structure (comp_supported_caps,
gst_structure_new ("video/x-raw", gst_structure_new ("video/x-raw",
"format", G_TYPE_STRING, "I420", NULL)); "format", G_TYPE_STRING, "I420", NULL));
GST_DEBUG_OBJECT (self, "Component supports I420 (%d) at index %d",
param.eColorFormat, param.nIndex);
break; break;
case OMX_COLOR_FormatYUV420SemiPlanar: case OMX_COLOR_FormatYUV420SemiPlanar:
m = g_slice_new0 (VideoNegotiationMap); m = g_slice_new0 (VideoNegotiationMap);
@ -899,6 +917,8 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
gst_caps_append_structure (comp_supported_caps, gst_caps_append_structure (comp_supported_caps,
gst_structure_new ("video/x-raw", gst_structure_new ("video/x-raw",
"format", G_TYPE_STRING, "NV12", NULL)); "format", G_TYPE_STRING, "NV12", NULL));
GST_DEBUG_OBJECT (self, "Component supports NV12 (%d) at index %d",
param.eColorFormat, param.nIndex);
break; break;
default: default:
break; break;
@ -949,6 +969,9 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
} }
} }
GST_DEBUG_OBJECT (self, "Negotiating color format %s (%d)", format_str,
param.eColorFormat);
/* We must find something here */ /* We must find something here */
g_assert (l != NULL); g_assert (l != NULL);
g_list_free_full (negotiation_map, g_list_free_full (negotiation_map,
@ -1016,6 +1039,8 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
} }
if (needs_disable && is_format_change) { if (needs_disable && is_format_change) {
GST_DEBUG_OBJECT (self, "Need to disable and drain decoder");
gst_omx_video_dec_drain (self, FALSE); gst_omx_video_dec_drain (self, FALSE);
if (klass->cdata.hacks & GST_OMX_HACK_NO_COMPONENT_RECONFIGURE) { if (klass->cdata.hacks & GST_OMX_HACK_NO_COMPONENT_RECONFIGURE) {
@ -1039,6 +1064,8 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
if (self->input_state) if (self->input_state)
gst_video_codec_state_unref (self->input_state); gst_video_codec_state_unref (self->input_state);
self->input_state = NULL; self->input_state = NULL;
GST_DEBUG_OBJECT (self, "Decoder drained and disabled");
} }
port_def.format.video.nFrameWidth = info->width; port_def.format.video.nFrameWidth = info->width;
@ -1048,8 +1075,12 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
else else
port_def.format.video.xFramerate = (info->fps_n << 16) / (info->fps_d); port_def.format.video.xFramerate = (info->fps_n << 16) / (info->fps_d);
GST_DEBUG_OBJECT (self, "Setting inport port definition");
if (!gst_omx_port_update_port_definition (self->in_port, &port_def)) if (!gst_omx_port_update_port_definition (self->in_port, &port_def))
return FALSE; return FALSE;
GST_DEBUG_OBJECT (self, "Setting outport port definition");
if (!gst_omx_port_update_port_definition (self->out_port, NULL)) if (!gst_omx_port_update_port_definition (self->out_port, NULL))
return FALSE; return FALSE;
@ -1067,6 +1098,8 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
GST_LOG_OBJECT (self, "Negotiation failed, will get output format later"); GST_LOG_OBJECT (self, "Negotiation failed, will get output format later");
} }
GST_DEBUG_OBJECT (self, "Enabling component");
if (needs_disable) { if (needs_disable) {
if (gst_omx_port_set_enabled (self->in_port, TRUE) != OMX_ErrorNone) if (gst_omx_port_set_enabled (self->in_port, TRUE) != OMX_ErrorNone)
return FALSE; return FALSE;
@ -1108,6 +1141,8 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
} }
/* Start the srcpad loop again */ /* Start the srcpad loop again */
GST_DEBUG_OBJECT (self, "Starting task again");
self->downstream_flow_ret = GST_FLOW_OK; self->downstream_flow_ret = GST_FLOW_OK;
gst_pad_start_task (GST_VIDEO_DECODER_SRC_PAD (self), gst_pad_start_task (GST_VIDEO_DECODER_SRC_PAD (self),
(GstTaskFunction) gst_omx_video_dec_loop, decoder, NULL); (GstTaskFunction) gst_omx_video_dec_loop, decoder, NULL);
@ -1233,6 +1268,8 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder,
} }
if (self->codec_data) { if (self->codec_data) {
GST_DEBUG_OBJECT (self, "Passing codec data to the component");
codec_data = self->codec_data; codec_data = self->codec_data;
if (buf->omx_buf->nAllocLen - buf->omx_buf->nOffset < if (buf->omx_buf->nAllocLen - buf->omx_buf->nOffset <
@ -1255,6 +1292,7 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder,
} }
/* Now handle the frame */ /* Now handle the frame */
GST_DEBUG_OBJECT (self, "Passing frame offset %d to the component", offset);
/* Copy the buffer content in chunks of size as requested /* Copy the buffer content in chunks of size as requested
* by the port */ * by the port */
@ -1305,6 +1343,8 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder,
gst_omx_port_release_buffer (self->in_port, buf); gst_omx_port_release_buffer (self->in_port, buf);
} }
GST_DEBUG_OBJECT (self, "Passed frame to component");
return self->downstream_flow_ret; return self->downstream_flow_ret;
full_buffer: full_buffer:

View file

@ -618,6 +618,8 @@ gst_omx_video_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port,
GstMapInfo map = GST_MAP_INFO_INIT; GstMapInfo map = GST_MAP_INFO_INIT;
GstCaps *caps; GstCaps *caps;
GST_DEBUG_OBJECT (self, "Handling codec data");
caps = klass->get_caps (self, self->out_port, self->input_state); caps = klass->get_caps (self, self->out_port, self->input_state);
codec_data = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen); codec_data = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen);
@ -637,6 +639,8 @@ gst_omx_video_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port,
GstBuffer *outbuf; GstBuffer *outbuf;
GstMapInfo map = GST_MAP_INFO_INIT; GstMapInfo map = GST_MAP_INFO_INIT;
GST_DEBUG_OBJECT (self, "Handling output data");
if (buf->omx_buf->nFilledLen > 0) { if (buf->omx_buf->nFilledLen > 0) {
outbuf = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen); outbuf = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen);
@ -726,6 +730,9 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self)
GST_VIDEO_ENCODER_STREAM_UNLOCK (self); GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
goto caps_failed; goto caps_failed;
} }
GST_DEBUG_OBJECT (self, "Setting output state: %" GST_PTR_FORMAT, caps);
state = state =
gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (self), caps, gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (self), caps,
self->input_state); self->input_state);
@ -795,6 +802,8 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self)
flow_ret = GST_FLOW_EOS; flow_ret = GST_FLOW_EOS;
} }
GST_DEBUG_OBJECT (self, "Read frame from component");
if (flow_ret != GST_FLOW_OK) if (flow_ret != GST_FLOW_OK)
goto flow_error; goto flow_error;
@ -942,12 +951,15 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
* format change happened we can just exit here. * format change happened we can just exit here.
*/ */
if (needs_disable) { if (needs_disable) {
GST_DEBUG_OBJECT (self, "Need to disable and drain encoder");
gst_omx_video_enc_drain (self, FALSE); gst_omx_video_enc_drain (self, FALSE);
if (gst_omx_port_manual_reconfigure (self->in_port, TRUE) != OMX_ErrorNone) if (gst_omx_port_manual_reconfigure (self->in_port, TRUE) != OMX_ErrorNone)
return FALSE; return FALSE;
if (gst_omx_port_set_enabled (self->in_port, FALSE) != OMX_ErrorNone) if (gst_omx_port_set_enabled (self->in_port, FALSE) != OMX_ErrorNone)
return FALSE; return FALSE;
GST_DEBUG_OBJECT (self, "Encoder drained and disabled");
} }
switch (info->finfo->format) { switch (info->finfo->format) {
@ -974,8 +986,11 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
port_def.format.video.xFramerate = (info->fps_n) / (info->fps_d); port_def.format.video.xFramerate = (info->fps_n) / (info->fps_d);
} }
GST_DEBUG_OBJECT (self, "Setting inport port definition");
if (!gst_omx_port_update_port_definition (self->in_port, &port_def)) if (!gst_omx_port_update_port_definition (self->in_port, &port_def))
return FALSE; return FALSE;
GST_DEBUG_OBJECT (self, "Setting outport port definition");
if (!gst_omx_port_update_port_definition (self->out_port, NULL)) if (!gst_omx_port_update_port_definition (self->out_port, NULL))
return FALSE; return FALSE;
@ -986,6 +1001,7 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
} }
} }
GST_DEBUG_OBJECT (self, "Enabling component");
if (needs_disable) { if (needs_disable) {
if (gst_omx_port_set_enabled (self->in_port, TRUE) != OMX_ErrorNone) if (gst_omx_port_set_enabled (self->in_port, TRUE) != OMX_ErrorNone)
return FALSE; return FALSE;
@ -1031,6 +1047,7 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
self->input_state = gst_video_codec_state_ref (self->input_state); self->input_state = gst_video_codec_state_ref (self->input_state);
/* Start the srcpad loop again */ /* Start the srcpad loop again */
GST_DEBUG_OBJECT (self, "Starting task again");
self->downstream_flow_ret = GST_FLOW_OK; self->downstream_flow_ret = GST_FLOW_OK;
gst_pad_start_task (GST_VIDEO_ENCODER_SRC_PAD (self), gst_pad_start_task (GST_VIDEO_ENCODER_SRC_PAD (self),
(GstTaskFunction) gst_omx_video_enc_loop, encoder, NULL); (GstTaskFunction) gst_omx_video_enc_loop, encoder, NULL);
@ -1299,6 +1316,8 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
} }
/* Now handle the frame */ /* Now handle the frame */
GST_DEBUG_OBJECT (self, "Handling frame");
if (GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME (frame)) { if (GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME (frame)) {
OMX_ERRORTYPE err; OMX_ERRORTYPE err;
OMX_CONFIG_INTRAREFRESHVOPTYPE config; OMX_CONFIG_INTRAREFRESHVOPTYPE config;
@ -1307,6 +1326,7 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
config.nPortIndex = self->out_port->index; config.nPortIndex = self->out_port->index;
config.IntraRefreshVOP = OMX_TRUE; config.IntraRefreshVOP = OMX_TRUE;
GST_DEBUG_OBJECT (self, "Forcing a keyframe");
err = err =
gst_omx_component_set_config (self->component, gst_omx_component_set_config (self->component,
OMX_IndexConfigVideoIntraVOPRefresh, &config); OMX_IndexConfigVideoIntraVOPRefresh, &config);
@ -1344,6 +1364,8 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
self->started = TRUE; self->started = TRUE;
gst_omx_port_release_buffer (self->in_port, buf); gst_omx_port_release_buffer (self->in_port, buf);
GST_DEBUG_OBJECT (self, "Passed frame to component");
} }
return self->downstream_flow_ret;; return self->downstream_flow_ret;;