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. ReadyRead synchronous issue
Forum Updated to NodeBB v4.3 + New Features

ReadyRead synchronous issue

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 652 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.
  • J Offline
    J Offline
    Jeffson
    wrote on last edited by
    #1

    Hi,Guys

    I have an problem in implementing a udp socket buffer behavior in QT,
    anyone can help me?

    The details:I want to create a buffer to hold coming data,the "ReadyRead" slot is responsible for recieving.
    After i recieve the packet,i want to play the packet which is in audio format.
    The playing part is also implemented inside "ReadyRead" function.
    The thing is when I play the packet,the "ReadyRead" blocked,did not recieve packet anymore,
    which will cause the packet recieving delay.

    how can make the recieving and playing synchronous?

    Thanks.

    kshegunovK 1 Reply Last reply
    0
    • m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by m.sue
      #2

      Hi,
      you should consider to source out the "playing" (or the reading) into a different thread, so "reading" and "playing" can happen "simultaneously". Well reading will in fact always be some time ahead. Keep in mind how Youtube does and shows it in co-operation with your browser with the gray and red part of the progress bar.
      I would call this pattern where one part does not wait on another to finish "asynchronous", though.
      -Michael.

      1 Reply Last reply
      1
      • J Jeffson

        Hi,Guys

        I have an problem in implementing a udp socket buffer behavior in QT,
        anyone can help me?

        The details:I want to create a buffer to hold coming data,the "ReadyRead" slot is responsible for recieving.
        After i recieve the packet,i want to play the packet which is in audio format.
        The playing part is also implemented inside "ReadyRead" function.
        The thing is when I play the packet,the "ReadyRead" blocked,did not recieve packet anymore,
        which will cause the packet recieving delay.

        how can make the recieving and playing synchronous?

        Thanks.

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #3

        If you do a lengthy operation in the slot the events are waiting in a queue and nothing else is happening with your program. You need to use threads. Either put the UDP communication in a separate thread or the playback in a separate thread.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        1

        • Login

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