PDA

View Full Version : Phonon endless stream - any phonon expert out there?



derektmm
20th September 2011, 16:38
Hi,
I am trying to play an endless HTTP mp3 stream using phonon. Its working well, except for one thing, which I will proceed to explain.

The way I'm doing this is using a QNetworkReply (QIODevice subclass) to store the downloaded data. When I have enough data available, I feed it to the Phonon::MediaObject with setCurrentSource() and start playing. This works in general, but it depends on how much data is available when I start playing:

- If there is around 50-60Kb stored, the MediaObject will read it all at once, play it and stop. Even if the QNetworkReply continues to receive data, it will not continue playing after it has played the initial 50-60kb.
- If there is more data (usually 90Kb-100Kb is enough) it will read just 50-60kb with the first big read, then it will continue reading & playing while the stream is downloaded.

So, it seems that the MediaObject has quite a large buffer which it needs to fill - when full, if there is data remaining to be read, it will read & play forever. If it can fill the buffer with just 1 read, it doesnt check again if there is more data at the source.

The problem with all this is that the stream is 64kbps, so 100Kb takes a long time to fill. It is too much delay when starting to play, or when changing to a new channel. Plus the fact that I don't like that such things are not under control in my program...

I haven't found any way to control the size of this buffer, so does anyone know how I could do this, or what can be done to solve this problem?

Thanks in advance,

Derek

derektmm
23rd September 2011, 16:11
nobody? :S