alloy: Fix audio capturer crash on exit (fixes #3689)
This commit is contained in:
parent
3ccd305f6d
commit
e997249d53
|
@ -117,8 +117,11 @@ void CefAudioCapturer::OnCaptureError(
|
||||||
media::AudioCapturerSource::ErrorCode code,
|
media::AudioCapturerSource::ErrorCode code,
|
||||||
const std::string& message) {
|
const std::string& message) {
|
||||||
audio_handler_->OnAudioStreamError(browser_, message);
|
audio_handler_->OnAudioStreamError(browser_, message);
|
||||||
|
|
||||||
|
if (code != media::AudioCapturerSource::ErrorCode::kSocketError) {
|
||||||
StopStream();
|
StopStream();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CefAudioCapturer::StopStream() {
|
void CefAudioCapturer::StopStream() {
|
||||||
if (audio_input_device_) {
|
if (audio_input_device_) {
|
||||||
|
|
|
@ -934,10 +934,15 @@ class AudioTestHandler : public TestHandler, public CefAudioHandler {
|
||||||
|
|
||||||
void OnAudioStreamError(CefRefPtr<CefBrowser> browser,
|
void OnAudioStreamError(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& message) override {
|
const CefString& message) override {
|
||||||
|
// 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 << ".";
|
LOG(WARNING) << "OnAudioStreamError: message = " << message << ".";
|
||||||
got_on_audio_stream_error_.yes();
|
got_on_audio_stream_error_.yes();
|
||||||
DestroyTest();
|
DestroyTest();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DestroyTest() override {
|
void DestroyTest() override {
|
||||||
|
@ -945,8 +950,6 @@ class AudioTestHandler : public TestHandler, public CefAudioHandler {
|
||||||
EXPECT_TRUE(got_audio_parameters_);
|
EXPECT_TRUE(got_audio_parameters_);
|
||||||
EXPECT_TRUE(got_on_audio_stream_started_);
|
EXPECT_TRUE(got_on_audio_stream_started_);
|
||||||
EXPECT_TRUE(got_on_audio_stream_packet_);
|
EXPECT_TRUE(got_on_audio_stream_packet_);
|
||||||
EXPECT_TRUE(got_on_audio_stream_stopped_);
|
|
||||||
EXPECT_FALSE(got_on_audio_stream_error_);
|
|
||||||
TestHandler::DestroyTest();
|
TestHandler::DestroyTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue