summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-14 18:40:47 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-16 16:50:31 +0100
commit6188ab4e4d7afc66a11f104e071926a240c34361 (patch)
tree09839792615faacc475a333f756db19a872b9368
parent79d253c01cc2d92b529ffd4824545ebaf1c3cb2e (diff)
h264: start decoding slices after first SPS/PPS activation.
Only start decoding slices when at least one SPS and PPS got activated. This fixes cases when a source represents a substream of another stream and no SPS and PPS was inserted before the first slice of the generated substream.
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_h264.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
index 8e88220c..dbe8eb44 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
@@ -547,6 +547,8 @@ struct _GstVaapiDecoderH264Private {
guint is_constructed : 1;
guint is_opened : 1;
guint is_avc : 1;
+ guint got_sps : 1;
+ guint got_pps : 1;
guint has_context : 1;
guint progressive_sequence : 1;
};
@@ -1168,6 +1170,7 @@ decode_sps(GstVaapiDecoderH264 *decoder, GstH264NalUnit *nalu)
if (result != GST_H264_PARSER_OK)
return get_status(result);
+ priv->got_sps = TRUE;
return GST_VAAPI_DECODER_STATUS_SUCCESS;
}
@@ -1185,6 +1188,7 @@ decode_pps(GstVaapiDecoderH264 *decoder, GstH264NalUnit *nalu)
if (result != GST_H264_PARSER_OK)
return get_status(result);
+ priv->got_pps = TRUE;
return GST_VAAPI_DECODER_STATUS_SUCCESS;
}
@@ -2910,12 +2914,15 @@ scan_for_start_code(GstAdapter *adapter, guint ofs, guint size, guint32 *scp)
static GstVaapiDecoderStatus
decode_nalu(GstVaapiDecoderH264 *decoder, GstH264NalUnit *nalu)
{
+ GstVaapiDecoderH264Private * const priv = decoder->priv;
GstVaapiDecoderStatus status;
switch (nalu->type) {
case GST_H264_NAL_SLICE_IDR:
/* fall-through. IDR specifics are handled in init_picture() */
case GST_H264_NAL_SLICE:
+ if (!priv->got_sps || !priv->got_pps)
+ return GST_VAAPI_DECODER_STATUS_SUCCESS;
status = decode_slice(decoder, nalu);
break;
case GST_H264_NAL_SPS: