From a208a80c2989dd4c5c81d4c1603c0ad52a9f430c Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Mon, 30 Jun 2014 11:06:29 +0200 Subject: [PATCH] decoder: h264: slightly optimize the process to detect new pictures. Optimize the process to detect new pictures or start of new access units by checking if the previous NAL unit was the end of a picture, or the end of the previous access unit. --- gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c index 2dbe8f15bd..a51595b7b0 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c @@ -4040,7 +4040,12 @@ gst_vaapi_decoder_h264_parse(GstVaapiDecoder *base_decoder, case GST_H264_NAL_SLICE_IDR: case GST_H264_NAL_SLICE: flags |= GST_VAAPI_DECODER_UNIT_FLAG_SLICE; - if (is_new_picture(pi, priv->prev_slice_pi)) { + if (priv->prev_pi && + (priv->prev_pi->flags & GST_VAAPI_DECODER_UNIT_FLAG_AU_END)) { + flags |= GST_VAAPI_DECODER_UNIT_FLAG_AU_START | + GST_VAAPI_DECODER_UNIT_FLAG_FRAME_START; + } + else if (is_new_picture(pi, priv->prev_slice_pi)) { flags |= GST_VAAPI_DECODER_UNIT_FLAG_FRAME_START; if (is_new_access_unit(pi, priv->prev_slice_pi)) flags |= GST_VAAPI_DECODER_UNIT_FLAG_AU_START;