-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Hi, I'm receiving opus audio data (.ogg) as a live stream, and want to decode each packet as it arrives.
So I assume I'll have to patch OggPacketReader to "pause" when no more bytes are available currently.
I could use blocking I/O, but that's really not preferred.
Edit: After looking at the sources, I don't think it's going to be very hard. Just have the InputStream return null when temporarily out of bytes, and rewind the stream when getNextPacket() returns null. Plus make sure OpusFile gets enough initial packets to start up.
Edit 2: I got it done! Demo: https://code.botcompany.de/1032909, main class: https://code.botcompany.de/1032905 (it's in my dialect JavaX, but you can click on "Pure Java Version")
The trick is to have your InputStream simply behave like EOF when it is currently out of bytes, and have the other classes work properly with this.