OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 using testing::_; | 28 using testing::_; |
29 using testing::Exactly; | 29 using testing::Exactly; |
30 using testing::Invoke; | 30 using testing::Invoke; |
31 using testing::Return; | 31 using testing::Return; |
32 | 32 |
33 namespace webrtc { | 33 namespace webrtc { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 constexpr int kDefaultSampleRateHz = 48000; | 37 constexpr int kDefaultSampleRateHz = 48000; |
38 constexpr int kId = 1; | |
39 | 38 |
40 // Utility function that resets the frame member variables with | 39 // Utility function that resets the frame member variables with |
41 // sensible defaults. | 40 // sensible defaults. |
42 void ResetFrame(AudioFrame* frame) { | 41 void ResetFrame(AudioFrame* frame) { |
43 frame->id_ = kId; | |
44 frame->sample_rate_hz_ = kDefaultSampleRateHz; | 42 frame->sample_rate_hz_ = kDefaultSampleRateHz; |
45 frame->num_channels_ = 1; | 43 frame->num_channels_ = 1; |
46 | 44 |
47 // Frame duration 10ms. | 45 // Frame duration 10ms. |
48 frame->samples_per_channel_ = kDefaultSampleRateHz / 100; | 46 frame->samples_per_channel_ = kDefaultSampleRateHz / 100; |
49 frame->vad_activity_ = AudioFrame::kVadActive; | 47 frame->vad_activity_ = AudioFrame::kVadActive; |
50 frame->speech_type_ = AudioFrame::kNormalSpeech; | 48 frame->speech_type_ = AudioFrame::kNormalSpeech; |
51 } | 49 } |
52 | 50 |
53 std::string ProduceDebugText(int sample_rate_hz, | 51 std::string ProduceDebugText(int sample_rate_hz, |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 534 } |
537 | 535 |
538 mixer->Mix(number_of_channels, &frame_for_mixing); | 536 mixer->Mix(number_of_channels, &frame_for_mixing); |
539 EXPECT_EQ(rate, frame_for_mixing.sample_rate_hz_); | 537 EXPECT_EQ(rate, frame_for_mixing.sample_rate_hz_); |
540 EXPECT_EQ(number_of_channels, frame_for_mixing.num_channels_); | 538 EXPECT_EQ(number_of_channels, frame_for_mixing.num_channels_); |
541 } | 539 } |
542 } | 540 } |
543 } | 541 } |
544 } | 542 } |
545 } // namespace webrtc | 543 } // namespace webrtc |
OLD | NEW |