Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Playback issues: Streaming data over QTCPSocket > QBuffer > playing with Phonon
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tleilaxu
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Tleilaxu
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rcari
          wrote on last edited by
          #4

          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...

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Tleilaxu
            wrote on last edited by
            #5

            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? :(

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved