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

Side by Side Diff: media/audio/null_audio_sink.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/audio/null_audio_sink.h" 5 #include "media/audio/null_audio_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "media/audio/fake_audio_worker.h" 9 #include "media/audio/fake_audio_worker.h"
10 #include "media/base/audio_hash.h" 10 #include "media/base/audio_hash.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 fake_worker_->Stop(); 64 fake_worker_->Stop();
65 playing_ = false; 65 playing_ = false;
66 } 66 }
67 67
68 bool NullAudioSink::SetVolume(double volume) { 68 bool NullAudioSink::SetVolume(double volume) {
69 // Audio is always muted. 69 // Audio is always muted.
70 return volume == 0.0; 70 return volume == 0.0;
71 } 71 }
72 72
73 void NullAudioSink::SwitchOutputDevice(
74 const std::string &device_id,
75 const GURL& security_origin,
76 const base::Callback<void(int)>& callback) {
77 DCHECK(task_runner_->BelongsToCurrentThread());
78 }
miu 2015/06/03 21:01:01 ditto: Run callback. Maybe the NullAudioSink shou
79
80
73 void NullAudioSink::CallRender() { 81 void NullAudioSink::CallRender() {
74 DCHECK(task_runner_->BelongsToCurrentThread()); 82 DCHECK(task_runner_->BelongsToCurrentThread());
75 83
76 int frames_received = callback_->Render(audio_bus_.get(), 0); 84 int frames_received = callback_->Render(audio_bus_.get(), 0);
77 if (!audio_hash_ || frames_received <= 0) 85 if (!audio_hash_ || frames_received <= 0)
78 return; 86 return;
79 87
80 audio_hash_->Update(audio_bus_.get(), frames_received); 88 audio_hash_->Update(audio_bus_.get(), frames_received);
81 } 89 }
82 90
83 void NullAudioSink::StartAudioHashForTesting() { 91 void NullAudioSink::StartAudioHashForTesting() {
84 DCHECK(!initialized_); 92 DCHECK(!initialized_);
85 audio_hash_.reset(new AudioHash()); 93 audio_hash_.reset(new AudioHash());
86 } 94 }
87 95
88 std::string NullAudioSink::GetAudioHashForTesting() { 96 std::string NullAudioSink::GetAudioHashForTesting() {
89 return audio_hash_ ? audio_hash_->ToString() : std::string(); 97 return audio_hash_ ? audio_hash_->ToString() : std::string();
90 } 98 }
91 99
92 } // namespace media 100 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698