From 387371b19fe1d7d19cfda68a8a5f6d8e619c20a9 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 22 Jan 2014 18:11:26 +0100 Subject: [PATCH] decoder: fix video codec frame number in standalone mode. Set a valid GstVideoCodecFrame.system_frame_number when decoding a stream in standalone mode. While we are at it, improve the debugging messages to also include that frame number. --- gst-libs/gst/vaapi/gstvaapidecoder.c | 9 +++++---- gst-libs/gst/vaapi/gstvaapidecoder_priv.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c index 8b05f7b..ac23127 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder.c @@ -315,6 +315,7 @@ decode_step(GstVaapiDecoder *decoder) if (!ps->current_frame) return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED; ps->current_frame->ref_count = 1; + ps->current_frame->system_frame_number = ps->current_frame_number++; } status = do_parse(decoder, ps->current_frame, ps->input_adapter, @@ -373,8 +374,8 @@ push_frame(GstVaapiDecoder *decoder, GstVideoCodecFrame *frame) { GstVaapiSurfaceProxy * const proxy = frame->user_data; - GST_DEBUG("queue decoded surface %" GST_VAAPI_ID_FORMAT, - GST_VAAPI_ID_ARGS(GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy))); + GST_DEBUG("push frame %d (surface 0x%08x)", frame->system_frame_number, + GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy)); g_async_queue_push(decoder->frames, gst_video_codec_frame_ref(frame)); } @@ -393,8 +394,8 @@ pop_frame(GstVaapiDecoder *decoder, guint64 timeout) return NULL; proxy = frame->user_data; - GST_DEBUG("dequeue decoded surface %" GST_VAAPI_ID_FORMAT, - GST_VAAPI_ID_ARGS(gst_vaapi_surface_proxy_get_surface_id(proxy))); + GST_DEBUG("pop frame %d (surface 0x%08x)", frame->system_frame_number, + proxy ? GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy) : VA_INVALID_ID); return frame; } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_priv.h b/gst-libs/gst/vaapi/gstvaapidecoder_priv.h index 6a689fc..e9b3fd3 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_priv.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_priv.h @@ -168,6 +168,7 @@ typedef enum { typedef struct _GstVaapiParserState GstVaapiParserState; struct _GstVaapiParserState { GstVideoCodecFrame *current_frame; + guint32 current_frame_number; GstAdapter *current_adapter; GstAdapter *input_adapter; gint input_offset1; -- 2.7.4