| 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 17 matching lines...) Expand all Loading... |
| 28 const CodecInst kCodecOpus = {kPayloadType, "opus", 48000, 960, 1, 32000}; | 28 const CodecInst kCodecOpus = {kPayloadType, "opus", 48000, 960, 1, 32000}; |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 class MixingTest : public AfterInitializationFixture { | 32 class MixingTest : public AfterInitializationFixture { |
| 33 protected: | 33 protected: |
| 34 MixingTest() | 34 MixingTest() |
| 35 : output_filename_(test::OutputPath() + "mixing_test_output.pcm") { | 35 : output_filename_(test::OutputPath() + "mixing_test_output.pcm") { |
| 36 } | 36 } |
| 37 void SetUp() { | 37 void SetUp() { |
| 38 transport_ = new LoopBackTransport(voe_network_); | 38 transport_ = new LoopBackTransport(voe_network_, 0); |
| 39 } | 39 } |
| 40 void TearDown() { | 40 void TearDown() { |
| 41 delete transport_; | 41 delete transport_; |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Creates and mixes |num_remote_streams| which play a file "as microphone" | 44 // Creates and mixes |num_remote_streams| which play a file "as microphone" |
| 45 // with |num_local_streams| which play a file "locally", using a constant | 45 // with |num_local_streams| which play a file "locally", using a constant |
| 46 // amplitude of |input_value|. The local streams manifest as "anonymous" | 46 // amplitude of |input_value|. The local streams manifest as "anonymous" |
| 47 // mixing participants, meaning they will be mixed regardless of the number | 47 // mixing participants, meaning they will be mixed regardless of the number |
| 48 // of participants. (A stream is a VoiceEngine "channel"). | 48 // of participants. (A stream is a VoiceEngine "channel"). |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 codec_inst_stereo.pltype++; | 175 codec_inst_stereo.pltype++; |
| 176 for (size_t i = num_remote_streams_using_mono; i < streams.size(); ++i) { | 176 for (size_t i = num_remote_streams_using_mono; i < streams.size(); ++i) { |
| 177 StartRemoteStream(streams[i], codec_inst_stereo, 1234 + 2 * i); | 177 StartRemoteStream(streams[i], codec_inst_stereo, 1234 + 2 * i); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 // Start up a single remote stream. | 181 // Start up a single remote stream. |
| 182 void StartRemoteStream(int stream, const CodecInst& codec_inst, int port) { | 182 void StartRemoteStream(int stream, const CodecInst& codec_inst, int port) { |
| 183 EXPECT_EQ(0, voe_codec_->SetRecPayloadType(stream, codec_inst)); | 183 EXPECT_EQ(0, voe_codec_->SetRecPayloadType(stream, codec_inst)); |
| 184 EXPECT_EQ(0, voe_network_->RegisterExternalTransport(stream, *transport_)); | 184 EXPECT_EQ(0, voe_network_->RegisterExternalTransport(stream, *transport_)); |
| 185 EXPECT_EQ(0, voe_rtp_rtcp_->SetLocalSSRC( |
| 186 stream, static_cast<unsigned int>(stream))); |
| 187 transport_->AddChannel(stream, stream); |
| 185 EXPECT_EQ(0, voe_base_->StartReceive(stream)); | 188 EXPECT_EQ(0, voe_base_->StartReceive(stream)); |
| 186 EXPECT_EQ(0, voe_base_->StartPlayout(stream)); | 189 EXPECT_EQ(0, voe_base_->StartPlayout(stream)); |
| 187 EXPECT_EQ(0, voe_codec_->SetSendCodec(stream, codec_inst)); | 190 EXPECT_EQ(0, voe_codec_->SetSendCodec(stream, codec_inst)); |
| 188 EXPECT_EQ(0, voe_base_->StartSend(stream)); | 191 EXPECT_EQ(0, voe_base_->StartSend(stream)); |
| 189 EXPECT_EQ(0, voe_file_->StartPlayingFileAsMicrophone(stream, | 192 EXPECT_EQ(0, voe_file_->StartPlayingFileAsMicrophone(stream, |
| 190 input_filename_.c_str(), true)); | 193 input_filename_.c_str(), true)); |
| 191 } | 194 } |
| 192 | 195 |
| 193 void StopRemoteStreams(const std::vector<int>& streams) { | 196 void StopRemoteStreams(const std::vector<int>& streams) { |
| 194 for (size_t i = 0; i < streams.size(); ++i) { | 197 for (size_t i = 0; i < streams.size(); ++i) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 279 |
| 277 TEST_F(MixingTest, VerifyStereoAndMonoMixing) { | 280 TEST_F(MixingTest, VerifyStereoAndMonoMixing) { |
| 278 const int16_t kInputValue = 1000; | 281 const int16_t kInputValue = 1000; |
| 279 const int16_t kExpectedOutput = kInputValue * 2; | 282 const int16_t kExpectedOutput = kInputValue * 2; |
| 280 RunMixingTest(2, 0, 1, false, kInputValue, 1.1 * kExpectedOutput, | 283 RunMixingTest(2, 0, 1, false, kInputValue, 1.1 * kExpectedOutput, |
| 281 // Lower than 0.9 due to observed flakiness on bots. | 284 // Lower than 0.9 due to observed flakiness on bots. |
| 282 0.8 * kExpectedOutput, kCodecL16); | 285 0.8 * kExpectedOutput, kCodecL16); |
| 283 } | 286 } |
| 284 | 287 |
| 285 } // namespace webrtc | 288 } // namespace webrtc |
| OLD | NEW |