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

Unified Diff: media/audio/audio_input_controller.cc

Issue 11416350: Tab Audio Mirroring: WebContentsAudioInputStream is a new implementation which represents the lifet… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 11 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 | « media/audio/audio_input_controller.h ('k') | media/audio/audio_manager_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_input_controller.cc
diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc
index 99bb420e89553a84e6292a2fa74d404b5eed91eb..82b9f41605a0dbac3a19c62758ef98e2b6b16007 100644
--- a/media/audio/audio_input_controller.cc
+++ b/media/audio/audio_input_controller.cc
@@ -101,6 +101,32 @@ scoped_refptr<AudioInputController> AudioInputController::CreateLowLatency(
return controller;
}
+// static
+scoped_refptr<AudioInputController> AudioInputController::CreateForStream(
+ AudioManager* audio_manager,
+ EventHandler* event_handler,
+ AudioInputStream* stream,
+ SyncWriter* sync_writer) {
+ DCHECK(audio_manager);
+ DCHECK(sync_writer);
+ DCHECK(stream);
+
+ // Create the AudioInputController object and ensure that it runs on
+ // the audio-manager thread.
+ scoped_refptr<AudioInputController> controller(new AudioInputController(
+ event_handler, sync_writer));
+ controller->message_loop_ = audio_manager->GetMessageLoop();
+
+ if (!controller->message_loop_->PostTask(
+ FROM_HERE,
+ base::Bind(&AudioInputController::DoCreateForStream, controller,
+ stream))) {
+ controller = NULL;
+ }
+
+ return controller;
+}
+
void AudioInputController::Record() {
message_loop_->PostTask(FROM_HERE, base::Bind(
&AudioInputController::DoRecord, this));
@@ -128,8 +154,15 @@ void AudioInputController::DoCreate(AudioManager* audio_manager,
const AudioParameters& params,
const std::string& device_id) {
DCHECK(message_loop_->BelongsToCurrentThread());
+ DoCreateForStream(audio_manager->MakeAudioInputStream(params, device_id));
+}
+
+void AudioInputController::DoCreateForStream(
+ AudioInputStream* stream_to_control) {
+ DCHECK(message_loop_->BelongsToCurrentThread());
- stream_ = audio_manager->MakeAudioInputStream(params, device_id);
+ DCHECK(!stream_);
+ stream_ = stream_to_control;
if (!stream_) {
// TODO(satish): Define error types.
« no previous file with comments | « media/audio/audio_input_controller.h ('k') | media/audio/audio_manager_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698