| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "media/base/audio_bus.h" | 9 #include "media/base/audio_bus.h" |
| 10 #include "media/base/audio_hash.h" | 10 #include "media/base/audio_hash.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 void GenerateUniqueChannels(AudioBus* audio_bus) { | 31 void GenerateUniqueChannels(AudioBus* audio_bus) { |
| 32 // Use an AudioBus wrapper to avoid an extra memcpy when filling channels. | 32 // Use an AudioBus wrapper to avoid an extra memcpy when filling channels. |
| 33 std::unique_ptr<AudioBus> wrapped_bus = AudioBus::CreateWrapper(1); | 33 std::unique_ptr<AudioBus> wrapped_bus = AudioBus::CreateWrapper(1); |
| 34 wrapped_bus->set_frames(audio_bus->frames()); | 34 wrapped_bus->set_frames(audio_bus->frames()); |
| 35 | 35 |
| 36 // Since FakeAudioRenderCallback generates only a single channel of unique | 36 // Since FakeAudioRenderCallback generates only a single channel of unique |
| 37 // audio data, we need to fill each channel manually. | 37 // audio data, we need to fill each channel manually. |
| 38 for (int ch = 0; ch < audio_bus->channels(); ++ch) { | 38 for (int ch = 0; ch < audio_bus->channels(); ++ch) { |
| 39 wrapped_bus->SetChannelData(0, audio_bus->channel(ch)); | 39 wrapped_bus->SetChannelData(0, audio_bus->channel(ch)); |
| 40 fake_callback_.Render(wrapped_bus.get(), 0, 0); | 40 fake_callback_.Render(base::TimeDelta(), base::TimeTicks::Now(), 0, |
| 41 wrapped_bus.get()); |
| 41 } | 42 } |
| 42 } | 43 } |
| 43 | 44 |
| 44 ~AudioHashTest() override {} | 45 ~AudioHashTest() override {} |
| 45 | 46 |
| 46 protected: | 47 protected: |
| 47 std::unique_ptr<AudioBus> bus_one_; | 48 std::unique_ptr<AudioBus> bus_one_; |
| 48 std::unique_ptr<AudioBus> bus_two_; | 49 std::unique_ptr<AudioBus> bus_two_; |
| 49 FakeAudioRenderCallback fake_callback_; | 50 FakeAudioRenderCallback fake_callback_; |
| 50 | 51 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Twiddle the values too much... | 162 // Twiddle the values too much... |
| 162 for (int i = 0; i < bus_one_->frames(); ++i) | 163 for (int i = 0; i < bus_one_->frames(); ++i) |
| 163 channel[i] += 0.0001f; | 164 channel[i] += 0.0001f; |
| 164 | 165 |
| 165 AudioHash hash_three; | 166 AudioHash hash_three; |
| 166 hash_three.Update(bus_one_.get(), bus_one_->frames()); | 167 hash_three.Update(bus_one_.get(), bus_one_->frames()); |
| 167 EXPECT_NE(hash_one.ToString(), hash_three.ToString()); | 168 EXPECT_NE(hash_one.ToString(), hash_three.ToString()); |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace media | 171 } // namespace media |
| OLD | NEW |