TeamPyOgg / PyOgg

Simple OGG Vorbis, Opus and FLAC bindings for Python
The Unlicense
64 stars 27 forks source link

Infinite loop when reading from an opus file #11

Closed pmiddend closed 5 years ago

pmiddend commented 5 years ago

We are encountering an infinite loop when a song is close to its end. We load the song from an opus file. I have debugged the code and saw that you have a while True loop that only breaks if:

samples_read.value*self.channels*2 + ns >= PYOGG_STREAM_BUFFER_SIZE

However, it might be the case that this is never fulfilled. What if there's just not enough data to fill another buffer completely?