queue2: not update upstream size with negative value

upstream_size can be negative but queue->upstream_size is unsigned type.
to get a chance to update queue->upstream_size in gst_queue2_get_range()
it should keep the default value.

https://bugzilla.gnome.org/show_bug.cgi?id=753011
This commit is contained in:
Eunhae Choi 2015-08-04 13:45:09 +09:00 committed by Thiago Santos
parent fa370153bc
commit ed7e0e744f

View file

@ -3176,7 +3176,13 @@ gst_queue2_update_upstream_size (GstQueue2 * queue)
if (gst_pad_peer_query_duration (queue->sinkpad, GST_FORMAT_BYTES,
&upstream_size)) {
GST_INFO_OBJECT (queue, "upstream size: %" G_GINT64_FORMAT, upstream_size);
queue->upstream_size = upstream_size;
/* upstream_size can be negative but queue->upstream_size is unsigned.
* Prevent setting negative values to it (the query can return -1) */
if (upstream_size >= 0)
queue->upstream_size = upstream_size;
else
queue->upstream_size = 0;
}
}