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

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

Issue 2289543003: IPC->mojo of audio_renderer_host (Closed)
Patch Set: It builds \o/. Created 4 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_device.h" 5 #include "media/audio/audio_output_device.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <cmath> 10 #include <cmath>
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 audio_callback_.reset(); 271 audio_callback_.reset();
272 stopping_hack_ = false; 272 stopping_hack_ = false;
273 } 273 }
274 274
275 void AudioOutputDevice::SetVolumeOnIOThread(double volume) { 275 void AudioOutputDevice::SetVolumeOnIOThread(double volume) {
276 DCHECK(task_runner()->BelongsToCurrentThread()); 276 DCHECK(task_runner()->BelongsToCurrentThread());
277 if (state_ >= CREATING_STREAM) 277 if (state_ >= CREATING_STREAM)
278 ipc_->SetVolume(volume); 278 ipc_->SetVolume(volume);
279 } 279 }
280 280
281 void AudioOutputDevice::OnStateChanged(AudioOutputIPCDelegateState state) { 281 void AudioOutputDevice::OnStateChanged(mojom::AudioOutputStreamState state) {
282 DCHECK(task_runner()->BelongsToCurrentThread()); 282 DCHECK(task_runner()->BelongsToCurrentThread());
283 283
284 // Do nothing if the stream has been closed. 284 // Do nothing if the stream has been closed.
285 if (state_ < CREATING_STREAM) 285 if (state_ < CREATING_STREAM)
286 return; 286 return;
287 287
288 // TODO(miu): Clean-up inconsistent and incomplete handling here. 288 // TODO(miu): Clean-up inconsistent and incomplete handling here.
289 // http://crbug.com/180640 289 // http://crbug.com/180640
290 switch (state) { 290 switch (state) {
291 case AUDIO_OUTPUT_IPC_DELEGATE_STATE_PLAYING: 291 case mojom::AudioOutputStreamState::PLAYING:
Henrik Grunell 2016/09/01 15:09:07 This seems to be an old IPC legacy. Play() and Pau
292 case AUDIO_OUTPUT_IPC_DELEGATE_STATE_PAUSED: 292 case mojom::AudioOutputStreamState::PAUSED:
293 break; 293 break;
294 case AUDIO_OUTPUT_IPC_DELEGATE_STATE_ERROR: 294 case mojom::AudioOutputStreamState::ERROR:
295 DLOG(WARNING) << "AudioOutputDevice::OnStateChanged(ERROR)"; 295 DLOG(WARNING) << "AudioOutputDevice::OnStateChanged(ERROR)";
296 // Don't dereference the callback object if the audio thread 296 // Don't dereference the callback object if the audio thread
297 // is stopped or stopping. That could mean that the callback 297 // is stopped or stopping. That could mean that the callback
298 // object has been deleted. 298 // object has been deleted.
299 // TODO(tommi): Add an explicit contract for clearing the callback 299 // TODO(tommi): Add an explicit contract for clearing the callback
300 // object. Possibly require calling Initialize again or provide 300 // object. Possibly require calling Initialize again or provide
301 // a callback object via Start() and clear it in Stop(). 301 // a callback object via Start() and clear it in Stop().
302 { 302 {
303 base::AutoLock auto_lock_(audio_thread_lock_); 303 base::AutoLock auto_lock_(audio_thread_lock_);
304 if (audio_thread_) 304 if (audio_thread_)
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), 493 render_callback_->Render(output_bus_.get(), std::round(frames_delayed),
494 frames_skipped); 494 frames_skipped);
495 } 495 }
496 496
497 bool AudioOutputDevice::AudioThreadCallback:: 497 bool AudioOutputDevice::AudioThreadCallback::
498 CurrentThreadIsAudioDeviceThread() { 498 CurrentThreadIsAudioDeviceThread() {
499 return thread_checker_.CalledOnValidThread(); 499 return thread_checker_.CalledOnValidThread();
500 } 500 }
501 501
502 } // namespace media 502 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698