diff options
author | Sebastian P <5564491+s3lph@users.noreply.github.com> | 2020-10-01 22:50:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 22:50:56 +0200 |
commit | 214a6a13861b9fd495797386f36507373728e577 (patch) | |
tree | a2eb9541924b432ecf7a0807f42281296fa144a4 /vendor/layeh.com/gumble/gumbleutil/bitrate.go | |
parent | e7781dc79c0c556f60eb64a93a95a5da494dcf2d (diff) | |
download | matterbridge-msglm-214a6a13861b9fd495797386f36507373728e577.tar.gz matterbridge-msglm-214a6a13861b9fd495797386f36507373728e577.tar.bz2 matterbridge-msglm-214a6a13861b9fd495797386f36507373728e577.zip |
Add Mumble support (#1245)
Diffstat (limited to 'vendor/layeh.com/gumble/gumbleutil/bitrate.go')
-rw-r--r-- | vendor/layeh.com/gumble/gumbleutil/bitrate.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/layeh.com/gumble/gumbleutil/bitrate.go b/vendor/layeh.com/gumble/gumbleutil/bitrate.go new file mode 100644 index 00000000..6b93caa9 --- /dev/null +++ b/vendor/layeh.com/gumble/gumbleutil/bitrate.go @@ -0,0 +1,27 @@ +package gumbleutil + +import ( + "time" + + "layeh.com/gumble/gumble" +) + +var autoBitrate = &Listener{ + Connect: func(e *gumble.ConnectEvent) { + if e.MaximumBitrate != nil { + const safety = 5 + interval := e.Client.Config.AudioInterval + dataBytes := (*e.MaximumBitrate / (8 * (int(time.Second/interval) + safety))) - 32 - 10 + + e.Client.Config.AudioDataBytes = dataBytes + } + }, +} + +// AutoBitrate is a gumble.EventListener that automatically sets the client's +// AudioDataBytes to suitable value, based on the server's bitrate. +var AutoBitrate gumble.EventListener + +func init() { + AutoBitrate = autoBitrate +} |