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

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

Issue 2900043002: Added initial set of logging for AudioOutputController. (Closed)
Patch Set: impliciticity 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..2d41e509a44701e338f21ca1bb0dbf183fec953f 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"
@@ -25,21 +26,24 @@ namespace content {
class AudioOutputDelegateImpl::ControllerEventHandler
: public media::AudioOutputController::EventHandler {
public:
- explicit ControllerEventHandler(
- base::WeakPtr<AudioOutputDelegateImpl> delegate);
+ ControllerEventHandler(base::WeakPtr<AudioOutputDelegateImpl> delegate,
+ int stream_id);
private:
void OnControllerCreated() override;
void OnControllerPlaying() override;
void OnControllerPaused() override;
void OnControllerError() override;
+ void OnLog(const std::string& message) override;
base::WeakPtr<AudioOutputDelegateImpl> delegate_;
+ const int stream_id_; // Retained separately for logging.
};
AudioOutputDelegateImpl::ControllerEventHandler::ControllerEventHandler(
- base::WeakPtr<AudioOutputDelegateImpl> delegate)
- : delegate_(std::move(delegate)) {}
+ base::WeakPtr<AudioOutputDelegateImpl> delegate,
+ int stream_id)
+ : delegate_(std::move(delegate)), stream_id_(stream_id) {}
void AudioOutputDelegateImpl::ControllerEventHandler::OnControllerCreated() {
BrowserThread::PostTask(
@@ -68,6 +72,15 @@ void AudioOutputDelegateImpl::ControllerEventHandler::OnControllerError() {
base::BindOnce(&AudioOutputDelegateImpl::OnError, delegate_));
}
+void AudioOutputDelegateImpl::ControllerEventHandler::OnLog(
+ const std::string& message) {
+ std::ostringstream oss;
+ oss << "[stream_id=" << stream_id_ << "] " << message;
+ const std::string out_message = oss.str();
+ content::MediaStreamManager::SendMessageToNativeLog(out_message);
+ DVLOG(1) << out_message;
+}
+
std::unique_ptr<media::AudioOutputDelegate> AudioOutputDelegateImpl::Create(
EventHandler* handler,
media::AudioManager* audio_manager,
@@ -118,8 +131,8 @@ AudioOutputDelegateImpl::AudioOutputDelegateImpl(
// Since the event handler never directly calls functions on |this| but rather
// posts them to the IO thread, passing a pointer from the constructor is
// safe.
- controller_event_handler_ =
- base::MakeUnique<ControllerEventHandler>(weak_factory_.GetWeakPtr());
+ controller_event_handler_ = base::MakeUnique<ControllerEventHandler>(
+ weak_factory_.GetWeakPtr(), stream_id_);
audio_log_->OnCreated(stream_id, params, output_device_id);
controller_ = media::AudioOutputController::Create(
audio_manager, controller_event_handler_.get(), params, output_device_id,
« 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