Closed ldenoue closed 4 years ago
Hello @ldenoue, have you found a solution to do this? Thanks
I understood that I could use a PCM audio mixer to mix all incoming audio samples and send its output to the connected clients but haven’t implemented it.
@ldenoue
So if we have say 4 people connected, it would use RTCAudioSink to grab the audio samples of each, but then how do we merge all those samples into one?
One option is to mix them in your application code. This will not be very performant.
Alternatively, could we add more than one RTCAudioTrack back to the incoming peerConnection(s) so that each would receive several audio tracks?
Yes, you can. For every incoming RTCAudioTrack, add it as an outgoing RTCAudioTrack on the other RTCPeerConnections using addTrack
.
@markandrus thanks for your comments. My understanding is that merging the audio samples will cost CPU on my server, while adding audio tracks so that each peerConnection transports N-1 audio tracks would cost bandwidth. Correct?
Similar to the video compositing example, I am trying to grab incoming audio from several peerConnections and send back one RTCAudioSource to each connected client my mixing the audio data of each.
So if we have say 4 people connected, it would use RTCAudioSink to grab the audio samples of each, but then how do we merge all those samples into one?
Alternatively, could we add more than one RTCAudioTrack back to the incoming peerConnection(s) so that each would receive several audio tracks?
Laurent