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

The update capture state algorithm needs refinement #332

Open
jan-ivar opened this issue May 24, 2024 · 2 comments · May be fixed by #335
Open

The update capture state algorithm needs refinement #332

jan-ivar opened this issue May 24, 2024 · 2 comments · May be fixed by #335

Comments

@jan-ivar
Copy link
Member

To implement the update capture state algorithm given active=true, we see a UA that implements a policy of pausing all input sources of a kind in response to UI is expected to reverse a previous UI pausing. This culminates in:

  1. Let newMutedState be true if active is false and false otherwise.
  2. For each MediaStreamTrack whose source is of type captureKind, queue a task to set a track’s muted state to newMutedState.

But this setting of newMutedState to false might conflict with other implementation-defined reasons the UA may have muted a particular source, like "a physical mute button on the microphone, the user closing a laptop lid with an embedded camera".

We should amend it to allow UAs to leave such sources muted. A track can be muted both by UI and physical reasons, and we should only fire unmute when it is neither.

@youennf
Copy link
Contributor

youennf commented May 26, 2024

Good point, unmute is somehow error-prone from the point of view of the UA, so I wonder what the error handling should be.
There are various possibilities:

  1. Reject the request as the current spec allows it.
  2. Unmute only the tracks it can unmute and keep the other tracks muted
  3. Unmute all tracks but end capture for the tracks it cannot unmute (in a sense, it failed starting capture).

@jan-ivar
Copy link
Member Author

jan-ivar commented May 28, 2024

I hesitate calling it an "error". In my mind, we're unchecking ✅ Mute all not implementing Unmute all.

I think 2 is the only interoperable option. Example (UA1 implements a pause policy, UA2 doesn't):

  • The user is transmitting from two mics A and B, but has turned B off using a physical button on B
    • States: Both tracks are enabled but trackB is muted, so the audience only hears A (and silence from B)
  • The user needs a bio-break and checks ✅ Mute all in the app which sets enabled = false on both tracks and calls setMicrophoneActive(false)
    • States in UA1: Both tracks have enabled = false and both tracks are muted; audience hears silence
    • States in UA2: Both tracks have enabled = false but only trackB is muted; audience hears silence
  • The user comes back and unchecks ☐ Mute all in the app which sets enabled = true on both tracks and calls setMicrophoneActive(true)
    • States: Both tracks are enabled but trackB is muted, so the audience only hears A (and silence from B)

Importantly, the states are the same before and after the bio-break, regardless of UA. This seems interoperable, safe, unsurprising, and useful.

In contrast, 1 would fail setMicrophoneActive(true) and leave both tracks muted in UA1 but not UA2, and 3 would end trackB in UA1 but not UA2, which seems undesirable.

@jan-ivar jan-ivar linked a pull request Jul 12, 2024 that will close this issue
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 a pull request may close this issue.

2 participants