| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 Sender::Sender() | 47 Sender::Sender() |
| 48 : _acm(NULL), | 48 : _acm(NULL), |
| 49 _pcmFile(), | 49 _pcmFile(), |
| 50 _audioFrame(), | 50 _audioFrame(), |
| 51 _packetization(NULL) { | 51 _packetization(NULL) { |
| 52 } | 52 } |
| 53 | 53 |
| 54 void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream, | 54 void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream, |
| 55 std::string in_file_name, int sample_rate, int channels) { | 55 std::string in_file_name, int sample_rate, size_t channels) { |
| 56 struct CodecInst sendCodec; | 56 struct CodecInst sendCodec; |
| 57 int noOfCodecs = acm->NumberOfCodecs(); | 57 int noOfCodecs = acm->NumberOfCodecs(); |
| 58 int codecNo; | 58 int codecNo; |
| 59 | 59 |
| 60 // Open input file | 60 // Open input file |
| 61 const std::string file_name = webrtc::test::ResourcePath(in_file_name, "pcm"); | 61 const std::string file_name = webrtc::test::ResourcePath(in_file_name, "pcm"); |
| 62 _pcmFile.Open(file_name, sample_rate, "rb"); | 62 _pcmFile.Open(file_name, sample_rate, "rb"); |
| 63 if (channels == 2) { | 63 if (channels == 2) { |
| 64 _pcmFile.ReadStereo(true); | 64 _pcmFile.ReadStereo(true); |
| 65 } | 65 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 Receiver::Receiver() | 116 Receiver::Receiver() |
| 117 : _playoutLengthSmpls(WEBRTC_10MS_PCM_AUDIO), | 117 : _playoutLengthSmpls(WEBRTC_10MS_PCM_AUDIO), |
| 118 _payloadSizeBytes(MAX_INCOMING_PAYLOAD) { | 118 _payloadSizeBytes(MAX_INCOMING_PAYLOAD) { |
| 119 } | 119 } |
| 120 | 120 |
| 121 void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream, | 121 void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream, |
| 122 std::string out_file_name, int channels) { | 122 std::string out_file_name, size_t channels) { |
| 123 struct CodecInst recvCodec = CodecInst(); | 123 struct CodecInst recvCodec = CodecInst(); |
| 124 int noOfCodecs; | 124 int noOfCodecs; |
| 125 EXPECT_EQ(0, acm->InitializeReceiver()); | 125 EXPECT_EQ(0, acm->InitializeReceiver()); |
| 126 | 126 |
| 127 noOfCodecs = acm->NumberOfCodecs(); | 127 noOfCodecs = acm->NumberOfCodecs(); |
| 128 for (int i = 0; i < noOfCodecs; i++) { | 128 for (int i = 0; i < noOfCodecs; i++) { |
| 129 EXPECT_EQ(0, acm->Codec(i, &recvCodec)); | 129 EXPECT_EQ(0, acm->Codec(i, &recvCodec)); |
| 130 if (recvCodec.channels == channels) | 130 if (recvCodec.channels == channels) |
| 131 EXPECT_EQ(0, acm->RegisterReceiveCodec(recvCodec)); | 131 EXPECT_EQ(0, acm->RegisterReceiveCodec(recvCodec)); |
| 132 // Forces mono/stereo for Opus. | 132 // Forces mono/stereo for Opus. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 if (acm->SendCodec(&sendCodecInst) >= 0) { | 343 if (acm->SendCodec(&sendCodecInst) >= 0) { |
| 344 _sender.Run(); | 344 _sender.Run(); |
| 345 } | 345 } |
| 346 _sender.Teardown(); | 346 _sender.Teardown(); |
| 347 rtpFile.Close(); | 347 rtpFile.Close(); |
| 348 | 348 |
| 349 return fileName; | 349 return fileName; |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace webrtc | 352 } // namespace webrtc |
| OLD | NEW |