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

Side by Side Diff: media/renderers/renderer_impl.cc

Issue 1122393004: Add support for switching the audio output device for HTMLMediaElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes to MediaPlayers so that they invoke callbacks in the correct threads. First complete implem… 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
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/renderers/renderer_impl.h" 5 #include "media/renderers/renderer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 189
190 void RendererImpl::SetVolume(float volume) { 190 void RendererImpl::SetVolume(float volume) {
191 DVLOG(1) << __FUNCTION__; 191 DVLOG(1) << __FUNCTION__;
192 DCHECK(task_runner_->BelongsToCurrentThread()); 192 DCHECK(task_runner_->BelongsToCurrentThread());
193 193
194 if (audio_renderer_) 194 if (audio_renderer_)
195 audio_renderer_->SetVolume(volume); 195 audio_renderer_->SetVolume(volume);
196 } 196 }
197 197
198 void RendererImpl::SwitchAudioOutputDevice(
199 const std::string& device_id,
200 const GURL& security_origin,
201 const base::Callback<void(int)>& callback) {
202 DCHECK(task_runner_->BelongsToCurrentThread());
203 DVLOG(1) << __FUNCTION__ << "(" << device_id << ", "
204 << security_origin << ")";
205
206 if (audio_renderer_)
207 audio_renderer_->SwitchOutputDevice(device_id, security_origin, callback);
208 }
209
198 base::TimeDelta RendererImpl::GetMediaTime() { 210 base::TimeDelta RendererImpl::GetMediaTime() {
199 // No BelongsToCurrentThread() checking because this can be called from other 211 // No BelongsToCurrentThread() checking because this can be called from other
200 // threads. 212 // threads.
201 return time_source_->CurrentMediaTime(); 213 return time_source_->CurrentMediaTime();
202 } 214 }
203 215
204 bool RendererImpl::HasAudio() { 216 bool RendererImpl::HasAudio() {
205 DCHECK(task_runner_->BelongsToCurrentThread()); 217 DCHECK(task_runner_->BelongsToCurrentThread());
206 return audio_renderer_ != NULL; 218 return audio_renderer_ != NULL;
207 } 219 }
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 } 643 }
632 644
633 // After OnError() returns, the pipeline may destroy |this|. 645 // After OnError() returns, the pipeline may destroy |this|.
634 base::ResetAndReturn(&error_cb_).Run(error); 646 base::ResetAndReturn(&error_cb_).Run(error);
635 647
636 if (!flush_cb_.is_null()) 648 if (!flush_cb_.is_null())
637 base::ResetAndReturn(&flush_cb_).Run(); 649 base::ResetAndReturn(&flush_cb_).Run();
638 } 650 }
639 651
640 } // namespace media 652 } // namespace media
OLDNEW
« media/blink/webmediaplayer_impl.cc ('K') | « media/renderers/renderer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698