mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	alloy: Fix audio capturer crash on exit (fixes #3689)
This commit is contained in:
		| @@ -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(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user