diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2019-06-14 10:57:29 +0530 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2019-06-17 09:17:14 +0530 |
commit | cfeeb15b1e3fbe473212cc2747b9cd3dd10fbe2e (patch) | |
tree | 3e5058b2076b69516f69740fcc5e01ffdce6ede9 /omx | |
parent | a7ecda85b6103d951b6a8805b5ee87ebeababa0b (diff) | |
download | gst-omx-cfeeb15b1e3fbe473212cc2747b9cd3dd10fbe2e.tar.gz |
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.
Diffstat (limited to 'omx')
-rw-r--r-- | omx/gstomxvideo.c | 10 | ||||
-rw-r--r-- | omx/gstomxvideo.h | 2 | ||||
-rw-r--r-- | omx/gstomxvideodec.c | 2 | ||||
-rw-r--r-- | omx/gstomxvideoenc.c | 2 |
4 files changed, 12 insertions, 4 deletions
diff --git a/omx/gstomxvideo.c b/omx/gstomxvideo.c index 9feda19..9b57b55 100644 --- a/omx/gstomxvideo.c +++ b/omx/gstomxvideo.c @@ -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; diff --git a/omx/gstomxvideo.h b/omx/gstomxvideo.h index 9251547..8252df9 100644 --- a/omx/gstomxvideo.h +++ b/omx/gstomxvideo.h @@ -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); diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index d6e7ab0..aa6845a 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -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. diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 7e088fc..7e1e754 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -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); |