Bug 257639 - www/firefox: broken mic in WebRTC in 91.0
Summary: www/firefox: broken mic in WebRTC in 91.0
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-gecko (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-05 15:43 UTC by VVD
Modified: 2021-09-14 16:58 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (gecko)


Attachments
v1 (use "git am") (49.59 KB, patch)
2021-09-08 19:26 UTC, Evgeniy Khramtsov
evgeniy: maintainer-approval?
Details | Diff
v2 (use "git am") (26.24 KB, patch)
2021-09-09 17:45 UTC, Evgeniy Khramtsov
evgeniy: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description VVD 2021-08-05 15:43:24 UTC
12.2-p9 amd64.

Work fine in versions 90 and prior, but totally broken in 91.
Tested in Discord, Jitsi, Nextcloud Talk.

My suggestion is to revert last update before it fixed.
Comment 1 VVD 2021-08-05 18:07:50 UTC
        ALSA           : off
        CANBERRA       : off
        DBUS           : off
        DEBUG          : off
        FFMPEG         : on
        JACK           : off
        LIBPROXY       : on
        LTO            : off
        OPTIMIZED_CFLAGS: on
        PROFILE        : off
        PULSEAUDIO     : off
        SNDIO          : off
        TEST           : off

about:support show sound system oss.
Comment 2 Jan Beich freebsd_committer 2021-08-05 21:32:01 UTC
I don't have a microphone to confirm but rebuild with default options to try other audio backends as decribed in pkg-message. Of available backends on FreeBSD upstream only tests "pulse-rust" while the rest are up to their respective communities.

Sometimes running unit tests helps expose bugs e.g.,

$ pkg install cmake ninja git
$ git clone https://github.com/mozilla/cubeb
$ cmake -G Ninja -S cubeb -B cubeb_build
$ cmake --build cubeb_build
$ CUBEB_BACKEND=oss ctest --test-dir cubeb_build
Comment 3 VVD 2021-08-05 22:02:58 UTC
Downgrade to 90.0.2 fixed issue.
So it's definitely is regression in 91.0.

With pulse my system doesn't work.
Comment 4 VVD 2021-08-06 14:27:18 UTC
(In reply to Jan Beich from comment #2)
https://github.com/mozilla/cubeb/blob/master/INSTALL.md
    git clone --recursive https://github.com/kinetiknz/cubeb.git
    mkdir cubeb-build
    cd cubeb-build
    cmake ../cubeb
    cmake --build .
    ctest

========================================================================

$ ctest 
Test project /tmp/cubeb-build
      Start  1: sanity
 1/13 Test  #1: sanity ...........................   Passed   18.90 sec
      Start  2: tone
 2/13 Test  #2: tone .............................   Passed    5.04 sec
      Start  3: audio
 3/13 Test  #3: audio ............................   Passed   15.39 sec
      Start  4: record
 4/13 Test  #4: record ...........................   Passed    0.51 sec
      Start  5: devices
 5/13 Test  #5: devices ..........................   Passed    0.01 sec
      Start  6: callback_ret
 6/13 Test  #6: callback_ret .....................   Passed    0.97 sec
      Start  7: resampler
 7/13 Test  #7: resampler ........................   Passed    2.94 sec
      Start  8: duplex
 8/13 Test  #8: duplex ...........................***Failed    1.52 sec
      Start  9: latency
 9/13 Test  #9: latency ..........................   Passed    0.00 sec
      Start 10: ring_array
10/13 Test #10: ring_array .......................   Passed    0.00 sec
      Start 11: utils
11/13 Test #11: utils ............................   Passed    0.00 sec
      Start 12: ring_buffer
12/13 Test #12: ring_buffer ......................   Passed    1.43 sec
      Start 13: device_changed_callback
13/13 Test #13: device_changed_callback ..........   Passed    0.01 sec

92% tests passed, 1 tests failed out of 13

Total Test time (real) =  46.74 sec

The following tests FAILED:
          8 - duplex (Failed)
Errors while running CTest
Output from these tests are in: /tmp/cubeb-build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.

========================================================================

$ ctest --rerun-failed --output-on-failure
Test project /tmp/cubeb-build
    Start 8: duplex
1/1 Test #8: duplex ...........................***Failed    1.56 sec
Running main() from gtest_main.cc
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from cubeb
[ RUN      ] cubeb.duplex
stream started
stream stopped
[       OK ] cubeb.duplex (524 ms)
[ RUN      ] cubeb.duplex_collection_change
/tmp/cubeb/test/test_duplex.cpp:156: Failure
Value of: CUBEB_OK
  Actual: 0
Expected: r
Which is: -4
Error initializing cubeb stream
[  FAILED  ] cubeb.duplex_collection_change (0 ms)
[ RUN      ] cubeb.one_duplex_one_input
stream started
stream started
stream stopped
stream stopped
[       OK ] cubeb.one_duplex_one_input (1029 ms)
[----------] 3 tests from cubeb (1553 ms total)

[----------] Global test environment tear-down
[==========] 3 tests from 1 test case ran. (1553 ms total)
[  PASSED  ] 2 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] cubeb.duplex_collection_change

 1 FAILED TEST


0% tests passed, 1 tests failed out of 1

Total Test time (real) =   1.56 sec

The following tests FAILED:
          8 - duplex (Failed)
Errors while running CTest
Comment 5 Aleksandr Konkov 2021-08-13 10:17:36 UTC
I confirm the problem with microphone.

FreeBSD 13.0-STABLE #0 stable/13-n246228-47c5e288eee
Firefox buuild options:
        ALSA           : off
        CANBERRA       : off
        DBUS           : off
        DEBUG          : off
        FFMPEG         : on
        JACK           : off
        LIBPROXY       : off
        LTO            : off
        OPTIMIZED_CFLAGS: on
        PROFILE        : off
        PULSEAUDIO     : off
        SNDIO          : off
        TEST           : off

about:support show:
- sound system: oss
- input device: /dev/dsp0: Realtek ALC256 (Analog 2.0+HP/2.0) -> Enabled
Comment 6 VVD 2021-08-24 21:46:28 UTC
91.0.2 still broken.
Comment 7 Thibault Payet 2021-09-02 17:29:22 UTC
The duplex test failed because cubeb oss backend does not implement:

register_device_collection_changed (which I guess is used when a new device is added during a webrtc call, like adding a new sound card I guess ?).
Comment 8 Evgeniy Khramtsov 2021-09-02 18:10:14 UTC
Can you bisect?

FIREFOX_BETA_91_BASE: https://hg.mozilla.org/mozilla-central/rev/5dee15cf3f2810ccc3bb9ec24c652f6f9d72b62d
FIREFOX_BETA_90_BASE: https://hg.mozilla.org/mozilla-central/rev/fafcc4a3b16a3b45f7abcc174e46bdc4a46888ca

Use "git am":
https://codeberg.org/ei/ports/commit/127e276.patch (revert)
https://codeberg.org/ei/ports/commit/c0cd4b4.patch (revert)
https://codeberg.org/ei/ports/commit/7c85f1a.patch (revert)
https://codeberg.org/ei/ports/commit/f02827e.patch (speed up build)
https://codeberg.org/ei/ports/commit/3b85790.patch (switch to tags)

Bisect by overriding DISTNAME with mozilla-central tags; do 'make makesum'
to update distinfo, and build tags until you find first good and bad tags.
You likely will not need to update patches in files/, and any updates are
likely to be minor (rebase due to line number change, etc). CCACHE can be
used, but I've never tried this and don't know if it works:
https://reviews.freebsd.org/D14154

Go down from FIREFOX_BETA_91_BASE to FIREFOX_BETA_90_BASE using binary search.
I don't remember hg good enough to paste commands to automate searching, and
I can't bisect this myself due to custom setup.
Comment 9 Evgeniy Khramtsov 2021-09-02 21:31:23 UTC
(In reply to Evgeniy Khramtsov from comment #8)

Forgot to revert to old rust: https://codeberg.org/ei/ports/commit/25e9c02.patch
and add "patch-bug1628567" when you get closer to 90: https://cgit.freebsd.org/ports/commit/?id=2d661b18
Comment 10 Evgeniy Khramtsov 2021-09-08 16:19:27 UTC
(In reply to Evgeniy Khramtsov from comment #8)

Issue reproduced. Soon (today to tomorrow) to be bisected; I found a few suspected changesets. Leaving this note here so nobody wastes CPU cycles.
Comment 11 Evgeniy Khramtsov 2021-09-08 19:26:34 UTC
Created attachment 227770 [details]
v1 (use "git am")

Regressed by upstream bug 1702646:
https://bugzilla.mozilla.org/show_bug.cgi?id=1702646

1702646 also broke Bluetooth speakers on Linux and related upstream bug is 1725810:
https://bugzilla.mozilla.org/show_bug.cgi?id=1725810

Upstream fixes proposed in 1725810 do not apply to Firefox 92; it is marked as "wontfix". Nightly channel now has fixes, but it is yet unknown if they can help until I build a tip of mozilla-central to confirm.

I opted to revert bug 1702646 wholly until this is fixed upstream. I didn't revert 1702646 partly because I am not sure if this will cause a regression.

Next I will (likely tomorrow) try to confirm if Nightly is also affected and report back here. I will also try to revert 1702646 partially to see if it helps / which part of 1702646 affects www/firefox.

I tested WebRTC microphone via https://codepen.io/rhamses/pen/BaNgxNz. The known to me sites do not work with IPv6-only kernel and network.

I don't know how to properly use and file PRs to Mozilla's Bugzilla. Can @gecko help me this time until I figure it out on my own later?

Can anyone else confirm that v1 helps? If is it not possible for you to build www/firefox due to OOM, etc, then ask, I will try to build a binary package later.
Comment 12 Evgeniy Khramtsov 2021-09-09 17:45:52 UTC
Created attachment 227789 [details]
v2 (use "git am")

Nightly (51552aef09e0712581a66a651ec7636bb3507afe) is not affected.

1f* is the first bad changeset, it cannot be reverted alone cleanly,
v2 instead reverts commits up to it but not to 81* (i.e. Use NativeInputTrack
remains):
https://github.com/mozilla/gecko-dev/compare/19785b8...0a9065018

Both v1 and v2 work here, but v2 reverts 1702646 partially and has less lines.
Comment 13 Evgeniy Khramtsov 2021-09-14 16:58:44 UTC
(In reply to Evgeniy Khramtsov from comment #12)

Can anyone test with a microphone? I also built binary packages against the main ports branch, if you prefer them:

https://codeberg.org/ei/misc/raw/branch/main/firefox/122-amd64-firefox-92.0_3,2.pkg
https://codeberg.org/ei/misc/src/branch/main/firefox/130-amd64-firefox-92.0_3,2.pkg