stereo output support on Chrome and firefox

1,488 views
Skip to first unread message

Ron Sharp

unread,
Apr 13, 2018, 2:46:10 AM4/13/18
to discuss-webrtc
I need to send stereo OPUS audio to a webrtc client and have it output to a stereo headset. Is this possible at this time?
I have changed the sdp to support stereo and I have turned echoCancellation off but all I get is mono. Has anyone done
this and if so how? Thanks very much.

Ron

Chris M

unread,
Apr 16, 2018, 11:08:35 AM4/16/18
to discuss-webrtc
Hi Ron, I have been using WebRTC stereo sound for several years using the RTCMultiConnection library in Chrome on Windows machines.  I'm sure it must be possible with other libraries as well.

 Chris

Ron Sharp

unread,
Apr 18, 2018, 5:47:53 AM4/18/18
to discuss...@googlegroups.com
Thanks Chris, that is great to hear. I went to the RTCMultiConnection demo site and tried using my Logitech 920 which has stereo mics 
to connect to another computer that has a headset and did not get stereo. Did you have to set anything special or should it just work?
What mic setup do you use to record stereo? Again, thanks. Appreciate the time.

Ron

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/8bb90fd6-5c0c-4315-8eec-0cac408559cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris M

unread,
Apr 18, 2018, 1:33:17 PM4/18/18
to discuss-webrtc
Hi Ron, I use the mics built into the Logitech C930e.    Here is the code I currently use (BandwidthHandler.setOpusAttributes seems to be the key to getting stereo working):

<script src="/dev/RTCMultiConnection.js"></script>
<script src="/dev/WebSocketConnection.js"></script>
<script src="/dev/CodecsHandler.js"></script>
<script src="/dev/getStats.js"></script>
<script src="/dev/CodecsHandler.js"></script>


<script>
var connection = new RTCMultiConnection();


connection.setCustomSocketHandler(WebSocketConnection);
connection.channel = "LocalRoomTest2";

// if you want audio+video conferencing
connection.session = {
    audio: true,
    video: true,
    data: true
};


connection.DetectRTC.load(function() {
    // you can access all microphones using "DetectRTC.audioInputDevices"
    connection.DetectRTC.audioInputDevices.forEach(function(device) {
        var option = document.createElement('option');
        console.log("audio: " + device.id + " " + device.label);
    });

    connection.DetectRTC.videoInputDevices.forEach(function(device) {
        console.log("video: " + device.id + " " + device.label);
    });
});

connection.mediaConstraints = {
            "data": true,
            "audio": {
                mandatory: {
                    echoCancellation: false, // disabling audio processing
                    googAutoGainControl: false,
                    googNoiseSuppression: false,
                    googHighpassFilter: false,
                    googTypingNoiseDetection: false,
                },
                optional: []
            },
            "video": {
                mandatory: {
                    "minWidth": "1280",
                    "minHeight": "720",
                    "minFrameRate": "30",
                    "maxWidth": "1280",
                    "maxHeight": "720",
                    "maxFrameRate": "30"
                },
                
            }
        };


    var BandwidthHandler = connection.BandwidthHandler;
    connection.bandwidth = {
        audio: 128,
        video: 2000
    };
    connection.processSdp = function(sdp) {
        sdp = BandwidthHandler.setApplicationSpecificBandwidth(sdp, connection.bandwidth, !!connection.session.screen);
        sdp = BandwidthHandler.setVideoBitrates(sdp, {
            min: connection.bandwidth.video,
            max: connection.bandwidth.video
        });


        sdp = CodecsHandler.preferCodec(sdp, "h264");


        sdp = BandwidthHandler.setOpusAttributes(sdp, {
            'stereo': 1,
            //'sprop-stereo': 1,
            'maxaveragebitrate': connection.bandwidth.audio * 1000 * 8,
            'maxplaybackrate': connection.bandwidth.audio * 1000 * 8,
            //'cbr': 1,
            //'useinbandfec': 1,
            // 'usedtx': 1,
            'maxptime': 3
        });


        return sdp;
    };

 

connection.leaveOnPageUnload = true;
connection.autoCloseEntireSession = true;


connection.onmessage = function(e) {
        console.log(e);
       };


connection.getExternalIceServers =false;
connection.userid = 'user1';
connection.open('special2');

</script>






On Wednesday, April 18, 2018 at 2:47:53 AM UTC-7, Ron Sharp wrote:
Thanks Chris, that is great to hear. I went to the RTCMultiConnection demo site and tried using my Logitech 920 which has stereo mics 
to connect to another computer that has a headset and did not get stereo. Did you have to set anything special or should it just work?
What mic setup do you use to record stereo? Again, thanks. Appreciate the time.

Ron
On Mon, Apr 16, 2018 at 11:08 AM, Chris M <spectr...@gmail.com> wrote:
Hi Ron, I have been using WebRTC stereo sound for several years using the RTCMultiConnection library in Chrome on Windows machines.  I'm sure it must be possible with other libraries as well.

 Chris


On Thursday, April 12, 2018 at 11:46:10 PM UTC-7, Ron Sharp wrote:
I need to send stereo OPUS audio to a webrtc client and have it output to a stereo headset. Is this possible at this time?
I have changed the sdp to support stereo and I have turned echoCancellation off but all I get is mono. Has anyone done
this and if so how? Thanks very much.

Ron

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Ron Sharp

unread,
Apr 20, 2018, 10:17:34 AM4/20/18
to discuss...@googlegroups.com
Thanks so much Chris. All is well now. I was able to look at the RTCMultiConnection code and figure out what I needed
to do. For anyone else looking to support stereo out with WebRTC here is what you need to do:

1. When you do the getUserMedia() be sure to include for audio "{channelCount:2, echoCancellation: false}". 
2. Next after your call to createOffer (or createAnswer) and prior to your call to setLocalDescription you need to
    modify the sdp file. Find and add "; stereo=1; sprop-stereo=1" to the a=fmtp line describing opus.

That should do it. If you are receiving stereo (not generating it) there is nothing to do, it should just work.

Ron

To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/8ce5290a-e176-4218-808b-7a85d2f8a7cd%40googlegroups.com.

HostBBB.com

unread,
Oct 21, 2018, 3:28:20 AM10/21/18
to discuss-webrtc
Does anyone have a working inplementation of Chrome playing a stereo webrtc source currently.

https://bugs.chromium.org/p/webrtc/issues/detail?id=8133

Our sip.js solution died version chrome 62 in August 2017.

Thanks
Stephen
Reply all
Reply to author
Forward
0 new messages