Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a "fake" AudioDeviceModule #287

Closed
wants to merge 1 commit into from

Conversation

markandrus
Copy link
Member

@markandrus markandrus commented Aug 23, 2016

This is just one possible approach for improving #285. As mentioned in that issue, on platforms that provide neither PulseAudio nor ALSA, the default AudioDeviceModule will fail. One work around is to use FakeAudioDevice (I've confirmed that this succeeds on the aforementioned platforms). Before merging, I think it makes sense to

  • Test with FakeAudioCaptureModule (this was not originally working for me, but I've since updated libwebrtc.a—so maybe it will work again).
  • Test with audio MediaStreamTracks (make sure passing "/dev/null" to the FakeAudioDevice isn't an issue)
  • Create a plan for choosing between AudioDeviceModule implementations, e.g.
const wrtc = require('wrtc');
const pc = new wrtc.RTCPeerConnection({
  audioDeviceModule: 'fake',  // or, 'default'
  iceServers: []
});
  • Still need to do the nullptr check on the return value of CreatePeerConnectionFactory.

@manuguerra
Copy link
Contributor

I tried the changes, and they indeed fix the issue I was seeing on a system that doesn't have alsa (I also had to build libwebrtc using include_pulse_audio=0 to fix the XOpenDisplay issue). I noticed an assert error when running the debug build, but the release version is fine.

The problem that I've noticed is high CPU usage; with FakeAudioDevice, each connection seems to be using about 3 times as much CPU than when using ALSA.

@markandrus
Copy link
Member Author

I tried the changes, and they indeed fix the issue I was seeing on a system that doesn't have alsa

Awesome 👍

The problem that I've noticed is high CPU usage; with FakeAudioDevice, each connection seems to be using about 3 times as much CPU than when using ALSA.

Ah, that's unfortunate. We could also try with FakeAudioCaptureModule. It's API is something like

rtc::scoped_refptr<FakeAudioCaptureModule> facd = FakeAudioCaptureModule::Create();

It might be lighter weight. If we still run into these issues I suppose we could always write an AudioDeviceModule that really does nothing...

@manuguerra
Copy link
Contributor

I'll try using the FakeAudioCapture later. I also like the idea of writing our own super lightweight AudioDeviceModule, decoupled from the Chromium tests.
In the meantime, I'm sticking to ALSA and pointing LD_LIBRARY to a 'transplanted' libasound.

@vikeshkhanna
Copy link

I have confirmed that, with this change, RTCPeerConnection can be created from within a Docker container. Without this change, the constructor hangs indefinitely at the factory call. Thanks @markandrus!

vikeshkhanna added a commit to AmbientAI/node-webrtc that referenced this pull request Jul 19, 2017
oklas pushed a commit to oklas/node-webrtc that referenced this pull request Sep 4, 2017
@schuyler1d
Copy link

This also fixed building for me on Ubuntu trusty 14.04

@markandrus
Copy link
Member Author

I'm going to try to land a version of this as part of #333.

@markandrus markandrus closed this Nov 21, 2017
@markandrus markandrus deleted the fake_audio_device branch November 21, 2017 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants