-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streaming playback stops unexpectedly — Simple fix proposed #107
Comments
I think, without testing, that this would cause the decoder to decode as fast as possible, rather than decoding only as needed (i.e. when the player needs more data). The player, or really the queue which is used by the player, calls What you're probably running into instead is that the player stops the audio output device (and playback clock) when it runs out of data. I think it currently doesn't start the clock up again after more data comes in (the real bug). Can you try commenting out the line I linked to and testing? The clock won't pause while more data comes in, but you'll be able to test and see if it starts up again. |
Thanks, I removed the one-line change I made above, and commented out |
I'm running into the same issue, and MidinghtJava's initial comment didn't solve it, but commenting out Out of interest, where would I look for if I was to try writing code to start the clock up again after more data comes in? |
Same problem here @devongovett . I've tried @MidnightJava solution but not work, it always stop unexpected. I don't know has this problem been solved yet? |
I'm using
aurora-websocket
to stream data toaurora.js
from a server. The server sends data indefinitely, but after anywhere from 5 seconds to a minute, the audio playback stops.Javascript debugging shows me that aurora-websocket continues to receive data from the WebSocketServer and emit data events to aurora's WebSocketSource, even after audio playback has stopped. I traced the event firing through
aurora.js
, and ultimately found what seems like a bug. I made a one-line change, and it solved my problem. However, I'm not sure I fully understand the way events are supposed to work inaurora.js
, so perhaps this is not the best way to fix it.A diff of the change is pasted below. Here's a summary of it.
When
decode()
is invoked, it first setswaiting
to false. It sets it to true again ifreadChunk()
does not return a packet and the final buffer has not been received. IfreadChunk
does return a packet, the Decoder emits a 'data' event, but it does not setwaiting
to true.This causes a problem in the 'data' event handler for
demuxer
(decoder.js line 42). After several seconds of processing, it reaches a state where 'data' events are received, but it is impossible to invokedecode()
, becausewaiting
is false and can never be true again. It can only be set to true ifdecode()
is invoked, butdecode()
cannot be invoked unlesswaiting
is true. So the processing is deadlocked, and incoming packets are not decoded.My fix simply sets
this.waiting = true
when a packet is returned fromreadChunk()
(line 82 of the patched code)The text was updated successfully, but these errors were encountered: