]> git.sesse.net Git - vlc/commitdiff
test/modules/stream_filter/httplive: script for traffic shaping
authorJean-Paul Saman <jean-paul.saman@m2x.nl>
Tue, 23 Nov 2010 14:23:22 +0000 (15:23 +0100)
committerJean-Paul Saman <jean-paul.saman@m2x.nl>
Fri, 26 Nov 2010 15:54:31 +0000 (16:54 +0100)
Test script for traffic shaping with tc (iproute).

test/modules/stream_filter/httplive/traffic-shaping.sh [new file with mode: 0755]

diff --git a/test/modules/stream_filter/httplive/traffic-shaping.sh b/test/modules/stream_filter/httplive/traffic-shaping.sh
new file mode 100755 (executable)
index 0000000..cf67c89
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Copyright (C) 2010 VideoLAN
+# License: GPLv2
+#----------------------------------------------------------------------------
+# Traffic shaping for HTTP Live Streaming client tests.
+#----------------------------------------------------------------------------
+# Requires: iproute2
+#----------------------------------------------------------------------------
+#qdisc pfifo_fast 0: root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
+#
+TC=tc
+INTF="eth0"
+RATE="500kbit"
+BURST="20kbit"
+PEAK="520kbit"
+MTU="1500"
+
+set +e
+
+# Shaping
+function traffic_shaping() {
+    ${TC} qdisc add    \
+          dev ${INTF}  \
+          root         \
+          tbf          \
+          rate ${RATE} \
+          burst ${BURST} \
+          latency 70ms \
+          peakrate ${PEAK} \
+          mtu ${MTU}
+    RESULT=$?
+}
+
+# tc qdisc add dev eth2 root tbf rate 50kbit burst 2kbit latency 70ms peakrate 52kbit mtu 1500
+
+traffic_shaping
+if ! test "${RESULT}" = "0"; then
+    exit 1
+fi
+exit 0