I am using the CMdaAudioOutputStream class for playing the MP3 data (128 kbps), which I am streaming from the Internet (icecast server). For getting data I am using the RSocket class and 64 kB circular cache buffer. Data are downloaded in stream from internet into buffer of 8kB size by RSocket::Read() call.
The problem is that streaming and playing works well for a while - less then 5-7 seconds (for 1 second audio play I need 16kB data). It means that play is stopped after the initial cache buffer is emptied + 5-8 chunks of data received from RSocket are played).
At the beginning data are read/received by socket and added to the circular buffer, from which they are taken when the MaoscBufferCopied() callback is called by CMdaAudioOutputStream. The problem is that after a while the data from socket are stopped to be added to the buffer, which after few MaoscBufferCopied() calls leads to the buffer underflow situation. After this happens, data are delivered from sockets in a burst – it looks to me like that playing the music might block the sockets.
Both – the RSocket and CMdaAudioOutputStream are used withing the application thread. The RSocket active object priority is EPriorityStandard and for the CMdaAudioOutputStream the priority is the EMdaPriorityMax – 40.
Any ideas where the problem can be? Would it help to put both – playing and data fetching processes into 2 separated threads? Or might be I am doing something completely wrong...
Thanks a lot