mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 19:55:32 +00:00
oggdemux: Don't strip all 0-bytes from the end of OGM packets
This fixes broken packets pushed downstream by oggdemux for MPEG4 streams for example.
This commit is contained in:
parent
592bc87dc9
commit
b38dcf5277
1 changed files with 3 additions and 12 deletions
|
@ -481,7 +481,6 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet)
|
||||||
GstOggChain *chain;
|
GstOggChain *chain;
|
||||||
gint64 duration;
|
gint64 duration;
|
||||||
gint offset;
|
gint offset;
|
||||||
gint trim;
|
|
||||||
GstClockTime out_timestamp, out_duration;
|
GstClockTime out_timestamp, out_duration;
|
||||||
guint64 out_offset, out_offset_end;
|
guint64 out_offset, out_offset_end;
|
||||||
|
|
||||||
|
@ -531,15 +530,8 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = 1 + (((data[0] & 0xc0) >> 6) | ((data[0] & 0x02) << 1));
|
offset = 1 + (((data[0] & 0xc0) >> 6) | ((data[0] & 0x02) << 1));
|
||||||
|
|
||||||
trim = 0;
|
|
||||||
while (bytes && data[bytes - 1] == 0) {
|
|
||||||
trim++;
|
|
||||||
bytes--;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
trim = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get timing info for the packet */
|
/* get timing info for the packet */
|
||||||
|
@ -600,13 +592,12 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for invalid buffer sizes */
|
/* check for invalid buffer sizes */
|
||||||
if (G_UNLIKELY (offset + trim >= packet->bytes))
|
if (G_UNLIKELY (offset >= packet->bytes))
|
||||||
goto empty_packet;
|
goto empty_packet;
|
||||||
|
|
||||||
ret =
|
ret =
|
||||||
gst_pad_alloc_buffer_and_set_caps (GST_PAD_CAST (pad),
|
gst_pad_alloc_buffer_and_set_caps (GST_PAD_CAST (pad),
|
||||||
GST_BUFFER_OFFSET_NONE, packet->bytes - offset - trim,
|
GST_BUFFER_OFFSET_NONE, packet->bytes - offset, GST_PAD_CAPS (pad), &buf);
|
||||||
GST_PAD_CAPS (pad), &buf);
|
|
||||||
|
|
||||||
/* combine flows */
|
/* combine flows */
|
||||||
cret = gst_ogg_demux_combine_flows (ogg, pad, ret);
|
cret = gst_ogg_demux_combine_flows (ogg, pad, ret);
|
||||||
|
@ -614,7 +605,7 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet)
|
||||||
goto no_buffer;
|
goto no_buffer;
|
||||||
|
|
||||||
/* copy packet in buffer */
|
/* copy packet in buffer */
|
||||||
memcpy (buf->data, packet->packet + offset, packet->bytes - offset - trim);
|
memcpy (buf->data, packet->packet + offset, packet->bytes - offset);
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (buf) = out_timestamp;
|
GST_BUFFER_TIMESTAMP (buf) = out_timestamp;
|
||||||
GST_BUFFER_DURATION (buf) = out_duration;
|
GST_BUFFER_DURATION (buf) = out_duration;
|
||||||
|
|
Loading…
Reference in a new issue