[gst-cvs] gst-plugins-ugly: asfdemux: Refactor multiple packet pull.
Edward Hervey
bilboed at kemper.freedesktop.org
Mon Jun 29 02:17:23 PDT 2009
Module: gst-plugins-ugly
Branch: master
Commit: 6f58ca470ea730de0d10f4702949114f464cfb38
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=6f58ca470ea730de0d10f4702949114f464cfb38
Author: Edward Hervey <bilboed at bilboed.com>
Date: Mon Jun 29 11:10:42 2009 +0200
asfdemux: Refactor multiple packet pull.
This also fixes a bug by which the first buffer (in a multi-packet mode)
passed to asf_demux_parse_packet() would have a GST_BUFFER_SIZE of the
full incoming buffer and not just of the single asf packet.
Fixes corrupted frames introduced by latest commit.
---
gst/asfdemux/gstasfdemux.c | 38 ++++++++++++++++++++++++--------------
1 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c
index 6dac784..78d5db8 100644
--- a/gst/asfdemux/gstasfdemux.c
+++ b/gst/asfdemux/gstasfdemux.c
@@ -1357,7 +1357,6 @@ gst_asf_demux_loop (GstASFDemux * demux)
GstFlowReturn flow = GST_FLOW_OK;
GstBuffer *buf = NULL;
guint64 off;
- guint n;
if (G_UNLIKELY (demux->state == GST_ASF_DEMUX_STATE_HEADER)) {
if (!gst_asf_demux_pull_headers (demux)) {
@@ -1391,29 +1390,40 @@ gst_asf_demux_loop (GstASFDemux * demux)
goto read_failed;
}
- for (n = 0; n < demux->speed_packets; n++) {
- GstBuffer *tmp = NULL, *sub = buf;
-
- if (G_UNLIKELY (n != 0))
- tmp = sub =
- gst_buffer_create_sub (buf, n * demux->packet_size,
- demux->packet_size);
+ if (G_LIKELY (demux->speed_packets == 1)) {
/* FIXME: maybe we should just skip broken packets and error out only
* after a few broken packets in a row? */
- if (G_UNLIKELY (!gst_asf_demux_parse_packet (demux, sub)))
+ if (G_UNLIKELY (!gst_asf_demux_parse_packet (demux, buf)))
goto parse_error;
- if (G_UNLIKELY (n != 0))
- gst_buffer_unref (tmp);
flow = gst_asf_demux_push_complete_payloads (demux, FALSE);
++demux->packet;
- }
+ } else {
+ guint n;
+ for (n = 0; n < demux->speed_packets; n++) {
+ GstBuffer *sub;
- /* reset speed pull */
- if (G_UNLIKELY (demux->speed_packets != 1))
+ sub =
+ gst_buffer_create_sub (buf, n * demux->packet_size,
+ demux->packet_size);
+ /* FIXME: maybe we should just skip broken packets and error out only
+ * after a few broken packets in a row? */
+ if (G_UNLIKELY (!gst_asf_demux_parse_packet (demux, sub)))
+ goto parse_error;
+
+ gst_buffer_unref (sub);
+
+ flow = gst_asf_demux_push_complete_payloads (demux, FALSE);
+
+ ++demux->packet;
+
+ }
+
+ /* reset speed pull */
demux->speed_packets = 1;
+ }
gst_buffer_unref (buf);
More information about the Gstreamer-commits
mailing list