Joe Q
unread,May 15, 2024, 12:01:01 PMMay 15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to discuss-webrtc
Hi,
We are seeing a crash that is correlated with audio headset plug/unplug event. The following code is accessing a nullptr audio_client_ object.
bool CoreAudioOutput::OnDataCallback(uint64_t device_frequency) {
RTC_DCHECK_RUN_ON(&thread_checker_audio_);
...
UINT32 num_unread_frames = 0;
_com_error error = audio_client_->GetCurrentPadding(&num_unread_frames);
}
Here is our theory. The CoreAudioOutput::StopPlayout() can be invoked by the internal audio thread while handling CoreAudioOutput::HandleStreamDisconnected() during the unplug event with the restarting flag is set to true. At the same time, if our application also calls StopPlayout(), which sees audio object is restarting, it doesn't stop the audio thread, but still arbitrarily clears all the com object in the following code.
bool CoreAudioBase::Stop() {
...
// Stop audio streaming.
_com_error error = audio_client_->Stop();
if (!IsRestarting()) {
StopThread();
}
...
// Release all allocated COM interfaces to allow for a restart without
// intermediate destruction.
ReleaseCOMObjects();
return true;
}
Would you please confirm if this is a webrtc bug? Thanks.