![]() |
duplex audio over udp - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Indy (https://www.atozed.com/forums/forum-8.html) +--- Forum: Indy General Discussion (https://www.atozed.com/forums/forum-9.html) +--- Thread: duplex audio over udp (/thread-543.html) |
duplex audio over udp - Madammar - 08-03-2018 i use Tidtudpserver to send audio to clients i have something i do not understand from long time ago when one client Send Audiodata to udpserver and udpserver send it back to clients every thing works fine and audio arrived good and clear if 2 or 3 clients send audio at the same time the audio arrived un understandable and have too many cutting i wanted to make it a live conversation with duplex audio but i dont understand where is the problem is is it from idudpserver or from receiver side ? here is the receiver side code Code: procedure TForm2.udpreciverUDPRead(AThread: TIdUDPListenerThread; and here is the server side i have set multithreaded event to True Code: procedure TForm1.broadcatsaudio(ABinding: TIdSocketHandle; ipada : string; porta, serverprta : integer; const AData: TIdBytes); sorry for my bad grammar i am trying to describe what i am trying to do as best as i can RE: duplex audio over udp - rlebeau - 08-03-2018 (08-03-2018, 04:08 PM)Madammar Wrote: if 2 or 3 clients send audio at the same time the audio arrived un understandable and have too many cutting i wanted to make it a live conversation with duplex audio but i dont understand where is the problem is is it from idudpserver or from receiver side ? Well, for one thing, your receiver is synchronizing the entire OnUDPRead event handler, so you may as well have set udprecive.ThreadedEvent=False instead. But more importantly, not everything the event handler is doing needs to be synchronized at all. Do as much processing as you can inside the event handler itself, and synchronize only what is actually needed, like accessing the audio Player. You might also consider using TThread.Queue() instead of TThread.Synchronize(), so that your event handler is not waiting on the Player on all, so the receiving of UDP packets and the playing of those packets occur in parallel, not in serial. Try this: Code: procedure TForm2.udpreciverUDPRead(AThread: TIdUDPListenerThread; RE: duplex audio over udp - Madammar - 08-04-2018 the queue helped to reduce some of cutting but i cannot mange it to make it work normally like a skype conversation the sound getting terribly bad and not understandable is it from the player it self ? RE: duplex audio over udp - kudzu - 08-05-2018 You likely need to prebuffer more, and turn off nagle and do your own packet management. Streaming is very sensitive to any small delays. RE: duplex audio over udp - Madammar - 08-05-2018 the streaming arrived altogether the sound is not delaying its like playing all together at the same time i think its the player it self that blocking the playing i dont know if iam right but its really hard to get it work |