Robert904 / pymumble

Mumble client implementation in Python (and a bit of cython)
GNU General Public License v3.0
32 stars 80 forks source link

Fix for pcm generated by mpg123 not ending on a sample interval #7

Open WilliamWCYoung opened 8 years ago

WilliamWCYoung commented 8 years ago

This is a fix to address PCM data being passed in that doesn't match the sample frame length. I encounted this while using mpg123 with the error:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/***/mumble.py", line 108, in run
    self.loop()
  File "/***/mumble.py", line 170, in loop
    self.sound_output.send_audio()  # send outgoing audio if available
  File "/***/soundoutput.py", line 73, in send_audio
    encoded = self.encoder.encode(to_encode)
  File "/***/pyopus/opus.py", line 47, in encode
    return self.encoder.encode(pcm, len(pcm))
  File "copus.pyx", line 50, in copus.OpusEncoder.encode (copus.c:1324)
SystemError: Negative size passed to PyString_FromStringAndSize

Tested on Arch Linux x86_64, may be that this is actually intended behaviour and it is required to pass in 'cleaned' PCM.

raylu commented 8 years ago

it looks like the patch mixes hard and soft tabs

WilliamWCYoung commented 8 years ago

As much as I won't blame my tools, going from sublime to gedit fooled me! Amended.