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

Side by Side Diff: media/renderers/audio_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 (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/renderers/audio_renderer_impl.h" 5 #include "media/renderers/audio_renderer_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 DCHECK(!sink_playing_); 389 DCHECK(!sink_playing_);
390 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); 390 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK);
391 } 391 }
392 392
393 void AudioRendererImpl::SetVolume(float volume) { 393 void AudioRendererImpl::SetVolume(float volume) {
394 DCHECK(task_runner_->BelongsToCurrentThread()); 394 DCHECK(task_runner_->BelongsToCurrentThread());
395 DCHECK(sink_.get()); 395 DCHECK(sink_.get());
396 sink_->SetVolume(volume); 396 sink_->SetVolume(volume);
397 } 397 }
398 398
399 void AudioRendererImpl::SwitchOutputDevice(
400 const std::string& device_id,
401 const GURL& security_origin,
402 const base::Callback<void(int)>& callback) {
403 DCHECK(task_runner_->BelongsToCurrentThread());
404 DCHECK(sink_.get());
405 DVLOG(1) << __FUNCTION__ << "(" << device_id << ", " << security_origin << ")"
406 << ". Forwarding to sink " << sink_ << ".";
407 sink_->SwitchOutputDevice(device_id, security_origin, callback);
408 }
409
399 void AudioRendererImpl::DecodedAudioReady( 410 void AudioRendererImpl::DecodedAudioReady(
400 AudioBufferStream::Status status, 411 AudioBufferStream::Status status,
401 const scoped_refptr<AudioBuffer>& buffer) { 412 const scoped_refptr<AudioBuffer>& buffer) {
402 DVLOG(2) << __FUNCTION__ << "(" << status << ")"; 413 DVLOG(2) << __FUNCTION__ << "(" << status << ")";
403 DCHECK(task_runner_->BelongsToCurrentThread()); 414 DCHECK(task_runner_->BelongsToCurrentThread());
404 415
405 base::AutoLock auto_lock(lock_); 416 base::AutoLock auto_lock(lock_);
406 DCHECK(state_ != kUninitialized); 417 DCHECK(state_ != kUninitialized);
407 418
408 CHECK(pending_read_); 419 CHECK(pending_read_);
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 << buffering_state; 773 << buffering_state;
763 DCHECK_NE(buffering_state_, buffering_state); 774 DCHECK_NE(buffering_state_, buffering_state);
764 lock_.AssertAcquired(); 775 lock_.AssertAcquired();
765 buffering_state_ = buffering_state; 776 buffering_state_ = buffering_state;
766 777
767 task_runner_->PostTask(FROM_HERE, 778 task_runner_->PostTask(FROM_HERE,
768 base::Bind(buffering_state_cb_, buffering_state_)); 779 base::Bind(buffering_state_cb_, buffering_state_));
769 } 780 }
770 781
771 } // namespace media 782 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698