One GIF upload took latency to Discord from 39 ms to over 450 ms, which was the music lag. The card is smaller and about 15 fps, goes still when uploads get slow, and panels no longer hold up skips. The waveform reads at a gentler rate and recent pictures are reused. deploy/shape-upload.sh keeps voice ahead of uploads. Music links get the private-network check, music ffmpeg can only open web addresses, casino bets are checked and taken in one step, zstd-safe updated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
66 lines
2.4 KiB
Shell
Executable file
66 lines
2.4 KiB
Shell
Executable file
#!/bin/bash
|
|
# Keeps voice smooth on the Chromebook's slow upload (about 0.9 Mbit/s).
|
|
# Without this, one picture upload fills the router's queue and voice packets wait behind it: latency to Discord went
|
|
# from 39 ms to 450-785 ms while a 664 KB GIF uploaded. This caps internet-bound traffic just under the line's speed so
|
|
# the queue stays here, where fq_codel lets small flows like voice go first. Traffic to the home network isn't capped.
|
|
#
|
|
# shape-upload.sh turn it on
|
|
# shape-upload.sh off turn it off
|
|
# shape-upload.sh install turn it on now and at every boot
|
|
#
|
|
# It turns itself off again after 2 minutes unless `keep` is the second word, so a mistake can't lock anyone out.
|
|
set -eu
|
|
DEV=wlan0
|
|
RATE=800kbit
|
|
|
|
off() { tc qdisc del dev "$DEV" root 2>/dev/null || true; }
|
|
|
|
on() {
|
|
off
|
|
tc qdisc add dev "$DEV" root handle 1: htb default 20
|
|
tc class add dev "$DEV" parent 1: classid 1:1 htb rate 100mbit
|
|
tc class add dev "$DEV" parent 1:1 classid 1:10 htb rate 90mbit ceil 100mbit
|
|
tc class add dev "$DEV" parent 1:1 classid 1:20 htb rate "$RATE" ceil "$RATE"
|
|
tc qdisc add dev "$DEV" parent 1:10 fq_codel
|
|
tc qdisc add dev "$DEV" parent 1:20 fq_codel
|
|
tc filter add dev "$DEV" parent 1: protocol ip prio 1 u32 match ip dst 192.168.0.0/16 flowid 1:10
|
|
tc filter add dev "$DEV" parent 1: protocol ipv6 prio 2 u32 match ip6 dst fe80::/10 flowid 1:10
|
|
}
|
|
|
|
case "${1:-on}" in
|
|
off)
|
|
off
|
|
systemctl disable --now dezio-shape.service 2>/dev/null || true
|
|
echo "Upload shaping is off"
|
|
;;
|
|
install)
|
|
install -m 755 "$0" /usr/local/bin/dezio-shape
|
|
cat > /etc/systemd/system/dezio-shape.service <<UNIT
|
|
[Unit]
|
|
Description=Keep voice smooth on the slow upload
|
|
After=network-online.target
|
|
Wants=network-online.target
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
RemainAfterExit=yes
|
|
ExecStart=/usr/local/bin/dezio-shape on keep
|
|
ExecStop=/usr/local/bin/dezio-shape off
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
UNIT
|
|
systemctl daemon-reload
|
|
systemctl enable --now dezio-shape.service
|
|
echo "Upload shaping is on, now and at every boot"
|
|
;;
|
|
*)
|
|
on
|
|
if [ "${2:-}" = keep ]; then
|
|
echo "Upload shaping is on"
|
|
else
|
|
nohup sh -c "sleep 120; tc qdisc del dev $DEV root" >/dev/null 2>&1 &
|
|
echo "Upload shaping is on for 2 minutes as a test"
|
|
fi
|
|
;;
|
|
esac
|