OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 TEST_F(ExternalMediaTest, | 78 TEST_F(ExternalMediaTest, |
79 ExternalMixingWorks) { | 79 ExternalMixingWorks) { |
80 webrtc::AudioFrame frame; | 80 webrtc::AudioFrame frame; |
81 PausePlaying(); | 81 PausePlaying(); |
82 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true)); | 82 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true)); |
83 ResumePlaying(); | 83 ResumePlaying(); |
84 EXPECT_EQ(0, voe_xmedia_->GetAudioFrame(channel_, 0, &frame)); | 84 EXPECT_EQ(0, voe_xmedia_->GetAudioFrame(channel_, 0, &frame)); |
85 EXPECT_GT(frame.sample_rate_hz_, 0); | 85 EXPECT_GT(frame.sample_rate_hz_, 0); |
86 EXPECT_GT(frame.samples_per_channel_, 0); | 86 EXPECT_GT(frame.samples_per_channel_, 0U); |
87 PausePlaying(); | 87 PausePlaying(); |
88 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false)); | 88 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false)); |
89 ResumePlaying(); | 89 ResumePlaying(); |
90 } | 90 } |
91 | 91 |
92 TEST_F(ExternalMediaTest, | 92 TEST_F(ExternalMediaTest, |
93 ExternalMixingResamplesToDesiredFrequency) { | 93 ExternalMixingResamplesToDesiredFrequency) { |
94 const int kValidFrequencies[] = {8000, 16000, 22000, 32000, 48000}; | 94 const int kValidFrequencies[] = {8000, 16000, 22000, 32000, 48000}; |
95 webrtc::AudioFrame frame; | 95 webrtc::AudioFrame frame; |
96 PausePlaying(); | 96 PausePlaying(); |
97 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true)); | 97 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true)); |
98 ResumePlaying(); | 98 ResumePlaying(); |
99 for (size_t i = 0; i < arraysize(kValidFrequencies); i++) { | 99 for (size_t i = 0; i < arraysize(kValidFrequencies); i++) { |
100 int f = kValidFrequencies[i]; | 100 int f = kValidFrequencies[i]; |
101 EXPECT_EQ(0, voe_xmedia_->GetAudioFrame(channel_, f, &frame)) | 101 EXPECT_EQ(0, voe_xmedia_->GetAudioFrame(channel_, f, &frame)) |
102 << "Resampling succeeds for freq=" << f; | 102 << "Resampling succeeds for freq=" << f; |
103 EXPECT_EQ(f, frame.sample_rate_hz_); | 103 EXPECT_EQ(f, frame.sample_rate_hz_); |
104 EXPECT_EQ(f / 100, frame.samples_per_channel_); | 104 EXPECT_EQ(static_cast<size_t>(f / 100), frame.samples_per_channel_); |
105 } | 105 } |
106 PausePlaying(); | 106 PausePlaying(); |
107 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false)); | 107 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false)); |
108 ResumePlaying(); | 108 ResumePlaying(); |
109 } | 109 } |
110 | 110 |
111 TEST_F(ExternalMediaTest, | 111 TEST_F(ExternalMediaTest, |
112 ExternalMixingResamplingToInvalidFrequenciesFails) { | 112 ExternalMixingResamplingToInvalidFrequenciesFails) { |
113 const int kInvalidFrequencies[] = {-8000, -1}; | 113 const int kInvalidFrequencies[] = {-8000, -1}; |
114 webrtc::AudioFrame frame; | 114 webrtc::AudioFrame frame; |
115 PausePlaying(); | 115 PausePlaying(); |
116 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true)); | 116 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true)); |
117 ResumePlaying(); | 117 ResumePlaying(); |
118 for (size_t i = 0; i < arraysize(kInvalidFrequencies); i++) { | 118 for (size_t i = 0; i < arraysize(kInvalidFrequencies); i++) { |
119 int f = kInvalidFrequencies[i]; | 119 int f = kInvalidFrequencies[i]; |
120 EXPECT_EQ(-1, voe_xmedia_->GetAudioFrame(channel_, f, &frame)) | 120 EXPECT_EQ(-1, voe_xmedia_->GetAudioFrame(channel_, f, &frame)) |
121 << "Resampling fails for freq=" << f; | 121 << "Resampling fails for freq=" << f; |
122 } | 122 } |
123 PausePlaying(); | 123 PausePlaying(); |
124 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false)); | 124 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false)); |
125 ResumePlaying(); | 125 ResumePlaying(); |
126 } | 126 } |
OLD | NEW |