You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order minimize the latency of a live stream being captured on one system and sent to one or more "listeners", I integrated the aurora-websockets library as a source and wanted to use this code to decode and play the mp3 stream.
Since the stream is live (encoded at 44.1k sample rate, 112k bitrate, mpeg1 layer 3), the data is received over websockets in "packets" of 3-4 frames approximately every 100ms. The decoder will process each packet in around 10ms. Because Layer3#decode looks for the next frame before decoding the current frame, the last frame of each packet will generate an underflow error and consequently skip that frame.
The result is stuttering or warbling caused by missing frame. In addition, the audio that makes it into BufferList in Queue is missing several frames per second of audio and thus consumes the Queue faster than realtime, causing the audio device to stop after several seconds.
I tried altering the logic in Layer#decode to not throw and error if there is no additional frame, but that caused the decoder to stop decoding at all. I have had to stop working on this as it would require an unknown amount of effort to resolve this and so I am looking at alternatives. However, I thought you might want this information. I am also willing to create a pull request for the code I changed, but only if it is something you would like to pursue further.
I have attached an image of a log analysis I did that clearly shows the issue.
The text was updated successfully, but these errors were encountered:
As it turns out, I had to revisit this as other options were not viable. In doing so, I managed to address this issue I raised above. I only fixed it in layer3.js, so it might be an issue in the decoder for other mpeg layers. I will create a pull request with the updates this week.
In order minimize the latency of a live stream being captured on one system and sent to one or more "listeners", I integrated the aurora-websockets library as a source and wanted to use this code to decode and play the mp3 stream.
Since the stream is live (encoded at 44.1k sample rate, 112k bitrate, mpeg1 layer 3), the data is received over websockets in "packets" of 3-4 frames approximately every 100ms. The decoder will process each packet in around 10ms. Because Layer3#decode looks for the next frame before decoding the current frame, the last frame of each packet will generate an underflow error and consequently skip that frame.
The result is stuttering or warbling caused by missing frame. In addition, the audio that makes it into BufferList in Queue is missing several frames per second of audio and thus consumes the Queue faster than realtime, causing the audio device to stop after several seconds.
I tried altering the logic in Layer#decode to not throw and error if there is no additional frame, but that caused the decoder to stop decoding at all. I have had to stop working on this as it would require an unknown amount of effort to resolve this and so I am looking at alternatives. However, I thought you might want this information. I am also willing to create a pull request for the code I changed, but only if it is something you would like to pursue further.
I have attached an image of a log analysis I did that clearly shows the issue.
The text was updated successfully, but these errors were encountered: