Bug 260620 - www/firefox: audio delay on Youtube with media.cubeb.backend="oss"
Summary: www/firefox: audio delay on Youtube with media.cubeb.backend="oss"
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Hans Petter Selasky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-22 21:35 UTC by Denis Shaposhnikov
Modified: 2021-12-31 10:01 UTC (History)
3 users (show)

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


Attachments
Patch for cubeb_oss.c (2.26 KB, patch)
2021-12-25 12:08 UTC, Hans Petter Selasky
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Shaposhnikov 2021-12-22 21:35:26 UTC
Hi!

I noticed it yesterday on Youtube, that every video has an audio delay about a second or two. In about:config I have media.cubeb.backend="oss". After changing it to "sndio" all videos play fine, without audio delay. May be this commit is the reason of my issue:

www/firefox: Fix for jitter when using the cubeb OSS audio backend.
https://cgit.freebsd.org/ports/commit/www/firefox?id=abed228812efb91cc436eb0a6d750803396fc43c
Comment 1 Hans Petter Selasky freebsd_committer freebsd_triage 2021-12-25 10:59:25 UTC
It might be that youtube specifies a too big latency parameter. We only have a minimum value there.

I'll try to narrow it down after X-mas.

--HPS
Comment 2 Hans Petter Selasky freebsd_committer freebsd_triage 2021-12-25 12:08:11 UTC
Created attachment 230389 [details]
Patch for cubeb_oss.c

Hi,

Can you try this not-tested nor compiled patch.
cd /usr/ports/www/firefox
make extract patch
cat cubeb_oss.diff | patch work/firefox-95.0.2/media/libcubeb/src/cubeb_oss.c
make all reinstall

--HPS
Comment 3 Denis Shaposhnikov 2021-12-25 17:36:15 UTC
(In reply to Hans Petter Selasky from comment #2)
Hi,

I can confirm this patch works. No audio delays on youtube after applying it.
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-12-31 10:00:57 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c6218ed826128b021740bbd416ab4e0eb35fc108

commit c6218ed826128b021740bbd416ab4e0eb35fc108
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-12-27 09:35:09 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2021-12-31 10:00:02 +0000

    www/firefox: Force 32 ms service intervals at most for the CUBEB OSS backend.

    Sometimes a big buffer may be specified by CUBEB. Feed big buffers in smaller
    chunks to avoid issues with the audio flow. Other CUBEB audio backends
    apparently do the same.

    Fixes audio out of sync for youtube videos.

    The need for this patch will eventually go away as the changes are upstreamed.

    PR:          260620
    Approved by: pi (implicit)

 www/firefox/Makefile                               |  1 +
 .../files/patch-media_libcubeb_src_cubeb__oss.c    | 59 +++++++++++++---------
 2 files changed, 37 insertions(+), 23 deletions(-)
Comment 5 Hans Petter Selasky freebsd_committer freebsd_triage 2021-12-31 10:01:25 UTC
Close this issue for now.