WebRTC crash while plug/unplug audio headset.

133 views
Skip to first unread message

Joe Q

unread,
May 15, 2024, 12:01:01 PMMay 15
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.

R simons

unread,
Jul 22, 2024, 11:43:24 PM (4 days ago) Jul 22
to discuss-webrtc
I am facing same issue recently,  and find a issue report here: https://issues.chromium.org/issues/330055211
Reply all
Reply to author
Forward
0 new messages