From 3f683e02887f39675c814c1e418dd4e3beb9bc1d Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Tue, 8 Feb 2011 23:39:24 +0530 Subject: [PATCH] baseparse: Update min/max bitrate before first posting them This avoids posting an initial min-bitrate of G_UINTMAX and max-bitrate of 0. https://bugzilla.gnome.org/show_bug.cgi?id=641857 --- gst/audioparsers/gstbaseparse.c | 4 +++- gst/videoparsers/gstbaseparse.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gst/audioparsers/gstbaseparse.c b/gst/audioparsers/gstbaseparse.c index 5be6363384..75c945c2ee 100644 --- a/gst/audioparsers/gstbaseparse.c +++ b/gst/audioparsers/gstbaseparse.c @@ -1227,7 +1227,9 @@ gst_base_parse_update_bitrates (GstBaseParse * parse, GstBaseParseFrame * frame) } else if (parse->priv->framecount == MIN_FRAMES_TO_POST_BITRATE) { /* always post all at threshold time */ update_min = update_max = update_avg = TRUE; - } else { + } + + if (G_LIKELY (parse->priv->framecount >= MIN_FRAMES_TO_POST_BITRATE)) { if (frame_bitrate < parse->priv->min_bitrate) { parse->priv->min_bitrate = frame_bitrate; update_min = TRUE; diff --git a/gst/videoparsers/gstbaseparse.c b/gst/videoparsers/gstbaseparse.c index 8aa3f14fe6..4ab5dbb367 100644 --- a/gst/videoparsers/gstbaseparse.c +++ b/gst/videoparsers/gstbaseparse.c @@ -1227,7 +1227,9 @@ gst_base_parse_update_bitrates (GstBaseParse * parse, GstBaseParseFrame * frame) } else if (parse->priv->framecount == MIN_FRAMES_TO_POST_BITRATE) { /* always post all at threshold time */ update_min = update_max = update_avg = TRUE; - } else { + } + + if (G_LIKELY (parse->priv->framecount >= MIN_FRAMES_TO_POST_BITRATE)) { if (frame_bitrate < parse->priv->min_bitrate) { parse->priv->min_bitrate = frame_bitrate; update_min = TRUE;