Increasing Delay while sending audio bytes over Multiple PeerConnection using DataChannels

36 views
Skip to first unread message

Muhammad Usman Bashir

unread,
Aug 10, 2022, 5:17:48 AM8/10/22
to discuss-webrtc
I have implemented WebRtc-based 1 to Many Android Applications. It's a kind of Master-Slave Architecture where the master device is communicating with N-Number of Slave Android Device using WebRtc P2P.  Here are the details;

1. Single Master Device (Android)
2. Multiple Slave Devices (Android) # N-Numbers of devices [1, 2, 3, ... 10].

As I said there is a WebRtc 1-many peer connection. I am not using any kind of Audio Channel or Video channel and I am only sending Audio bytes over DataChannel. For the following combinations, the delay is not prominent;

- 1 to 1 (1 Master, 1 Slave)
- 1 to 2 (1 Master, 2 Slaves)
- 1 to 3 (1 Master, 3 Slaves)

For the above-mentioned combinations, I receive smooth audio and it is being played normally. But as soon as the number of slave devices are increased, I encountered around 102-220 MS delay in DataChannel.send function. I placed logs before and after Java DataChannel.send function and the delay is gradually increasing as the number of slave devices (Peer Connections) are increasing i.e. 1 to 4 (1 Master, 4 Slaves)

As DataChannel.send function latency is a pain point in my research work. I Placed Logs inside WebRtc Native Stack for DataChannel Sending flow inside CPP. Here are the logs from the WebRtc native Stacks I encountered large delays in two CC files;

- `dtls_transport.cc`
- `sctp_data_channel.cc`
- `sctp_data_channel_tansport.cc`

I am using for Loop to send audio Packets over DataChannel using Multi-threading in java. I have placed logs before and after DataChannel.Send function which seems to increase as the number of peer Connections is increasing. Here is the snap of logs I have printed; 

 image (2).png

I have encountered this issue only on Android. It is not being observed on the iOS side.

Your advice related to this issue might help me a lot. Looking for the vigilant community and their valuable advice. Thanks


Reply all
Reply to author
Forward
0 new messages