[gst-cvs] gst-plugins-bad: baseparse: revert last change and properly fix

Stefan Kost ensonic at kemper.freedesktop.org
Fri Feb 27 02:44:02 PST 2009


Module: gst-plugins-bad
Branch: master
Commit: 5f2d5aa5a547427e5f564ab4b309cfc8f26fba18
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=5f2d5aa5a547427e5f564ab4b309cfc8f26fba18

Author: Stefan Kost <ensonic at users.sf.net>
Date:   Fri Feb 27 11:24:37 2009 +0200

baseparse: revert last change and properly fix

Baseparse internaly breaks the semantics of a _chain function by calling it with
buffer==NULL. The reson I belived it was okay to remove it was that there is
also an unchecked access to buffer later in _chain. Actually that code is wrong,
as it most probably wants to set discont on the outgoing buffer.

---

 gst/aacparse/gstbaseparse.c  |   10 ++++++----
 gst/amrparse/gstbaseparse.c  |   10 ++++++----
 gst/flacparse/gstbaseparse.c |   10 ++++++----
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/gst/aacparse/gstbaseparse.c b/gst/aacparse/gstbaseparse.c
index 5f9a949..6d0e7f8 100644
--- a/gst/aacparse/gstbaseparse.c
+++ b/gst/aacparse/gstbaseparse.c
@@ -864,9 +864,11 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer)
     parse->priv->pending_events = NULL;
   }
 
-  GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld",
-      GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer));
-  gst_adapter_push (parse->adapter, buffer);
+  if (G_LIKELY (buffer)) {
+    GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld",
+        GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer));
+    gst_adapter_push (parse->adapter, buffer);
+  }
 
   /* Parse and push as many frames as possible */
   /* Stop either when adapter is empty or we are flushing */
@@ -895,7 +897,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer)
 
       if (parse->priv->discont) {
         GST_DEBUG_OBJECT (parse, "marking DISCONT");
-        GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
+        GST_BUFFER_FLAG_SET (tmpbuf, GST_BUFFER_FLAG_DISCONT);
       }
 
       skip = -1;
diff --git a/gst/amrparse/gstbaseparse.c b/gst/amrparse/gstbaseparse.c
index 4d7b03a..673f716 100644
--- a/gst/amrparse/gstbaseparse.c
+++ b/gst/amrparse/gstbaseparse.c
@@ -864,9 +864,11 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer)
     parse->priv->pending_events = NULL;
   }
 
-  GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld",
-      GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer));
-  gst_adapter_push (parse->adapter, buffer);
+  if (G_LIKELY (buffer)) {
+    GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld",
+        GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer));
+    gst_adapter_push (parse->adapter, buffer);
+  }
 
   /* Parse and push as many frames as possible */
   /* Stop either when adapter is empty or we are flushing */
@@ -895,7 +897,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer)
 
       if (parse->priv->discont) {
         GST_DEBUG_OBJECT (parse, "marking DISCONT");
-        GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
+        GST_BUFFER_FLAG_SET (tmpbuf, GST_BUFFER_FLAG_DISCONT);
       }
 
       skip = -1;
diff --git a/gst/flacparse/gstbaseparse.c b/gst/flacparse/gstbaseparse.c
index 5f35d91..ea06474 100644
--- a/gst/flacparse/gstbaseparse.c
+++ b/gst/flacparse/gstbaseparse.c
@@ -989,9 +989,11 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer)
 
   gst_base_parse_update_upstream_durations (parse);
 
-  GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld",
-      GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer));
-  gst_adapter_push (parse->priv->adapter, buffer);
+  if (G_LIKELY (buffer)) {
+    GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld",
+        GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer));
+    gst_adapter_push (parse->priv->adapter, buffer);
+  }
 
   /* Parse and push as many frames as possible */
   /* Stop either when adapter is empty or we are flushing */
@@ -1021,7 +1023,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer)
 
       if (parse->priv->discont) {
         GST_DEBUG_OBJECT (parse, "marking DISCONT");
-        GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
+        GST_BUFFER_FLAG_SET (tmpbuf, GST_BUFFER_FLAG_DISCONT);
       }
 
       skip = -1;





More information about the Gstreamer-commits mailing list