summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-11-25 11:27:57 +0000
committerTim-Philipp Müller <tim@centricular.com>2017-11-25 11:27:57 +0000
commitc27bb822a8411119e7e9b16b980effe7eb1bec0a (patch)
tree9cf158e82c9cca291fb3c93abfbe20a7df290f4b /gst
parent3d20065bc5a5d4d493671f22043f3f449fb634a9 (diff)
netsim: simplify getting buffer size in bits
Diffstat (limited to 'gst')
-rw-r--r--gst/netsim/gstnetsim.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/gst/netsim/gstnetsim.c b/gst/netsim/gstnetsim.c
index 24ea04a68..51bbdb32e 100644
--- a/gst/netsim/gstnetsim.c
+++ b/gst/netsim/gstnetsim.c
@@ -384,17 +384,6 @@ gst_net_sim_delay_buffer (GstNetSim * netsim, GstBuffer * buf)
return ret;
}
-static gsize
-get_buffer_size_in_bits (GstBuffer * buf)
-{
- GstMapInfo map = GST_MAP_INFO_INIT;
- gsize size;
- gst_buffer_map (buf, &map, GST_MAP_READ);
- size = map.size * 8;
- gst_buffer_unmap (buf, &map);
- return size;
-}
-
static gint
gst_net_sim_get_tokens (GstNetSim * netsim)
{
@@ -451,7 +440,8 @@ gst_net_sim_token_bucket (GstNetSim * netsim, GstBuffer * buf)
if (netsim->max_bucket_size == -1)
return TRUE;
- buffer_size = get_buffer_size_in_bits (buf);
+ /* get buffer size in bits */
+ buffer_size = gst_buffer_get_size (buf) * 8;
tokens = gst_net_sim_get_tokens (netsim);
netsim->bucket_size = MIN (G_MAXINT, netsim->bucket_size + tokens);