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

Side by Side Diff: media/base/audio_hash_unittest.cc

Issue 1538563002: Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fix. git cl format. Rebase. Created 5 years 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/base/audio_converter_unittest.cc ('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 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "media/base/audio_bus.h" 6 #include "media/base/audio_bus.h"
7 #include "media/base/audio_hash.h" 7 #include "media/base/audio_hash.h"
8 #include "media/base/fake_audio_render_callback.h" 8 #include "media/base/fake_audio_render_callback.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 16 matching lines...) Expand all
27 27
28 void GenerateUniqueChannels(AudioBus* audio_bus) { 28 void GenerateUniqueChannels(AudioBus* audio_bus) {
29 // Use an AudioBus wrapper to avoid an extra memcpy when filling channels. 29 // Use an AudioBus wrapper to avoid an extra memcpy when filling channels.
30 scoped_ptr<AudioBus> wrapped_bus = AudioBus::CreateWrapper(1); 30 scoped_ptr<AudioBus> wrapped_bus = AudioBus::CreateWrapper(1);
31 wrapped_bus->set_frames(audio_bus->frames()); 31 wrapped_bus->set_frames(audio_bus->frames());
32 32
33 // Since FakeAudioRenderCallback generates only a single channel of unique 33 // Since FakeAudioRenderCallback generates only a single channel of unique
34 // audio data, we need to fill each channel manually. 34 // audio data, we need to fill each channel manually.
35 for (int ch = 0; ch < audio_bus->channels(); ++ch) { 35 for (int ch = 0; ch < audio_bus->channels(); ++ch) {
36 wrapped_bus->SetChannelData(0, audio_bus->channel(ch)); 36 wrapped_bus->SetChannelData(0, audio_bus->channel(ch));
37 fake_callback_.Render(wrapped_bus.get(), 0); 37 fake_callback_.Render(wrapped_bus.get(), 0, 0);
38 } 38 }
39 } 39 }
40 40
41 ~AudioHashTest() override {} 41 ~AudioHashTest() override {}
42 42
43 protected: 43 protected:
44 scoped_ptr<AudioBus> bus_one_; 44 scoped_ptr<AudioBus> bus_one_;
45 scoped_ptr<AudioBus> bus_two_; 45 scoped_ptr<AudioBus> bus_two_;
46 FakeAudioRenderCallback fake_callback_; 46 FakeAudioRenderCallback fake_callback_;
47 47
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // Twiddle the values too much... 158 // Twiddle the values too much...
159 for (int i = 0; i < bus_one_->frames(); ++i) 159 for (int i = 0; i < bus_one_->frames(); ++i)
160 channel[i] += 0.0001f; 160 channel[i] += 0.0001f;
161 161
162 AudioHash hash_three; 162 AudioHash hash_three;
163 hash_three.Update(bus_one_.get(), bus_one_->frames()); 163 hash_three.Update(bus_one_.get(), bus_one_->frames());
164 EXPECT_NE(hash_one.ToString(), hash_three.ToString()); 164 EXPECT_NE(hash_one.ToString(), hash_three.ToString());
165 } 165 }
166 166
167 } // namespace media 167 } // namespace media
OLDNEW
« no previous file with comments | « media/base/audio_converter_unittest.cc ('k') | media/base/audio_renderer_mixer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698