Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
duplex audio over udp
#1
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;
 const AData: TIdBytes; ABinding: TIdSocketHandle);
var
 AudioDataSize: Integer;
 AudioData : Pointer;
begin
TThread.Synchronize(nil,
procedure
begin


AudioDataSize := Length(AData);

if (AudioDataSize > 10) then
begin
try
if not Player.Active then
begin
Player.Active := True;
Player.WaitForStart;
end;
except
end;
if BlockAlign > 1 then
begin
Dec(AudioDataSize, AudioDataSize mod BlockAlign);
end;

AudioData := AudioBuffer.BeginUpdate(AudioDataSize);
try
BytesToRaw(AData, AudioData^, AudioDataSize);
finally
AudioBuffer.EndUpdate;
end;
end else
begin
Player.Active := False;
Player.WaitForStop;
end;

end);
end;

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);
var
AUDIOLIST : TAUDIOLIST;
c : integer;
List : Tlist;
begin


list := AllAUDIO.LockList;
try



for c := 0 to list.Count - 1 do
begin
AUDIOLIST := list.Items[c];

if (AUDIOLIST.userserverPort = serverprta)
And (AUDIOLIST.userport <> porta) then
begin
Abinding.SendTo(AUDIOLIST.userip, AUDIOLIST.userport, Adata);

end;




end;



finally
 AllAUDIO.UnlockList;
end;



end;


sorry for my bad grammar i am trying to describe what i am trying to do as best as i can
Reply


Messages In This Thread
duplex audio over udp - by Madammar - 08-03-2018, 04:08 PM
RE: duplex audio over udp - by rlebeau - 08-03-2018, 05:37 PM
RE: duplex audio over udp - by Madammar - 08-04-2018, 02:59 PM
RE: duplex audio over udp - by kudzu - 08-05-2018, 04:06 PM
RE: duplex audio over udp - by Madammar - 08-05-2018, 05:54 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)