mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 18:20:44 +00:00
basesink: use new gst_buffer_list_calculate_size() utility function
This commit is contained in:
parent
0ca70247fc
commit
2841b8f0b2
1 changed files with 8 additions and 13 deletions
|
@ -3343,13 +3343,6 @@ gst_base_sink_needs_preroll (GstBaseSink * basesink)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
count_list_bytes (GstBuffer ** buffer, guint idx, GstBaseSinkPrivate * priv)
|
|
||||||
{
|
|
||||||
priv->rc_accumulated += gst_buffer_get_size (*buffer);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* with STREAM_LOCK, PREROLL_LOCK
|
/* with STREAM_LOCK, PREROLL_LOCK
|
||||||
*
|
*
|
||||||
* Takes a buffer and compare the timestamps with the last segment.
|
* Takes a buffer and compare the timestamps with the last segment.
|
||||||
|
@ -3530,12 +3523,14 @@ again:
|
||||||
goto dropped;
|
goto dropped;
|
||||||
|
|
||||||
if (priv->max_bitrate) {
|
if (priv->max_bitrate) {
|
||||||
if (is_list) {
|
gsize size;
|
||||||
gst_buffer_list_foreach (GST_BUFFER_LIST_CAST (obj),
|
|
||||||
(GstBufferListFunc) count_list_bytes, priv);
|
if (is_list)
|
||||||
} else {
|
size = gst_buffer_list_calculate_size (GST_BUFFER_LIST_CAST (obj));
|
||||||
priv->rc_accumulated += gst_buffer_get_size (GST_BUFFER_CAST (obj));
|
else
|
||||||
}
|
size = gst_buffer_get_size (GST_BUFFER_CAST (obj));
|
||||||
|
|
||||||
|
priv->rc_accumulated += size;
|
||||||
priv->rc_next = priv->rc_time + gst_util_uint64_scale (priv->rc_accumulated,
|
priv->rc_next = priv->rc_time + gst_util_uint64_scale (priv->rc_accumulated,
|
||||||
8 * GST_SECOND, priv->max_bitrate);
|
8 * GST_SECOND, priv->max_bitrate);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue