azlux / botamusique

Bot to play youtube / soundcloud / radio / local music on Mumble (using pymumble).
MIT License
311 stars 78 forks source link

Crash on Low Bandwidth Mumble Server #38

Closed s3m1s0n1c closed 5 years ago

s3m1s0n1c commented 5 years ago

Describe the bug Bot crashed on Low Bandwidth servers (18000) See below for crash error

2019-01-21 12:35:15,314-PyMumble-DEBUG-Bandwidth is 18000, downgrading to -1600 due to the protocol overhead 2019-01-21 12:35:15: Bandwidth is 18000, downgrading to -1600 due to the protocol overhead Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/root/botamusique/pymumble/pymumble_py3/mumble.py", line 119, in run self.loop() File "/root/botamusique/pymumble/pymumble_py3/mumble.py", line 194, in loop self.read_control_messages() File "/root/botamusique/pymumble/pymumble_py3/mumble.py", line 268, in read_control_messages self.dispatch_control_message(type, message) File "/root/botamusique/pymumble/pymumble_py3/mumble.py", line 306, in dispatch_control_message self.set_bandwidth(mess.max_bandwidth) File "/root/botamusique/pymumble/pymumble_py3/mumble.py", line 440, in set_bandwidth self.sound_output.set_bandwidth(self.bandwidth) # communicate the update to the outgoing audio manager File "/root/botamusique/pymumble/pymumble_py3/soundoutput.py", line 133, in set_bandwidth self._set_bandwidth() File "/root/botamusique/pymumble/pymumble_py3/soundoutput.py", line 151, in _set_bandwidth self.encoder.bitrate = self.bandwidth - overhead_per_second File "/root/botamusique/venv/lib/python3.6/site-packages/opuslib/classes.py", line 167, in <lambda> self._state, opuslib.api.ctl.set_bitrate, x) File "/root/botamusique/venv/lib/python3.6/site-packages/opuslib/api/encoder.py", line 66, in ctl return request(_ctl, encoder, value) File "/root/botamusique/venv/lib/python3.6/site-packages/opuslib/api/ctl.py", line 62, in inner raise opuslib.exceptions.OpusError(result_code) opuslib.exceptions.OpusError: <unprintable OpusError object>

Affected version Latest Version

To Reproduce Run bot on a low bandwidth mumble server

azlux commented 5 years ago

Hi, The librairy behind botamusique is Pymumble. Pymumble required a minimal bandwidth of 19 600 bits/s for signaling only (without voice data)

I see your bandwidth is 18kbs , it's not enough to make the basics works.

The minimum to transport a voice channel is 59kbs. https://wiki.mumble.info/wiki/FAQ/English#What_are_the_bandwidth_requirements.3F I recommend you to have at least 100kbs

Azlux

s3m1s0n1c commented 5 years ago

Hi @azlux

Okays not sure I agree 100% with all your points.

I have been talking on Mumble in 18Kbits/s for a while now with my friends so i find your comment about voice channel needing 59Kbs as not true..

Yeah 100kbs would be ideal.. but unfortunately bandwidth is restricted for this project I'm using the bot for..

I guess we will agree to disagree.

Thanks for your time to message me back..

Sonic

azlux commented 5 years ago

Sorry, I made a mistake, The minimum in the documentation is 15.8 kbit/s (again with IP and UDP overhead). Pymumble is TCP only, so the minimum is 19.6 kbit/s. (TCP frame are larger than UDP) The 59kbit/s is the recommended when the default setting are enable. Maybe you can set the server 20kbit/s to see if pymumble can manage it. The codec should manage the compression, but not sure about it.

s3m1s0n1c commented 5 years ago

FYI,

I fixed this by changing line 89 to self.bandwidth = 20000 # reset the outgoing bandwidth to it's default before connectiong