Skip to content Skip to sidebar Skip to footer

Webrtc - Disable All Audio Processing

I'm currently trying to get a clean as possible audio channel via webrtc. Via the getUserMedia mediaconstraints object, I've set the following options: constraints: { audio

Solution 1:

I'd wager that the variable bitrate (default) behavior of the opus codec is causing some compression or adjustment. You could manually mangle the SDP offer to use CBR (constant bitrate) instead of VBR (variable bit rate). When you get the SDP offer from the browser, change the line:

a=fmtp:111 minptime=10; useinbandfec=1

to:

a=fmtp:111 minptime=10; cbr=1

Note that I'm both addingcbr=1 and removinguseinbandfec=1. I'm not positive that dropping useinbandfec is necessary, but it seems that in-band FEC (forwarding error correction) causes compression adjustment which you'd want to avoid as well.

Solution 2:

This is the updated way to disable audio processing and get a clean signal:

navigator.mediaDevices.getUserMedia({audio: {
    autoGainControl:false,
    channelCount:2,
    echoCancellation:false,
    latency:0,
    noiseSuppression:false,
    sampleRate:48000,
    sampleSize:16,
    volume:1.0
  }
});

If you are streaming audio via WebRTC, it defaults to radio or phone quality audio optimized for voice. So make sure your SDP has stereo and maxaveragebitrate params:

a=fmtp:111 minptime=10;useinbandfec=1; stereo=1; maxaveragebitrate=510000

Post a Comment for "Webrtc - Disable All Audio Processing"