diff --git a/omx/gstomxvideo.c b/omx/gstomxvideo.c index 9feda19b05..9b57b559ae 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 9251547489..8252df9aba 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 d6e7ab0bbb..aa6845ac49 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 7e088fcefe..7e1e754574 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);