OLD | NEW |
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" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "media/audio/fake_audio_worker.h" | 10 #include "media/audio/fake_audio_worker.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 void NullAudioSink::SwitchOutputDevice(const std::string& device_id, | 86 void NullAudioSink::SwitchOutputDevice(const std::string& device_id, |
87 const url::Origin& security_origin, | 87 const url::Origin& security_origin, |
88 const OutputDeviceStatusCB& callback) { | 88 const OutputDeviceStatusCB& callback) { |
89 callback.Run(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL); | 89 callback.Run(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL); |
90 } | 90 } |
91 | 91 |
92 void NullAudioSink::CallRender() { | 92 void NullAudioSink::CallRender() { |
93 DCHECK(task_runner_->BelongsToCurrentThread()); | 93 DCHECK(task_runner_->BelongsToCurrentThread()); |
94 | 94 |
95 int frames_received = callback_->Render( | 95 int frames_received = callback_->Render(audio_bus_.get(), 0, 0); |
96 base::TimeDelta(), base::TimeTicks::Now(), 0, audio_bus_.get()); | |
97 if (!audio_hash_ || frames_received <= 0) | 96 if (!audio_hash_ || frames_received <= 0) |
98 return; | 97 return; |
99 | 98 |
100 audio_hash_->Update(audio_bus_.get(), frames_received); | 99 audio_hash_->Update(audio_bus_.get(), frames_received); |
101 } | 100 } |
102 | 101 |
103 void NullAudioSink::StartAudioHashForTesting() { | 102 void NullAudioSink::StartAudioHashForTesting() { |
104 DCHECK(!initialized_); | 103 DCHECK(!initialized_); |
105 audio_hash_.reset(new AudioHash()); | 104 audio_hash_.reset(new AudioHash()); |
106 } | 105 } |
107 | 106 |
108 std::string NullAudioSink::GetAudioHashForTesting() { | 107 std::string NullAudioSink::GetAudioHashForTesting() { |
109 return audio_hash_ ? audio_hash_->ToString() : std::string(); | 108 return audio_hash_ ? audio_hash_->ToString() : std::string(); |
110 } | 109 } |
111 | 110 |
112 } // namespace media | 111 } // namespace media |
OLD | NEW |