diff options
author | Jan Schmidt <thaytan@mad.scientist.com> | 2007-06-06 11:03:24 +0000 |
---|---|---|
committer | Jan Schmidt <thaytan@mad.scientist.com> | 2007-06-06 11:03:24 +0000 |
commit | ceba19f69179da93e71fc1e582f1d7eb2bd4db16 (patch) | |
tree | 850a57d0a0c15d8a0dd00b00900e98737426acee /gst/mpegvideoparse/mpegvideoparse.c | |
parent | ff14de08d284e85b5d1c358f27787127431ab82b (diff) | |
download | gst-plugins-bad-ceba19f69179da93e71fc1e582f1d7eb2bd4db16.tar.gz gst-plugins-bad-ceba19f69179da93e71fc1e582f1d7eb2bd4db16.tar.bz2 gst-plugins-bad-ceba19f69179da93e71fc1e582f1d7eb2bd4db16.zip |
gst/mpegvideoparse/: Fix some silly bugs with calculating the guard sizes.
Original commit message from CVS:
* gst/mpegvideoparse/mpegpacketiser.c:
(mpeg_util_parse_extension_packet), (mpeg_util_parse_sequence_hdr),
(mpeg_util_parse_picture_hdr):
* gst/mpegvideoparse/mpegvideoparse.c:
(mpegvideoparse_handle_sequence), (mpegvideoparse_drain_avail):
Fix some silly bugs with calculating the guard sizes.
Properly compare the old sequence header structure with the new one.
Don't error out on an invalid sequence - just ignore it.
Diffstat (limited to 'gst/mpegvideoparse/mpegvideoparse.c')
-rw-r--r-- | gst/mpegvideoparse/mpegvideoparse.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gst/mpegvideoparse/mpegvideoparse.c b/gst/mpegvideoparse/mpegvideoparse.c index 6c776c54..cd5fd699 100644 --- a/gst/mpegvideoparse/mpegvideoparse.c +++ b/gst/mpegvideoparse/mpegvideoparse.c @@ -206,7 +206,7 @@ mpegvideoparse_handle_sequence (MpegVideoParse * mpegvideoparse, if (G_UNLIKELY (!mpeg_util_parse_sequence_hdr (&new_hdr, cur, end))) return FALSE; - if (memcmp (&mpegvideoparse, &new_hdr, sizeof (MPEGSeqHdr)) != 0) { + if (memcmp (&mpegvideoparse->seq_hdr, &new_hdr, sizeof (MPEGSeqHdr)) != 0) { GstCaps *caps; GstBuffer *seq_buf; @@ -216,9 +216,6 @@ mpegvideoparse_handle_sequence (MpegVideoParse * mpegvideoparse, gst_buffer_replace (&mpegvideoparse->seq_hdr_buf, seq_buf); gst_buffer_unref (seq_buf); - /* And update the new_hdr into our stored version */ - mpegvideoparse->seq_hdr = new_hdr; - caps = gst_caps_new_simple ("video/mpeg", "systemstream", G_TYPE_BOOLEAN, FALSE, "parsed", G_TYPE_BOOLEAN, TRUE, @@ -232,6 +229,9 @@ mpegvideoparse_handle_sequence (MpegVideoParse * mpegvideoparse, GST_DEBUG ("New mpegvideoparse caps: %" GST_PTR_FORMAT, caps); if (!gst_pad_set_caps (mpegvideoparse->srcpad, caps)) return FALSE; + + /* And update the new_hdr into our stored version */ + mpegvideoparse->seq_hdr = new_hdr; } return TRUE; @@ -312,8 +312,12 @@ mpegvideoparse_drain_avail (MpegVideoParse * mpegvideoparse) if (mpegvideoparse->seq_hdr.mpeg_version == 0) { if (cur->flags & MPEG_BLOCK_FLAG_SEQUENCE) { /* Found a sequence header */ - if (!mpegvideoparse_handle_sequence (mpegvideoparse, buf)) - goto error; + if (!mpegvideoparse_handle_sequence (mpegvideoparse, buf)) { + GST_DEBUG_OBJECT (mpegvideoparse, + "Invalid sequence header. Dropping buffer."); + gst_buffer_unref (buf); + buf = NULL; + } } else { if (buf) { GST_DEBUG_OBJECT (mpegvideoparse, @@ -364,10 +368,6 @@ mpegvideoparse_drain_avail (MpegVideoParse * mpegvideoparse) }; return res; -error: - if (buf != NULL) - gst_buffer_unref (buf); - return GST_FLOW_ERROR; } static GstFlowReturn |