WebRTC Force Stereo in Chrome by editing the sdp config

47
September 23, 2021, at 08:40 AM

I'm trying to implement a workaround for what appears to be a known issue in all browsers but firefox where webRTC audio stream is downgraded to mono from stereo.

This seems to happen due to the local session description defaulting to stereo=0 in the negotiated sdp config file which is produced based on the stream's constraints.

I have included the following constraints:

    audio: { deviceId: audioSource ? { exact: audioSource } : undefined,
      channelCount:2, 
      echoCancellation: false, // disabling audio processing
      googAutoGainControl: false,
      googNoiseSuppression: false,
      googHighpassFilter: false
    },

and then I attempt to append the required fix to the sdp file before setting local description using a process called SDP munging https://webrtcglossary.com/sdp-munging/:

  peerConnection
    .createOffer({ offerToReceiveAudio: true, offerToReceiveVideo: false })
    .then( desc => desc.sdp=desc.sdp.replace('useinbandfec=1','useinbandfec=1; stereo=1'))
    .then(desc => peerConnection.setLocalDescription(desc))
    .then(() => socket.emit("offer", id, peerConnection.localDescription));

the error I receive :

broadcast.js:53 Uncaught (in promise) TypeError: Failed to execute 'setLocalDescription' on 'RTCPeerConnection': The provided value is not of type 'RTCSessionDescriptionInit'.

This fix was recommended by a number of sources on this topic but any time I attempt to modify the file prior to setting the local description I get a type error that it is no longer an RTCSessionDescription

I am hoping I am performing the SDP munging incorrectly and that there is a better way to go about this

READ ALSO
get origin url of 301/302 Forward in PHP/Javascript

get origin url of 301/302 Forward in PHP/Javascript

I have a small question: From different Domains I'm forwarding via 301/302 to one distinct target domainOn the target Server I have a running apache

40
Puppeteer page.$$ returns empty array

Puppeteer page.$$ returns empty array

I'm working on a simple scrapper but I can't get past this issueIt returns an empty array everytime I run it, however the site does contain the elements and returns a NodeList when I run querySelectorAll on the console

54
How can I obtain the date based on geographical coordinates? (JavaScript)

How can I obtain the date based on geographical coordinates? (JavaScript)

I am making a weather application, and I have a simple P-tag which is populated with the date using JavaScript:

14
Put every character in a sentence into a vector?

Put every character in a sentence into a vector?

I started coding a couple months ago and I can't figure out how to work out this problemHere is what is asked

65