Closed Bug 1647717 Opened 4 years ago Closed 4 years ago

Fix audio thread registration in AudioStream.cpp

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: padenot, Assigned: padenot)

References

(Regressed 2 open bugs)

Details

Attachments

(1 file)

Same deal.

More or less the same as GraphDriver.cpp but simpler because there is only one
return statement.

Assignee: nobody → padenot
Status: NEW → ASSIGNED
Pushed by padenot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/953d224e37c4
Fix audio thread registration to the profiler in AudioStream.cpp. r=achronop
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79

This seemed to introduce a regression in recent version of Firefox. My attempts to workaround the problem is in https://reviews.freebsd.org/D26303

The change in this ticket tries to profile the audio threads created by libcubeb. However, for some of the backends at least, such as sndio and sun and even pulse in my test setup,
the code here would not unregister the NativeAudioCallback from audio thread registry whenever the audio stream is paused. When that happens,
the RegisteredThread would remain in CorePS::RegisteredThreads. After that, if another thread is created, and reusing the same thread ID, it will
reuse the existing RegisteredThread without initializing the TLSRegisteredThread pointer to the existing RegisteredThread. This later will fail the
following lines in profiler_unregister_thread():

MOZ_RELEASE_ASSERT(registeredThread ==
                     TLSRegisteredThread::RegisteredThread(lock));

When constructing a fix to the problem, I think it is better to allow launching a callback when the audio threads are to be stopped. This may require either libcubeb having a new API for such purpose , or at least receiving notification somewhere in AudioStream.

Regressions: 1664115
Regressions: 1756973
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: