diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2014-06-26 09:44:26 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2014-07-01 16:26:48 +0200 |
commit | 7d44a51bfe6f54061956be9d31590fa11319a8ef (patch) | |
tree | 15cd6fe640a6d1b355f342c4d1f1e7e1339e4ef4 | |
parent | 34c2cfd4ddcc370a273d5c86d403e421a94d0157 (diff) |
h264parse: fix collection of access units to preserve config headers.
Always use a GstAdapter when collecting access units (alignment="au")
in either byte-stream or avcC format. This is required to properly
preserve config headers like SPS and PPS when invalid or broken NAL
units are subsequently parsed.
More precisely, this fixes scenario like:
<SPS> <PPS> <invalid-NAL> <slice>
where we used to reset the output frame buffer when an invalid or
broken NAL is parsed, i.e. SPS and PPS NAL units were lost, thus
preventing the next slice unit to be decoded, should this also
represent any valid data.
https://bugzilla.gnome.org/show_bug.cgi?id=732203
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
-rw-r--r-- | gst/videoparsers/gsth264parse.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index fe845a10f..697ff87a0 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -388,7 +388,8 @@ gst_h264_parse_negotiate (GstH264Parse * h264parse, gint in_format, h264parse->format = format; h264parse->align = align; - h264parse->transform = (in_format != h264parse->format); + h264parse->transform = in_format != h264parse->format || + align == GST_H264_PARSE_ALIGN_AU; } static GstBuffer * @@ -1060,7 +1061,13 @@ out: skip: GST_DEBUG_OBJECT (h264parse, "skipping %d", *skipsize); - gst_h264_parse_reset_frame (h264parse); + /* If we are collecting access units, we need to preserve the initial + * config headers (SPS, PPS et al.) and only reset the frame if another + * slice NAL was received. This means that broken pictures are discarded */ + if (h264parse->align != GST_H264_PARSE_ALIGN_AU || + !(h264parse->state & GST_H264_PARSE_STATE_VALID_PICTURE_HEADERS) || + (h264parse->state & GST_H264_PARSE_STATE_GOT_SLICE)) + gst_h264_parse_reset_frame (h264parse); goto out; invalid_stream: |