Playback issues: Streaming data over QTCPSocket > QBuffer > playing with Phonon



  • Hello,

    Currently I have audio data coming in over a QTCPSocket, being processed, and being added to a QBuffer as it comes in. I then have a phonon MediaObject with its source set to the QBuffer.

    It plays smoothly when the QBuffer contains the entire audio file, however if I attempt to play before the data has finished coming in it plays back 8 or 9 rapid 1-2 second snippets of the file going forwards with gaps in between and then ends.

    Is it possible to play an audio file from a QBuffer that is being updated at the same time?

    Thanks!



  • Why do you use a QBuffer inbetween ? The QTCPSocket is already buffered as are most of the I/O classes in Qt.



  • Because the socket is used for sending commands as well as data. I have to remove the headers, etc.



  • Well, in that case I guess you'll have to implement your own circular buffer on top of QIODevice, otherwise everytime you receive data from the network you have to append it to the QBuffer's underlying QByteArray and consume a lot of RAM. I think you need to do this because you have no way of calling a seek(0) before the MediaObject calls the read() on your QBuffer...



  • Thanks for replying!

    Yeah, about the seek thing: I thought that was probably the case.

    This is only for a University assignment, so it isn't terribly serious. I know what a circular buffer is but I can't quite see how that would help - being dense unfortunately. Could you explain that a little more please? :(


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.