summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-10-09 09:48:46 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-10-09 09:48:46 +0000
commit9f3b48a4957a54ed4e501feb5f14298b0e205947 (patch)
tree3e860d8180ba90bf582bbbf2b2c79fcfc1b1cb18 /gst
parent0b42844a3c1c86513458eea3df625a739b128c42 (diff)
downloadgst-plugins-bad-9f3b48a4957a54ed4e501feb5f14298b0e205947.tar.gz
gst-plugins-bad-9f3b48a4957a54ed4e501feb5f14298b0e205947.tar.bz2
gst-plugins-bad-9f3b48a4957a54ed4e501feb5f14298b0e205947.zip
gst/flv/gstflvdemux.c: Go out of the parse loop as soon as we get an error instead of parsing until the GstAdapter is...
Original commit message from CVS: * gst/flv/gstflvdemux.c: (gst_flv_demux_chain): Go out of the parse loop as soon as we get an error instead of parsing until the GstAdapter is empty. Add some explanations about the header and tag size. Don't print synchronizing message if everything is fine.
Diffstat (limited to 'gst')
-rw-r--r--gst/flv/gstflvdemux.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c
index 896d8bf1..e8b229ea 100644
--- a/gst/flv/gstflvdemux.c
+++ b/gst/flv/gstflvdemux.c
@@ -57,7 +57,9 @@ GST_DEBUG_CATEGORY (flvdemux_debug);
GST_BOILERPLATE (GstFLVDemux, gst_flv_demux, GstElement, GST_TYPE_ELEMENT);
+/* 9 bytes of header + 4 bytes of first previous tag size */
#define FLV_HEADER_SIZE 13
+/* 1 byte of tag type + 3 bytes of tag data size */
#define FLV_TAG_TYPE_SIZE 4
static void
@@ -177,7 +179,7 @@ gst_flv_demux_chain (GstPad * pad, GstBuffer * buffer)
demux->offset = 0;
}
- if (G_UNLIKELY (demux->offset == 0)) {
+ if (G_UNLIKELY (demux->offset == 0 && GST_BUFFER_OFFSET (buffer) != 0)) {
GST_DEBUG_OBJECT (demux, "offset was zero, synchronizing with buffer's");
demux->offset = GST_BUFFER_OFFSET (buffer);
}
@@ -185,11 +187,17 @@ gst_flv_demux_chain (GstPad * pad, GstBuffer * buffer)
gst_adapter_push (demux->adapter, buffer);
parse:
+ if (G_UNLIKELY (ret != GST_FLOW_OK)) {
+ GST_DEBUG_OBJECT (demux, "got flow return %s", gst_flow_get_name (ret));
+ goto beach;
+ }
+
if (G_UNLIKELY (demux->flushing)) {
GST_DEBUG_OBJECT (demux, "we are now flushing, exiting parser loop");
ret = GST_FLOW_WRONG_STATE;
goto beach;
}
+
switch (demux->state) {
case FLV_STATE_HEADER:
{