gst-plugins-bad: codecparsers: h264: handle end-of-seq and end-of-stream NAL gracefully.
Edward Hervey
bilboed at kemper.freedesktop.org
Fri Sep 2 06:46:31 PDT 2011
Module: gst-plugins-bad
Branch: master
Commit: d37f842aaa2c7535cdcb8edb6d033e987f82ff90
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=d37f842aaa2c7535cdcb8edb6d033e987f82ff90
Author: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
Date: Fri Aug 26 15:54:51 2011 +0200
codecparsers: h264: handle end-of-seq and end-of-stream NAL gracefully.
---
gst-libs/gst/codecparsers/gsth264parser.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c
index 8e4e212..a4c09c0 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.c
+++ b/gst-libs/gst/codecparsers/gsth264parser.c
@@ -1124,8 +1124,8 @@ gst_h264_parser_identify_nalu (GstH264NalParser * nalparser,
{
gint off1, off2;
- if (size - 4 <= offset) {
- GST_DEBUG ("Can't parse, buffer is to small size %u, offset %u", size,
+ if (size - offset < 4) {
+ GST_DEBUG ("Can't parse, buffer has too small size %u, offset %u", size,
offset);
return GST_H264_PARSER_ERROR;
}
@@ -1153,6 +1153,13 @@ gst_h264_parser_identify_nalu (GstH264NalParser * nalparser,
nalu->data = (guint8 *) data;
set_nalu_datas (nalu);
+ if (nalu->type == GST_H264_NAL_SEQ_END ||
+ nalu->type == GST_H264_NAL_STREAM_END) {
+ GST_DEBUG ("end-of-seq or end-of-stream nal found");
+ nalu->size = 0;
+ return GST_H264_PARSER_OK;
+ }
+
off2 = scan_for_start_codes (data + nalu->offset, size - nalu->offset);
if (off2 < 0) {
GST_DEBUG ("Nal start %d, No end found", nalu->offset);
More information about the gstreamer-commits
mailing list