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

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

Issue 1596523005: Drop WebRTC audio data if OS has skipped frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review (tommi@) Created 4 years, 11 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "media/base/audio_bus.h" 9 #include "media/base/audio_bus.h"
10 #include "media/base/audio_pull_fifo.h" 10 #include "media/base/audio_pull_fifo.h"
(...skipping 10 matching lines...) Expand all
21 // Number of channels in each audio bus. 21 // Number of channels in each audio bus.
22 static int kChannels = 2; 22 static int kChannels = 2;
23 23
24 // Max number of audio framed the FIFO can contain. 24 // Max number of audio framed the FIFO can contain.
25 static const int kMaxFramesInFifo = 2048; 25 static const int kMaxFramesInFifo = 2048;
26 26
27 class AudioPullFifoTest 27 class AudioPullFifoTest
28 : public testing::TestWithParam<int> { 28 : public testing::TestWithParam<int> {
29 public: 29 public:
30 AudioPullFifoTest() 30 AudioPullFifoTest()
31 : pull_fifo_(kChannels, kMaxFramesInFifo, base::Bind( 31 : pull_fifo_(kChannels,
32 &AudioPullFifoTest::ProvideInput, base::Unretained(this))), 32 kMaxFramesInFifo,
33 audio_bus_(AudioBus::Create(kChannels, kMaxFramesInFifo)), 33 base::Bind(&AudioPullFifoTest::ProvideInput,
34 fill_value_(0), 34 base::Unretained(this))),
35 last_frame_delay_(-1) {} 35 audio_bus_(AudioBus::Create(kChannels, kMaxFramesInFifo)),
36 fill_value_(0),
37 last_frame_delay_(-1) {
38 EXPECT_EQ(kMaxFramesInFifo, pull_fifo_.SizeInFrames());
39 }
36 virtual ~AudioPullFifoTest() {} 40 virtual ~AudioPullFifoTest() {}
37 41
38 void VerifyValue(const float data[], int size, float start_value) { 42 void VerifyValue(const float data[], int size, float start_value) {
39 float value = start_value; 43 float value = start_value;
40 for (int i = 0; i < size; ++i) { 44 for (int i = 0; i < size; ++i) {
41 ASSERT_FLOAT_EQ(value++, data[i]) << "i=" << i; 45 ASSERT_FLOAT_EQ(value++, data[i]) << "i=" << i;
42 } 46 }
43 } 47 }
44 48
45 // Consume data using different sizes, acquire audio frames from the FIFO 49 // Consume data using different sizes, acquire audio frames from the FIFO
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ConsumeTest(GetParam()); 92 ConsumeTest(GetParam());
89 } 93 }
90 94
91 // Test common |frames_to_consume| values which will be used as input 95 // Test common |frames_to_consume| values which will be used as input
92 // parameter to AudioPullFifo::Consume() when the consumer asks for data. 96 // parameter to AudioPullFifo::Consume() when the consumer asks for data.
93 INSTANTIATE_TEST_CASE_P( 97 INSTANTIATE_TEST_CASE_P(
94 AudioPullFifoTest, AudioPullFifoTest, 98 AudioPullFifoTest, AudioPullFifoTest,
95 testing::Values(544, 512, 512, 512, 512, 2048, 544, 441, 440, 433, 500)); 99 testing::Values(544, 512, 512, 512, 512, 2048, 544, 441, 440, 433, 500));
96 100
97 } // namespace media 101 } // namespace media
OLDNEW
« content/renderer/media/webrtc_audio_renderer.cc ('K') | « media/base/audio_pull_fifo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698