Closed Bug 1801190 Opened 2 years ago Closed 2 years ago

Resume MediaTrackGraph audio when device is replugged after setSinkId()

Categories

(Core :: Audio/Video: MediaStreamGraph, defect)

defect

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: karlt, Assigned: karlt)

References

Details

Attachments

(6 files)

https://w3c.github.io/mediacapture-output/#algorithms-new-sink-available

New audio devices may become available to the user agent, or an audio device (identified by a media element's sinkId attribute) that had previously become unavailable may become available again, for example, if it is unplugged and later plugged back in.

In this scenario, the user agent must run the following steps:

  1. Let sinkId be the identifier for the newly available device.
  2. For each media element whose sinkId attribute is equal to sinkId:
  3. If the media element's paused attribute is false, start rendering this object's audio out of the device represented by the sinkId attribute.

STR:

  1. Set pref media.setsinkid.enabled true (and media.cubeb.sandbox_v2 false to workaround bug 1801049).
  2. Load https://bugzilla.mozilla.org/attachment.cgi?id=9303828
  3. Click "Go!"
  4. Click "Allow". (Need microphone connected.)
  5. Click "Default system output..."
  6. Select removable speaker device.
  7. Click "Allow".
  8. Remove and re-plug removable speaker device.
  9. Tap microphone from 4.

Expect: audio in speaker from 6.
Actual: no audio.

Assignee: nobody → karlt
Status: NEW → ASSIGNED
See Also: → 1586370
Type: enhancement → defect
Component: Audio/Video: Playback → Audio/Video: MediaStreamGraph

Such resets were preventing transitions to Running for new streams and allowing
MaybeStartAudioStream() to start another stream.

mAudioStream may be replaced on the CubebOperation thread while the fallback
driver hands over the graph to a ThreadedDriver or main thread that may create
a SHUTDOWN AsyncCubebTask.

The new assertion matches one in AudioCallbackDriver::Init() but is tested
earlier.

Depends on D173923

to save problems if/when further members are added.

cubeb_stream_user_ptr() is not used/tested right now, but this change will
make that behave as expected.

Depends on D173924

Pushed by ktomlinson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f81e1b1615b3 do not reset mAudioStreamState to None on state changes from an old cubeb_stream r=pehrsons https://hg.mozilla.org/integration/autoland/rev/2eea0baf77ab merge mStarted into mAudioStreamState r=pehrsons https://hg.mozilla.org/integration/autoland/rev/16ac83dc9ac5 reset mAudioStreamState after cubeb_stream_stop() instead of on CUBEB_STATE_STOPPED r=padenot https://hg.mozilla.org/integration/autoland/rev/2fafc3764c75 remove racy mAudioStream warning r=pehrsons https://hg.mozilla.org/integration/autoland/rev/3894874ab98c clarify that MockCubebStream needs the same memory layout as cubeb_stream r=padenot
Regressions: 1825828
Regressions: 1825913
QA Whiteboard: [qa-113b-p2]
See Also: → 1829054
Summary: Resume audio when device is replugged after setSinkId() → Resume MediaTrackGraph audio when device is replugged after setSinkId()
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: