[0.11] gst-plugins-ugly: asfpacket: fix 0.11 ported payload extraction

Mark Nauwelaerts mnauw at kemper.freedesktop.org
Fri Jan 13 07:02:00 PST 2012


Module: gst-plugins-ugly
Branch: 0.11
Commit: 0bc76c0d038a2bac17d93caae0bfd00d8ca5bbc0
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=0bc76c0d038a2bac17d93caae0bfd00d8ca5bbc0

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Fri Jan 13 15:55:15 2012 +0100

asfpacket: fix 0.11 ported payload extraction

... to cater for not necessarily offset == size - cur_pos,
as size may have been adjusted due to padding.

Fixes #667567.

---

 gst/asfdemux/asfpacket.c |    5 ++++-
 gst/asfdemux/asfpacket.h |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gst/asfdemux/asfpacket.c b/gst/asfdemux/asfpacket.c
index 0baaceb..072a40e 100644
--- a/gst/asfdemux/asfpacket.c
+++ b/gst/asfdemux/asfpacket.c
@@ -77,7 +77,8 @@ asf_packet_create_payload_buffer (AsfPacket * packet, const guint8 ** p_data,
 
   g_assert (payload_len <= *p_size);
 
-  off = (guint) (gst_buffer_get_size (packet->buf) - *p_size);
+  off = (guint) (*p_data - packet->bdata);
+  g_assert (off < gst_buffer_get_size (packet->buf));
 
   *p_data += payload_len;
   *p_size -= payload_len;
@@ -484,6 +485,8 @@ gst_asf_demux_parse_packet (GstASFDemux * demux, GstBuffer * buf)
     goto short_packet;
 
   packet.buf = buf;
+  /* evidently transient */
+  packet.bdata = data;
 
   ec_flags = GST_READ_UINT8 (data);
 
diff --git a/gst/asfdemux/asfpacket.h b/gst/asfdemux/asfpacket.h
index cc1622d..dd8bd86 100644
--- a/gst/asfdemux/asfpacket.h
+++ b/gst/asfdemux/asfpacket.h
@@ -46,6 +46,7 @@ typedef struct {
 
 typedef struct {
   GstBuffer    *buf;
+  const guint8 *bdata;
   guint         length;            /* packet length (unused)               */
   guint         padding;           /* length of padding at end of packet   */
   guint         sequence;          /* sequence (unused)                    */



More information about the gstreamer-commits mailing list