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

Side by Side Diff: media/audio/audio_output_stream_sink.cc

Issue 1184473002: Add support for the audio-output-device switching IPC mechanism to the renderer lower layers (media… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build dependencies for audio_unittests Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « media/audio/audio_output_stream_sink.h ('k') | media/audio/clockless_audio_sink.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/audio_output_stream_sink.h" 5 #include "media/audio/audio_output_stream_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "media/audio/audio_manager.h" 10 #include "media/audio/audio_manager.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 base::AutoLock al(callback_lock_); 50 base::AutoLock al(callback_lock_);
51 active_render_callback_ = render_callback_; 51 active_render_callback_ = render_callback_;
52 audio_task_runner_->PostTask( 52 audio_task_runner_->PostTask(
53 FROM_HERE, base::Bind(&AudioOutputStreamSink::DoPlay, this)); 53 FROM_HERE, base::Bind(&AudioOutputStreamSink::DoPlay, this));
54 } 54 }
55 55
56 bool AudioOutputStreamSink::SetVolume(double volume) { 56 bool AudioOutputStreamSink::SetVolume(double volume) {
57 audio_task_runner_->PostTask( 57 audio_task_runner_->PostTask(
58 FROM_HERE, base::Bind(&AudioOutputStreamSink::DoSetVolume, this, volume)); 58 FROM_HERE, base::Bind(&AudioOutputStreamSink::DoSetVolume, this, volume));
59 return true; 59 return true;
60 }; 60 }
61
62 void AudioOutputStreamSink::SwitchOutputDevice(
63 const std::string& device_id,
64 const GURL& security_origin,
65 const SwitchOutputDeviceCB& callback) {
66 callback.Run(SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED);
67 }
61 68
62 int AudioOutputStreamSink::OnMoreData(AudioBus* dest, 69 int AudioOutputStreamSink::OnMoreData(AudioBus* dest,
63 uint32 total_bytes_delay) { 70 uint32 total_bytes_delay) {
64 // Note: Runs on the audio thread created by the OS. 71 // Note: Runs on the audio thread created by the OS.
65 base::AutoLock al(callback_lock_); 72 base::AutoLock al(callback_lock_);
66 if (!active_render_callback_) 73 if (!active_render_callback_)
67 return 0; 74 return 0;
68 75
69 return active_render_callback_->Render( 76 return active_render_callback_->Render(
70 dest, total_bytes_delay * 1000.0 / params_.GetBytesPerSecond()); 77 dest, total_bytes_delay * 1000.0 / params_.GetBytesPerSecond());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 DCHECK(audio_task_runner_->BelongsToCurrentThread()); 124 DCHECK(audio_task_runner_->BelongsToCurrentThread());
118 stream_->SetVolume(volume); 125 stream_->SetVolume(volume);
119 } 126 }
120 127
121 void AudioOutputStreamSink::ClearCallback() { 128 void AudioOutputStreamSink::ClearCallback() {
122 base::AutoLock al(callback_lock_); 129 base::AutoLock al(callback_lock_);
123 active_render_callback_ = NULL; 130 active_render_callback_ = NULL;
124 } 131 }
125 132
126 } // namepace media 133 } // namepace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_stream_sink.h ('k') | media/audio/clockless_audio_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698