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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 Receiver::Receiver() | 120 Receiver::Receiver() |
121 : _playoutLengthSmpls(WEBRTC_10MS_PCM_AUDIO), | 121 : _playoutLengthSmpls(WEBRTC_10MS_PCM_AUDIO), |
122 _payloadSizeBytes(MAX_INCOMING_PAYLOAD) { | 122 _payloadSizeBytes(MAX_INCOMING_PAYLOAD) { |
123 } | 123 } |
124 | 124 |
125 void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream, | 125 void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream, |
126 std::string out_file_name, int channels) { | 126 std::string out_file_name, size_t channels) { |
127 struct CodecInst recvCodec = CodecInst(); | 127 struct CodecInst recvCodec = CodecInst(); |
128 int noOfCodecs; | 128 int noOfCodecs; |
129 EXPECT_EQ(0, acm->InitializeReceiver()); | 129 EXPECT_EQ(0, acm->InitializeReceiver()); |
130 | 130 |
131 noOfCodecs = acm->NumberOfCodecs(); | 131 noOfCodecs = acm->NumberOfCodecs(); |
132 for (int i = 0; i < noOfCodecs; i++) { | 132 for (int i = 0; i < noOfCodecs; i++) { |
133 EXPECT_EQ(0, acm->Codec(i, &recvCodec)); | 133 EXPECT_EQ(0, acm->Codec(i, &recvCodec)); |
134 if (recvCodec.channels == channels) | 134 if (recvCodec.channels == channels) |
135 EXPECT_EQ(0, acm->RegisterReceiveCodec(recvCodec)); | 135 EXPECT_EQ(0, acm->RegisterReceiveCodec(recvCodec)); |
136 // Forces mono/stereo for Opus. | 136 // Forces mono/stereo for Opus. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 if (acm->SendCodec()) { | 346 if (acm->SendCodec()) { |
347 _sender.Run(); | 347 _sender.Run(); |
348 } | 348 } |
349 _sender.Teardown(); | 349 _sender.Teardown(); |
350 rtpFile.Close(); | 350 rtpFile.Close(); |
351 | 351 |
352 return fileName; | 352 return fileName; |
353 } | 353 } |
354 | 354 |
355 } // namespace webrtc | 355 } // namespace webrtc |
OLD | NEW |