Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1814)

Unified Diff: content/browser/renderer_host/media/audio_output_delegate_impl.cc

Issue 2900043002: Added initial set of logging for AudioOutputController. (Closed)
Patch Set: Bind -> BindOnce; DoLog now a lambda; removed extra blank lines. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/audio/audio_output_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « no previous file | media/audio/audio_output_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698