versatica / libmediasoupclient

mediasoup client side C++ library

Home Page:https://mediasoup.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Audio only plays back through the left channel (works fine in Chrome and vanilla C++ libwebrtc app)

maxweisel opened this issue · comments

Heyo,

I've got a weird one that I can't seem to track down. When using libmediasoupclient, audio always plays back exclusively through the left channel. Both Chrome and my native C++ libwebrtc app that manually establishes the PeerConnection play back correctly.

My libmediasoupclient application and my vanilla C++ libwebrtc app link against the same static library for libwebrtc so there's no discrepancy there. I've looked through libmediasoupclient and I can't seem to figure out what it could be doing in order to cause audio to only play from the left channel. I pass a custom PeerConnectionFactory, but I use the same code to create it in both native applications.

Max

Not a libmediasoupclient issue. You may need to create your own PeerConnection factory instead of letting libwebrtc choose a default one based on OS, and libmediasoupclient let you pass such a factory.

I pass a custom PeerConnectionFactory, but I use the same code to create it in both native applications.

I am already doing this. I use the same PeerConnectionFactory in both versions.

Any chance I can get this re-opened? I really think this is a bug in libmediasoupclient (or possibly the C++ sdptransform implementation). It seems SDP shows this as a mono stream, but it gets turned into a stereo one before being handed to the PeerConnection.

Thanks for the suggestion! Just gave that a shot,and I can see it showing up in the rtpParameters for the consumer on the client, but I'm still getting left-channel only whether the producer is Chrome or another libmediasoupclient client. Interestingly I now see that the stream is stereo before and after sdptransform does its thing, but still no change in output.

Do you use the built-in AudioDeviceModule? or something custom? I'm wondering if the built-in one for macOS has issues with stereo opus streams, or possibly it's treating a mono stream as stereo. I couldn't find any leads on the webrtc discuss group so I find it hard to believe it's the AudioDeviceModule. Will keep digging and report back.

Max

Still not entirely sure, but I can now replicate the bug without libmediasoupclient. I think @ibc is right here. I'll start with the AudioDeviceModule and work my way back up. Thanks for the help @mstarich!

Making stereo work is not easy in libwebrtc and Chrome. Cooperation of both sender and receiver is needed. However mediasoup-client and libmediasoupclient provide with OPUS options in the produce() APo for stereo to work. You just need to enable it in sender side (better than in server side). Then consume as usual in your C++ app and check the remote SDP and local SDP to verify that there is stereo=true in opus fmpt line. This has been tested.

Then, whether libwebrtc will play stereo or not that's another story unfortunately.

Thanks for the info! I was actually able to hunt this one down and it was entirely within AudioDeviceModule on the Mac. My libmediasoupclient application was bound to a 4-channel interface, AudioDeviceModule didn't know how to interpret it and mixed everything down to a single channel. My vanilla C++ libwebrtc app was bound to a 2-channel interface and worked as expected.

I suspect Chrome works because it doesn't use the built-in AudioDeviceModule and has different code for handling audio interfaces with more than 2 channels =S