From 23d1440a608925d6f6cbd809e3ee30324f7ed8ee Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 9 Nov 2018 12:22:31 +0100 Subject: [PATCH] urisourcebin: Avoid potential unitialized/wrong bitrate value Only calculate and set the bitrate if all conditions are met. --- gst/playback/gsturisourcebin.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gst/playback/gsturisourcebin.c b/gst/playback/gsturisourcebin.c index 3edd94ba6d..0e0bf82919 100644 --- a/gst/playback/gsturisourcebin.c +++ b/gst/playback/gsturisourcebin.c @@ -1003,15 +1003,13 @@ update_queue_values (GstURISourceBin * urisrc) for (cur = urisrc->out_slots; cur != NULL; cur = g_slist_next (cur)) { OutputSlotInfo *slot = (OutputSlotInfo *) (cur->data); - guint64 bitrate; guint byte_limit; - if (cumulative_bitrate > 0) { - if (g_object_class_find_property (G_OBJECT_GET_CLASS (slot->queue), - "bitrate")) { - g_object_get (G_OBJECT (slot->queue), "bitrate", &bitrate, NULL); - } - + if (cumulative_bitrate > 0 + && g_object_class_find_property (G_OBJECT_GET_CLASS (slot->queue), + "bitrate")) { + guint64 bitrate; + g_object_get (G_OBJECT (slot->queue), "bitrate", &bitrate, NULL); byte_limit = gst_util_uint64_scale (buffer_size, bitrate, cumulative_bitrate); } else {