alloy: Fix audio capturer crash on exit (fixes #3689)
This commit is contained in:
parent
3ccd305f6d
commit
e997249d53
|
@ -117,7 +117,10 @@ void CefAudioCapturer::OnCaptureError(
|
|||
media::AudioCapturerSource::ErrorCode code,
|
||||
const std::string& message) {
|
||||
audio_handler_->OnAudioStreamError(browser_, message);
|
||||
StopStream();
|
||||
|
||||
if (code != media::AudioCapturerSource::ErrorCode::kSocketError) {
|
||||
StopStream();
|
||||
}
|
||||
}
|
||||
|
||||
void CefAudioCapturer::StopStream() {
|
||||
|
|
|
@ -934,9 +934,14 @@ class AudioTestHandler : public TestHandler, public CefAudioHandler {
|
|||
|
||||
void OnAudioStreamError(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message) override {
|
||||
LOG(WARNING) << "OnAudioStreamError: message = " << message << ".";
|
||||
got_on_audio_stream_error_.yes();
|
||||
DestroyTest();
|
||||
// Since 7c88225, when Chromium closes a socket, the following error is
|
||||
// propagated to the audio capturer. Ignore this error for test destruction.
|
||||
const CefString& socket_error("Socket closed unexpectedly");
|
||||
if (message.compare(socket_error) != 0) {
|
||||
LOG(WARNING) << "OnAudioStreamError: message = " << message << ".";
|
||||
got_on_audio_stream_error_.yes();
|
||||
DestroyTest();
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -945,8 +950,6 @@ class AudioTestHandler : public TestHandler, public CefAudioHandler {
|
|||
EXPECT_TRUE(got_audio_parameters_);
|
||||
EXPECT_TRUE(got_on_audio_stream_started_);
|
||||
EXPECT_TRUE(got_on_audio_stream_packet_);
|
||||
EXPECT_TRUE(got_on_audio_stream_stopped_);
|
||||
EXPECT_FALSE(got_on_audio_stream_error_);
|
||||
TestHandler::DestroyTest();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue