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

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

Issue 1186943003: Revert of Add support for the audio-output-device switching IPC mechanism to the renderer lower... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « media/audio/null_audio_sink.h ('k') | media/base/audio_renderer_mixer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/location.h"
9 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
10 #include "media/audio/fake_audio_worker.h" 9 #include "media/audio/fake_audio_worker.h"
11 #include "media/base/audio_hash.h" 10 #include "media/base/audio_hash.h"
12 11
13 namespace media { 12 namespace media {
14 13
15 NullAudioSink::NullAudioSink( 14 NullAudioSink::NullAudioSink(
16 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) 15 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
17 : initialized_(false), 16 : initialized_(false),
18 playing_(false), 17 playing_(false),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 63
65 fake_worker_->Stop(); 64 fake_worker_->Stop();
66 playing_ = false; 65 playing_ = false;
67 } 66 }
68 67
69 bool NullAudioSink::SetVolume(double volume) { 68 bool NullAudioSink::SetVolume(double volume) {
70 // Audio is always muted. 69 // Audio is always muted.
71 return volume == 0.0; 70 return volume == 0.0;
72 } 71 }
73 72
74 void NullAudioSink::SwitchOutputDevice(const std::string& device_id,
75 const GURL& security_origin,
76 const SwitchOutputDeviceCB& callback) {
77 DCHECK(task_runner_->BelongsToCurrentThread());
78 callback.Run(SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED);
79 }
80
81 void NullAudioSink::CallRender() { 73 void NullAudioSink::CallRender() {
82 DCHECK(task_runner_->BelongsToCurrentThread()); 74 DCHECK(task_runner_->BelongsToCurrentThread());
83 75
84 int frames_received = callback_->Render(audio_bus_.get(), 0); 76 int frames_received = callback_->Render(audio_bus_.get(), 0);
85 if (!audio_hash_ || frames_received <= 0) 77 if (!audio_hash_ || frames_received <= 0)
86 return; 78 return;
87 79
88 audio_hash_->Update(audio_bus_.get(), frames_received); 80 audio_hash_->Update(audio_bus_.get(), frames_received);
89 } 81 }
90 82
91 void NullAudioSink::StartAudioHashForTesting() { 83 void NullAudioSink::StartAudioHashForTesting() {
92 DCHECK(!initialized_); 84 DCHECK(!initialized_);
93 audio_hash_.reset(new AudioHash()); 85 audio_hash_.reset(new AudioHash());
94 } 86 }
95 87
96 std::string NullAudioSink::GetAudioHashForTesting() { 88 std::string NullAudioSink::GetAudioHashForTesting() {
97 return audio_hash_ ? audio_hash_->ToString() : std::string(); 89 return audio_hash_ ? audio_hash_->ToString() : std::string();
98 } 90 }
99 91
100 } // namespace media 92 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/null_audio_sink.h ('k') | media/base/audio_renderer_mixer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698