radzio / AndroidOggStreamPlayer

39 stars 13 forks source link

Issue streaming short audio files #2

Open vincentjames501 opened 11 years ago

vincentjames501 commented 11 years ago

The player is great and I'm using it in my new project to send push to talk messages. If the audio file is greater than a certain length, everything works great (see 31.ogg), however, if the audio file is very short (see 36.ogg) then the decodeCurrentPacket() method is never called. In fact, by the time it reaches readBody() and calls count = inputStream.read(buffer, index, bufferSize), count is -1. While reading the header information the rest of the data is consumed so nothing is left to be consumed in the body when readBody() is entered.

On a side note, when the count is -1 (the end of the stream), it should be properly handled and changed into a 0 to pass to joggSyncState.wrote(count);

https://dl.dropbox.com/u/99827173/31.ogg (11.1Kb ~3sec) https://dl.dropbox.com/u/99827173/36.ogg (6.9Kb ~1sec)

radzio commented 11 years ago

@vincentjames501 I will look at it.

vincentjames501 commented 11 years ago

@radzio great. Thanks!