Closed Bug 1103824 Opened 6 years ago Closed 8 months ago

Investigate first initialization of IAudioClient used in libcubeb

Categories

(Core :: Audio/Video: cubeb, defect, P3)

All
Windows 8.1
defect

Tracking

()

RESOLVED WONTFIX
mozilla41

People

(Reporter: kinetik, Assigned: kinetik)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(1 file)

While looking at bug 1096717, I noticed that the IAudioClient docs have the following warning:

    Note: In Windows 8, the first use of IAudioClient to access the audio device
          should be on the STA thread. Calls from an MTA thread may result in
          undefined behavior.

It doesn't look like we do anything special to ensure this happens in libcubeb, so we'll need to address this at some stage to avoid surprises.
Initialize (and discard, to avoid keeping resources alive via sCubebContext that may never be used) a cubeb context on the main thread.

Change cubeb's auto_com to treat RPC_E_CHANGED_MODE as an error, since that's really telling us that we're asking for (and not getting) MTA on a thread that has already been initialized as STA.

Check that we get an STA initialization in cubeb_init the first time it's called, and use that opportunity to completely initialize (and then discard) an IAudioClient.
Assignee: nobody → kinetik
Status: NEW → ASSIGNED
Attachment #8605670 - Flags: review?(padenot)
Blocks: 1135562
Attachment #8605670 - Flags: review?(padenot) → review+
I looked at the OpenSL failures but not sure what the cause is yet.  I'll reland this with the CubebUtils.cpp changes wrapped in an XP_WIN ifdef (this issue only matters on Windows) and file a followup to address the OpenSL issues.
Depends on: 1166553
sorry had to back this out since this seems to have caused somehow https://treeherder.mozilla.org/logviewer.html#?job_id=9992633&repo=mozilla-inbound
Flags: needinfo?(kinetik)
Will repush once I've found the cause.
Flags: needinfo?(kinetik)
Rather than init and destroy a context in CubebUtils::InitLibrary(), I explicitly make the first CubebUtils::GetCubebContext() from the main thread for the users of libcubeb.  This looks good on try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=47a6687a973f
https://hg.mozilla.org/mozilla-central/rev/aeaa70495f1d
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
I backed this out due to the regression reported in bug 1176499, along with the fact that this fix was speculative.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Depends on: 1182678
Component: Audio/Video → Audio/Video: MSG/cubeb/GMP
Component: Audio/Video: MediaStreamGraph → Audio/Video: cubeb
Rank: 22
Priority: -- → P2
Mass change P2->P3 to align with new Mozilla triage process.
Priority: P2 → P3

I don't think we've ever seen evidence that this matters. It's possible it's only relevant in configurations we don't exercise (e.g. exclusive mode).

Status: REOPENED → RESOLVED
Closed: 5 years ago8 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.