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

Side by Side Diff: media/mojo/services/mojo_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/mojo/services/mojo_renderer_impl.h" 5 #include "media/mojo/services/mojo_renderer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 DCHECK(task_runner_->BelongsToCurrentThread()); 108 DCHECK(task_runner_->BelongsToCurrentThread());
109 remote_media_renderer_->SetPlaybackRate(playback_rate); 109 remote_media_renderer_->SetPlaybackRate(playback_rate);
110 } 110 }
111 111
112 void MojoRendererImpl::SetVolume(float volume) { 112 void MojoRendererImpl::SetVolume(float volume) {
113 DVLOG(2) << __FUNCTION__; 113 DVLOG(2) << __FUNCTION__;
114 DCHECK(task_runner_->BelongsToCurrentThread()); 114 DCHECK(task_runner_->BelongsToCurrentThread());
115 remote_media_renderer_->SetVolume(volume); 115 remote_media_renderer_->SetVolume(volume);
116 } 116 }
117 117
118 void MojoRendererImpl::SwitchAudioOutputDevice(const std::string& device_id,
119 const GURL& security_origin) {
120 DVLOG(2) << __FUNCTION__;
121 DCHECK(task_runner_->BelongsToCurrentThread());
122 remote_media_renderer_->SwitchAudioOutputDevice(
123 mojo::String(device_id), mojo::String(security_origin.spec()));
124 }
125
118 base::TimeDelta MojoRendererImpl::GetMediaTime() { 126 base::TimeDelta MojoRendererImpl::GetMediaTime() {
119 base::AutoLock auto_lock(lock_); 127 base::AutoLock auto_lock(lock_);
120 DVLOG(3) << __FUNCTION__ << ": " << time_.InMilliseconds() << " ms"; 128 DVLOG(3) << __FUNCTION__ << ": " << time_.InMilliseconds() << " ms";
121 return time_; 129 return time_;
122 } 130 }
123 131
124 bool MojoRendererImpl::HasAudio() { 132 bool MojoRendererImpl::HasAudio() {
125 DVLOG(1) << __FUNCTION__; 133 DVLOG(1) << __FUNCTION__;
126 DCHECK(task_runner_->BelongsToCurrentThread()); 134 DCHECK(task_runner_->BelongsToCurrentThread());
127 DCHECK(remote_media_renderer_.get()); // We always bind the renderer. 135 DCHECK(remote_media_renderer_.get()); // We always bind the renderer.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 205 }
198 206
199 void MojoRendererImpl::OnInitialized() { 207 void MojoRendererImpl::OnInitialized() {
200 DVLOG(1) << __FUNCTION__; 208 DVLOG(1) << __FUNCTION__;
201 DCHECK(task_runner_->BelongsToCurrentThread()); 209 DCHECK(task_runner_->BelongsToCurrentThread());
202 if (!init_cb_.is_null()) 210 if (!init_cb_.is_null())
203 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); 211 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK);
204 } 212 }
205 213
206 } // namespace media 214 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698