Closed Bug 1332887 Opened 8 years ago Closed 8 years ago

Webrtc microphone not found with Dell XPS 13 Linux 9350

Categories

(Core :: Audio/Video: cubeb, defect, P2)

50 Branch
x86_64
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 1337328

People

(Reporter: sbird4, Assigned: achronop)

References

Details

Attachments

(5 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0 Build ID: 20161209093710 Steps to reproduce: Visit https://test.webrtc.org/ on a Dell XPS 13 9350 running Ubuntu 16.10 (using gnome 3.22). Actual results: Prompt appears to share camera, and camera tests pass, but no microphone is found and the microphone test fails. Expected results: Prompt appears to share microphone, and microphone test passes. I have checked that the same thing happens for firefox 52, the current developer edition, and that it happens with both wayland and x11. I also tried a clean firefox profile. Multiprocess windows are enabled, but disabling does not change behaviour. The test passes correctly in chrome and pulseaudio correctly uses the microphone. Any help debugging would be appreciated - I am willing to use gdb or strace.
Component: Untriaged → WebRTC: Audio/Video
OS: Unspecified → Linux
Product: Firefox → Core
Hardware: Unspecified → x86_64
Flags: needinfo?(achronop)
It would be useful to capture some traces/logs with the latest Nightly version of firefox. In order to do that download Nightly. export the following env var before run it, and run it. export MOZ_LOG=cubeb:4 ./path/to/nightly/firefox Logs will appear on screen (stdout), please copy and paste them to a file and attach them here.
Flags: needinfo?(achronop)
Log attached - the card printed is I think the correct output device.
I see that your microphone is reported correctly by the audio backend. Can you please capture more logs for me? Using the Nightly activate the env as follow: export MOZ_LOG=timestamp,cubeb:4,GetUserMedia:4 Moreover I would like take logs from the following test page: https://mozilla.github.io/webrtc-landing/gum_test.html using the Audio option.
The output printed on the audio section of https://mozilla.github.io/webrtc-landing/gum_test.html is: "getUserMedia Test Page Main webrtc demo page NotFoundError: The object can not be found here." and the attached log is printed to console. Looks like the default input device is returning -1 for some reason?
Your input devices are reported as disabled: state 0x0. In a working scenario it is reported as enabled: state 0x2 Firefox get the state information from pa_context_get_source_info_list() PulseAudio api call checking the field pa_source_info::active_port::available. Can you please verify if your device is not enabled and why?
As far as I know it is enabled - I tried toggling mute in pulseaudio's settings and that didn't make a difference. And as I said, it works in chrome. http://0pointer.de/lennart/projects/pulseaudio/doxygen/introspect_8h_source.html suggests that pa_source_info::active_port (type pa_source_port_info) has name, priority and description fields, but no available field. Do you really mean pa_source_info::active_port::available?
This is https://github.com/kinetiknz/cubeb/issues/149 I confirm that setting media.navigator.audio.full_duplex = false in about:config fixes the problem.
Looking at media/libcubeb/src/cubeb_pulse.c, I think it is not correct that firefox is checking pa_source_info::active_port::available - if pa_source_info::active_port::available == PA_PORT_AVAILABLE_NO it returns CUBEB_DEVICE_STATE_UNPLUGGED, which is 0x1. Instead it is returning 0x0, which is CUBEB_DEVICE_STATE_DISABLED, implying that pa_source_info::active_port is NULL. I think checking for active_port == NULL is the wrong thing to do, as it just means that the device is inactive, ie, asleep, no? Would a better check be pa_source_info::n_ports > 0, and then using pa_source_info::ports[0]? Chrome ( see chromium/media/audio/pulse/audio_manager_pulse.cc:315) just calls pa_context_get_source_info_list and adds all found devices to the audio manager's backend, which seems the most reliable option.
Yeah, maybe is wrong to check the active_port for availability. I will try to work with PulseAudio developers to see if your suggestion or something else is better. In the mean time I will make a quick build to return enable when there is no active port. Can you do a few test for me with that build to verify that it works well?
Status: UNCONFIRMED → NEW
Ever confirmed: true
My first suggestion won't work, actually. For this laptop, n_ports is always zero. I can check this with pacmd list-sinks. I'm happy to test a build for you.
When the build is ready I will copy the link for the binaries here: https://treeherder.mozilla.org/#/jobs?repo=try&revision=2a0ef5e3773762566fd83212c42627fcd6c2be3b
Assignee: nobody → achronop
Status: NEW → ASSIGNED
Rank: 25
Component: WebRTC: Audio/Video → Audio/Video: cubeb
Priority: -- → P2
Hm. That build produces the exact same result. Guess I was wrong about the cause of the bug.
Did you capture new logs?
I did, but they were exactly the same as the last ones
I noticed that a standalone checkout of the cubeb git has the following test output: % ./test_record Running main() from gtest_main.cc [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from cubeb [ RUN ] cubeb.record there are input devices, but they are not available, skipping [ OK ] cubeb.record (4 ms) [----------] 1 test from cubeb (4 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (4 ms total) [ PASSED ] 1 test. but with a similar patch to the one discussed above I get the (better): % ./test_record Running main() from gtest_main.cc [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from cubeb [ RUN ] cubeb.record stream started stream stopped [ OK ] cubeb.record (534 ms) [----------] 1 test from cubeb (534 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (534 ms total) [ PASSED ] 1 test. Are you sure the build included the correct patch?
This patch fixes the cubeb test cases for me.
(In reply to sbird4 from comment #18) > Created attachment 8832690 [details] [diff] [review] > Proposed patch to cubeb git for pulse audio ports. > > This patch fixes the cubeb test cases for me. I can submit it as a github pull request if you prefer
Wait a minute, this is what I did in the custom build created for you BUT I did it just for sink. I should have done it for source as well. I am pushing a new build to test. I'll post the link here when it is ready.
That one works!
Do you get the prompt which ask for permissions and all your device (if you have more than one) are reported correctly?
I do - I also checked that the audio tests on gum and test.webrtc.org work.
The only thing that is not perfect is that firefox picks the 'microphone monitor' device as the default one, rather than the real microphone. But I have no idea how to avoid that - I can't see anything in the pulse output that distinguishes that, except that the alsa properties contain 'device.class=monitor' and I don't know if that is universal.
Cool, I will land it soon, thanks for your co-operation. BTW, since you helped a lot, if you want to put your name on it, create a PR against me in cubeb repo. This is the final version of the patch: https://hg.mozilla.org/try/rev/5af04325788caf8c3bfbbcb17651850174469ee0 (note the patch above is from Firefox repo not cubeb where the PR will be created)
This is the default device set in your sound settings. If you execute the test: test_devices you will get the full list of the audio devices for your system. The devices which have state enabled will be added in the list. The one that is reported as PREFERRED is the default. By changing your laptop audio settings you can change the default device.
See Also: → 1307089
PR in cubeb repo.
Thanks, I'm happy for you to commit it. test_devices shows the correct device as PREFERRED - I don't know why firefox chooses the wrong one.
Sorry you cannot commit it now, I have started pushing it, I found some automated tests error that need to be fixed along with that patch. I will be happy to help you an other commit if you want to get involved. About the new issue, can you post new logs to check it out?
Here are the new logs - notice that cubeb correctly labels the PREFERRED device as the one which isn't the monitor, but then picks -1 as the default later.
I pushed a new commit in cubeb repo about the preferred device error.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: