Hi I have an issue basically I'm sending a stereo audio with WebRTC this way
const audioStream = await navigator.mediaDevices.getUserMedia({
audio: {
autoGainControl: false,
channelCount: 2,
echoCancellation: false,
latency: 0,
noiseSuppression: false,
sampleRate: 48000,
sampleSize: 16,
volume: 1.0,
},
video: false,
});
If i check the number of channels I have 2 channels getAudioTracks()[0].getSettings().channelCount
If I check the description I'm sending I have 2 channels
a=rtpmap:111 opus/48000/2
If check the description I'm receiving I have 2 channels.
But The stream I'm receiving has only one channel
connection.ontrack = ({ streams: [stream] }) => {
audio.srcObject = stream;
console.log(stream.getAudioTracks()[0].getSettings().channelCount); // =1
};
I don't understand what's going on.
You can try it yourself here
Check out chrome://webrtc-internals/
When I run your code, I get "undefined" for stream.getAudioTracks()[0].getSettings().channelCount when I call it in your GotRemoteStream function.
However, in chrome://webrtc-internals, in RTCInboundRTPAudioStream stats, I see 48 samples per second arriving (that must mean 48kHz stereo for Opus) and also "codec" says "stereo=1" which indicates you are really receiving stereo sound.