summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.com>2019-06-14 16:27:37 +0530
committerGuillaume Desmottes <guillaume.desmottes@collabora.com>2019-06-17 09:17:14 +0530
commit50d50f47fbb849a3ee7caf69c89218ccff140a04 (patch)
treedec5a6f8ac2101395b4f419d0b6959b6610b8e0f
parentcfeeb15b1e3fbe473212cc2747b9cd3dd10fbe2e (diff)
downloadgst-omx-50d50f47fbb849a3ee7caf69c89218ccff140a04.tar.gz
omxvideo: check difference between frame and requested ts
This has proven to be very useful when debugging to detect bugs where we match the wrong gst frame with an output OMX buffer.
-rw-r--r--omx/gstomxvideo.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/omx/gstomxvideo.c b/omx/gstomxvideo.c
index 9b57b55..627d708 100644
--- a/omx/gstomxvideo.c
+++ b/omx/gstomxvideo.c
@@ -213,9 +213,20 @@ gst_omx_video_find_nearest_frame (GstElement * element, GstOMXBuffer * buf,
}
}
- if (best)
+ if (best) {
gst_video_codec_frame_ref (best);
+ /* OMX timestamps are in microseconds while gst ones are in nanoseconds.
+ * So if the difference between them is higher than 1 microsecond we likely
+ * picked the wrong frame. */
+ if (best_diff >= GST_USECOND)
+ GST_WARNING_OBJECT (element,
+ "Difference between ts (%" GST_TIME_FORMAT ") and frame %u (%"
+ GST_TIME_FORMAT ") seems too high (%" GST_TIME_FORMAT ")",
+ GST_TIME_ARGS (timestamp), best->system_frame_number,
+ GST_TIME_ARGS (best->pts), GST_TIME_ARGS (best_diff));
+ }
+
g_list_foreach (frames, (GFunc) gst_video_codec_frame_unref, NULL);
g_list_free (frames);