From c2784b4ca88a46e8e453566d62dec01370c320c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 1 May 2007 11:10:31 +0000 Subject: [PATCH] gst/asfdemux/asfpacket.c: If packet size is specified within the packet and smaller than the actual packet size, don'... Original commit message from CVS: * gst/asfdemux/asfpacket.c: (gst_asf_demux_parse_payload), (gst_asf_demux_parse_packet): If packet size is specified within the packet and smaller than the actual packet size, don't parse beyond the size specified in the packet (this makes us parse some cases of packets with single compressed payloads cleanly, see e.g stream from #431318). Also add a sanity check when parsing compressed single payloads. --- ChangeLog | 10 ++++++++++ gst/asfdemux/asfpacket.c | 19 ++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d178aa..e089922 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2007-05-01 Tim-Philipp Müller + * gst/asfdemux/asfpacket.c: (gst_asf_demux_parse_payload), + (gst_asf_demux_parse_packet): + If packet size is specified within the packet and smaller than + the actual packet size, don't parse beyond the size specified in + the packet (this makes us parse some cases of packets with single + compressed payloads cleanly, see e.g stream from #431318). Also + add a sanity check when parsing compressed single payloads. + +2007-05-01 Tim-Philipp Müller + * gst/asfdemux/asfpacket.c: (gst_asf_payload_queue_for_stream): * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_seek_index_lookup), (gst_asf_demux_handle_seek_event), diff --git a/gst/asfdemux/asfpacket.c b/gst/asfdemux/asfpacket.c index fe0455a..8b01b0b 100644 --- a/gst/asfdemux/asfpacket.c +++ b/gst/asfdemux/asfpacket.c @@ -357,13 +357,15 @@ gst_asf_demux_parse_payload (GstASFDemux * demux, AsfPacket * packet, return FALSE; } - payload.buf = asf_packet_create_payload_buffer (packet, - &payload_data, &payload_len, sub_payload_len); + if (sub_payload_len > 0) { + payload.buf = asf_packet_create_payload_buffer (packet, + &payload_data, &payload_len, sub_payload_len); - payload.ts = ts; - payload.duration = ts_delta; + payload.ts = ts; + payload.duration = ts_delta; - gst_asf_payload_queue_for_stream (demux, &payload, stream); + gst_asf_payload_queue_for_stream (demux, &payload, stream); + } ts += ts_delta; } @@ -453,6 +455,13 @@ gst_asf_demux_parse_packet (GstASFDemux * demux, GstBuffer * buf) size -= packet.padding; + /* adjust available size for parsing if there's less actual packet data for + * parsing than there is data in bytes (for sample see bug 431318) */ + if (packet.length != 0 && packet.length < demux->packet_size) { + GST_LOG_OBJECT (demux, "shortened packet, adjusting available data size"); + size -= (demux->packet_size - packet.length); + } + if (has_multiple_payloads) { guint i, num, lentype; -- 2.7.4