[0.11] gst-plugins-base: audiorate: Use the number of samples for the in and out properties as documented

Sebastian Dröge slomo at kemper.freedesktop.org
Fri Jan 27 09:16:29 PST 2012


Module: gst-plugins-base
Branch: 0.11
Commit: 91f8f414cdd54acae791b8e84624b8cebc67caf8
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=91f8f414cdd54acae791b8e84624b8cebc67caf8

Author: Jason DeRose <jderose at novacut.com>
Date:   Fri Jan 27 17:55:34 2012 +0100

audiorate: Use the number of samples for the in and out properties as documented

---

 gst/audiorate/gstaudiorate.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gst/audiorate/gstaudiorate.c b/gst/audiorate/gstaudiorate.c
index 9907633..e37ebc6 100644
--- a/gst/audiorate/gstaudiorate.c
+++ b/gst/audiorate/gstaudiorate.c
@@ -467,8 +467,6 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
     }
   }
 
-  audiorate->in++;
-
   in_time = GST_BUFFER_TIMESTAMP (buf);
   if (in_time == GST_CLOCK_TIME_NONE) {
     GST_DEBUG_OBJECT (audiorate, "no timestamp, using expected next time");
@@ -477,6 +475,7 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
 
   in_size = gst_buffer_get_size (buf);
   in_samples = in_size / bpf;
+  audiorate->in += in_samples;
 
   /* calculate the buffer offset */
   in_offset = gst_util_uint64_scale_int_round (in_time, rate, GST_SECOND);
@@ -502,6 +501,7 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
     /* The outgoing buffer's offset will be set to ->next_offset, we also
      * need to adjust the offset_end value accordingly */
     in_offset_end = audiorate->next_offset + in_samples;
+    audiorate->out += in_samples;
     goto send;
   }
 
@@ -555,7 +555,7 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
       ret = gst_pad_push (audiorate->srcpad, fill);
       if (ret != GST_FLOW_OK)
         goto beach;
-      audiorate->out++;
+      audiorate->out += cursamples;
       audiorate->add += cursamples;
 
       if (!audiorate->silent)
@@ -598,6 +598,7 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
       buf = trunc;
 
       audiorate->drop += truncsamples;
+      audiorate->out += (leftsize / bpf);
       GST_DEBUG_OBJECT (audiorate, "truncating %" G_GUINT64_FORMAT " samples",
           truncsamples);
 
@@ -640,7 +641,6 @@ send:
 
   ret = gst_pad_push (audiorate->srcpad, buf);
   buf = NULL;
-  audiorate->out++;
 
   audiorate->next_offset = in_offset_end;
 beach:



More information about the gstreamer-commits mailing list