summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>2009-11-10 10:10:56 -0300
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2009-11-10 10:10:56 -0300
commit245089c9bd788ba11cc6828ed647d57fa851dce1 (patch)
treedfa388452aa6ba778a05d16c2ec93f7f83b5bbc2 /plugins
parent5c7104c0023161131a54d39f09b4635b0241f681 (diff)
queue2: avoid crashing due to negative percent
queue2 would crash when using small buffer sizes because it would overflow when calculating the percentage, resulting in the buffering GstMessage not being created and trying to be used. This patch uses a gint64 instead of a gint to do the percentage math, making it harder to overflow.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/elements/gstqueue2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c
index 9682d86aa3..8aee01b25d 100644
--- a/plugins/elements/gstqueue2.c
+++ b/plugins/elements/gstqueue2.c
@@ -580,7 +580,7 @@ apply_buffer (GstQueue2 * queue, GstBuffer * buffer, GstSegment * segment)
static void
update_buffering (GstQueue2 * queue)
{
- gint percent;
+ gint64 percent;
gboolean post = FALSE;
if (!queue->use_buffering || queue->high_percent <= 0)
@@ -647,7 +647,8 @@ update_buffering (GstQueue2 * queue)
}
GST_DEBUG_OBJECT (queue, "buffering %d percent", percent);
- message = gst_message_new_buffering (GST_OBJECT_CAST (queue), percent);
+ message = gst_message_new_buffering (GST_OBJECT_CAST (queue),
+ (gint) percent);
gst_message_set_buffering_stats (message, mode,
queue->byte_in_rate, queue->byte_out_rate, buffering_left);