omxvideo: add debug infos to find_nearest_frame()

Those debug infos have proved to be very helpful when debugging
timestamp issues. They are often linked to gst-omx picking the wrong
frame when trying to map from OMX.
This commit is contained in:
Guillaume Desmottes 2019-06-14 10:57:29 +05:30
parent a7ecda85b6
commit cfeeb15b1e
4 changed files with 12 additions and 4 deletions

View file

@ -181,7 +181,8 @@ gst_omx_video_negotiation_map_free (GstOMXVideoNegotiationMap * m)
}
GstVideoCodecFrame *
gst_omx_video_find_nearest_frame (GstOMXBuffer * buf, GList * frames)
gst_omx_video_find_nearest_frame (GstElement * element, GstOMXBuffer * buf,
GList * frames)
{
GstVideoCodecFrame *best = NULL;
GstClockTimeDiff best_diff = G_MAXINT64;
@ -192,10 +193,17 @@ gst_omx_video_find_nearest_frame (GstOMXBuffer * buf, GList * frames)
gst_util_uint64_scale (GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp),
GST_SECOND, OMX_TICKS_PER_SECOND);
GST_LOG_OBJECT (element, "look for ts %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp));
for (l = frames; l; l = l->next) {
GstVideoCodecFrame *tmp = l->data;
GstClockTimeDiff diff = ABS (GST_CLOCK_DIFF (timestamp, tmp->pts));
GST_LOG_OBJECT (element,
" frame %u diff %" G_GINT64_FORMAT " ts %" GST_TIME_FORMAT,
tmp->system_frame_number, diff, GST_TIME_ARGS (tmp->pts));
if (diff < best_diff) {
best = tmp;
best_diff = diff;

View file

@ -57,7 +57,7 @@ void
gst_omx_video_negotiation_map_free (GstOMXVideoNegotiationMap * m);
GstVideoCodecFrame *
gst_omx_video_find_nearest_frame (GstOMXBuffer * buf, GList * frames);
gst_omx_video_find_nearest_frame (GstElement * element, GstOMXBuffer * buf, GList * frames);
OMX_U32 gst_omx_video_calculate_framerate_q16 (GstVideoInfo * info);

View file

@ -1716,7 +1716,7 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
gst_omx_buffer_flags_to_string (buf->omx_buf->nFlags),
(guint64) GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp));
frame = gst_omx_video_find_nearest_frame (buf,
frame = gst_omx_video_find_nearest_frame (GST_ELEMENT_CAST (self), buf,
gst_video_decoder_get_frames (GST_VIDEO_DECODER (self)));
/* So we have a timestamped OMX buffer and get, or not, corresponding frame.

View file

@ -1543,7 +1543,7 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self)
gst_omx_buffer_flags_to_string (buf->omx_buf->nFlags),
(guint64) GST_OMX_GET_TICKS (buf->omx_buf->nTimeStamp));
frame = gst_omx_video_find_nearest_frame (buf,
frame = gst_omx_video_find_nearest_frame (GST_ELEMENT_CAST (self), buf,
gst_video_encoder_get_frames (GST_VIDEO_ENCODER (self)));
g_assert (klass->handle_output_frame);