Chromium Code Reviews| Index: content/browser/renderer_host/media/audio_output_delegate_impl.cc |
| diff --git a/content/browser/renderer_host/media/audio_output_delegate_impl.cc b/content/browser/renderer_host/media/audio_output_delegate_impl.cc |
| index 3625fcbfefaaa18f1dabe65e3af7eabbc3175f99..100a03b9655bdad5edcb7f5e0ac4cc43308bd745 100644 |
| --- a/content/browser/renderer_host/media/audio_output_delegate_impl.cc |
| +++ b/content/browser/renderer_host/media/audio_output_delegate_impl.cc |
| @@ -12,6 +12,7 @@ |
| #include "content/browser/media/capture/audio_mirroring_manager.h" |
| #include "content/browser/media/media_internals.h" |
| #include "content/browser/renderer_host/media/audio_sync_reader.h" |
| +#include "content/browser/renderer_host/media/media_stream_manager.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/media_observer.h" |
| #include "media/audio/audio_output_controller.h" |
| @@ -33,13 +34,15 @@ class AudioOutputDelegateImpl::ControllerEventHandler |
| void OnControllerPlaying() override; |
| void OnControllerPaused() override; |
| void OnControllerError() override; |
| + void OnLog(const std::string& message) override; |
| base::WeakPtr<AudioOutputDelegateImpl> delegate_; |
| + int stream_id_; // Retained separately for logging. |
| }; |
| AudioOutputDelegateImpl::ControllerEventHandler::ControllerEventHandler( |
| base::WeakPtr<AudioOutputDelegateImpl> delegate) |
| - : delegate_(std::move(delegate)) {} |
| + : delegate_(std::move(delegate)), stream_id_(delegate_->stream_id_) {} |
|
Max Morin
2017/05/31 11:52:40
Since you're dereferencing |delegate_|, maybe add
ossu-chromium
2017/05/31 13:47:20
I've no reasonable place to put it - in the code b
Max Morin
2017/05/31 13:51:59
Alright, that's fine by me.
|
| void AudioOutputDelegateImpl::ControllerEventHandler::OnControllerCreated() { |
| BrowserThread::PostTask( |
| @@ -68,6 +71,22 @@ void AudioOutputDelegateImpl::ControllerEventHandler::OnControllerError() { |
| base::BindOnce(&AudioOutputDelegateImpl::OnError, delegate_)); |
| } |
| +void AudioOutputDelegateImpl::ControllerEventHandler::OnLog( |
| + const std::string& message) { |
| + BrowserThread::PostTask( |
| + BrowserThread::IO, FROM_HERE, |
| + base::BindOnce( |
| + [](int stream_id, const std::string& message) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| + std::ostringstream oss; |
| + oss << "[stream_id=" << stream_id << "] " << message; |
| + const std::string out_message = oss.str(); |
| + content::MediaStreamManager::SendMessageToNativeLog(out_message); |
|
Max Morin
2017/05/31 11:52:40
Since I'm nit-picking anyways, remove unnecessary
Max Morin
2017/05/31 11:56:23
Oh, I just noticed SendMessageToNativeLog is safe
ossu-chromium
2017/05/31 11:59:45
Ah, yes, you are right! The task was only posted t
|
| + DVLOG(1) << out_message; |
| + }, |
| + stream_id_, message)); |
| +} |
| + |
| std::unique_ptr<media::AudioOutputDelegate> AudioOutputDelegateImpl::Create( |
| EventHandler* handler, |
| media::AudioManager* audio_manager, |