[gst-cvs] gst-plugins-bad: baseparse: post duration message if average bitrates is updated

Mark Nauwelaerts mnauw at kemper.freedesktop.org
Fri Oct 1 03:53:46 PDT 2010


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

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Fri Sep 17 18:33:29 2010 +0200

baseparse: post duration message if average bitrates is updated

---

 gst/audioparsers/gstbaseparse.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/gst/audioparsers/gstbaseparse.c b/gst/audioparsers/gstbaseparse.c
index ea89b25..3e989f9 100644
--- a/gst/audioparsers/gstbaseparse.c
+++ b/gst/audioparsers/gstbaseparse.c
@@ -974,6 +974,14 @@ gst_base_parse_update_bitrates (GstBaseParse * parse, GstBuffer * buffer)
   if (parse->priv->framecount >= MIN_FRAMES_TO_POST_BITRATE &&
       (update_min || update_avg || update_max))
     gst_base_parse_post_bitrates (parse, update_min, update_avg, update_max);
+
+  /* If average bitrate changes that much and no valid (time) duration provided,
+   * then post a new duration message so applications can update their cached
+   * values */
+  if (update_avg && !(parse->priv->duration_fmt == GST_FORMAT_TIME &&
+          GST_CLOCK_TIME_IS_VALID (parse->priv->duration)))
+    gst_element_post_message (GST_ELEMENT (parse),
+        gst_message_new_duration (GST_OBJECT (parse), GST_FORMAT_TIME, -1));
 }
 
 /**





More information about the Gstreamer-commits mailing list