Closed Bug 1467882 Opened 6 years ago Closed 6 years ago

fix volume handling in sndio backend

Categories

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

Unspecified
OpenBSD
enhancement

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: gaston, Assigned: gaston)

References

Details

Attachments

(1 file)

filing this one on behalf of alexandre, from https://marc.info/?l=openbsd-ports&m=152641946326955&w=2:

=====
Maybe you've noticed that somtimes sound volume in firefox doesn't
match the volume indicator until you touch it.

This is because the firefox audio API has no volume getter and assumes
the initial volume is 1, while sndio saves volumes and allows volume
to be controlled externally, which makes firefox use a wrong
representation of the actual volume.

The workaround is to do like alsa, pulseaudio and other backends: stop
using the native volume control and adjust the volume of the signal in
firefox.
=====

patch has been successfully tested by a bunch of users on OpenBSD - testing on Linux w/ sndio TBD..
Attached patch bug-1467882Splinter Review
I know i should do a PR in https://github.com/kinetiknz/cubeb/ but at least it's tracked in bugzilla, and i have some hope it gets to m-c at some point :) Can do it too if preferred..
Assignee: nobody → landry
Attachment #8984568 - Flags: review?(padenot)
(In reply to Landry Breuil (:gaston) from comment #1)
> I know i should do a PR in https://github.com/kinetiknz/cubeb/ but at least
> it's tracked in bugzilla, and i have some hope it gets to m-c at some point
> :) Can do it too if preferred..

I'm afraid it's necessary to land it in github repo first. However, it might be faster since github gets the attention of more people. Moreover, you don't have to worry about this bug, once it is landed in github we take care the rest. I promise, the import to m-c will take place soon after the landing.
Testing this patch at runtime resulted in the initial volume (for the first start) in sndio to be zero, and the client being muted, while the controls in firefox showed it unmuted and at max volume. fixed by toggling mute/putting the volume at 100% via aucatctl, but im not sure this is the expected behaviour.
Flags: needinfo?(alex)
It seems the audio controls in sndio and in firefox are completely disconnected from each other - dunno if that's the core of the global issue...
The patch has been merged in github repo and I could import it but I see that you are describing a problem and I wonder if this is ready. Do you need additional patches to fix it completely?
Rank: 18
Priority: -- → P2
I am copying here the answer from Alexander Ratchov. It seems he has an issue with his bugzilla account and he cannot post directly.

------------
Sorry, my bugzilla account is still disabled, meanwhile I reply by
e-mail to comments in the ticket:

Note https://bugzilla.mozilla.org/show_bug.cgi?id=1467882#c3 :
>
> Testing this patch at runtime resulted in the initial volume (for
> the first start) in sndio to be zero, and the client being muted,
> while the controls in firefox showed it unmuted and at max
> volume. fixed by toggling mute/putting the volume at 100% via
> aucatctl, but im not sure this is the expected behaviour.

Currently firefox volume knob adjusts the system volume, which is
persistent. The patch makes firefox adjust the volume of the signal
it's playing, then, the system applies its own the volume setting to
the result.

Landry, I guess, your system volume was set to 0, probably by a
previous (unpatched) instance of firefox. As the patched firefox
doesn't use the system volume control anymore, the system volume
remained to zero no matter firefox knob position.

Note https://bugzilla.mozilla.org/show_bug.cgi?id=1467882#c4 :
>
> It seems the audio controls in sndio and in firefox are completely
> disconnected from each other - dunno if that's the core of the
> global issue...

Yes, that's the intent of the patch. We "want" system and firefox
volumes to be disconnectet, ie the volume is:

        volume = firefox_volume * system_volume

This is because, system volume may be changed externally and there's
no way to notify firefox about volume changes in order to update
firefox volume indicator.

Note https://bugzilla.mozilla.org/show_bug.cgi?id=1467882#c5 :
>
> The patch has been merged in github repo and I could import it but I
> see that you are describing a problem and I wonder if this is
> ready. Do you need additional patches to fix it completely?
>

There are no other patches, AFAIU, the above "problem" is mostly
confusion caused by the fact that OpenBSD users expect knobs in
programs to affect the system volume, i.e.  the one visible in
aucatctl. Unefortulately this not allowed (yet?) by the cubeb API, as
explained in the ticket description.

[...]

If there are plans and/or discussions about extending cubeb to expose
the system volume in firefox, I'd be interested. FYI, programs using
sndio get asynchronous notifications (through a call-back) about
system volume changes, which would allow to update volume
indicators. Each stream has its own system volume setting, which seems
to be how firefox works. Furthermore this would save few CPU cycles,
as volume wouldn't be applied twice (once by cubeb and once by
sndiod).
Flags: needinfo?(alex)
Thanks alex, much clearer now ! No more patches needed so the github tip can be merged into m-c whenever you feel it :)
Comment on attachment 8984568 [details] [diff] [review]
bug-1467882

Review of attachment 8984568 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks Landry, this will land when we uplift cubeb so I'm removing the review request.
Attachment #8984568 - Flags: review?(padenot)
Pushed by achronop@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0e4093890591
Update cubeb from upstream to 0677b30. r=kinetik
The cubeb import above picked one commit: 0677b30 Fix volume handling in sndio backend
https://hg.mozilla.org/mozilla-central/rev/0e4093890591
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: