OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // Verify NoEncoding. | 93 // Verify NoEncoding. |
94 expected_timestamp += 2 * kDataLengthSamples; | 94 expected_timestamp += 2 * kDataLengthSamples; |
95 { | 95 { |
96 SCOPED_TRACE("Fourth encoding"); | 96 SCOPED_TRACE("Fourth encoding"); |
97 EncodeAndVerify(0, expected_timestamp, kCngPt, 1); | 97 EncodeAndVerify(0, expected_timestamp, kCngPt, 1); |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 TEST_F(CodecOwnerTest, ExternalEncoder) { | 101 TEST_F(CodecOwnerTest, ExternalEncoder) { |
102 MockAudioEncoderMutable external_encoder; | 102 MockAudioEncoder external_encoder; |
103 codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1); | 103 codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1); |
104 const int kSampleRateHz = 8000; | 104 const int kSampleRateHz = 8000; |
105 const int kPacketSizeSamples = kSampleRateHz / 100; | 105 const int kPacketSizeSamples = kSampleRateHz / 100; |
106 int16_t audio[kPacketSizeSamples] = {0}; | 106 int16_t audio[kPacketSizeSamples] = {0}; |
107 uint8_t encoded[kPacketSizeSamples]; | 107 uint8_t encoded[kPacketSizeSamples]; |
108 AudioEncoder::EncodedInfo info; | 108 AudioEncoder::EncodedInfo info; |
109 EXPECT_CALL(external_encoder, SampleRateHz()) | 109 EXPECT_CALL(external_encoder, SampleRateHz()) |
110 .WillRepeatedly(Return(kSampleRateHz)); | 110 .WillRepeatedly(Return(kSampleRateHz)); |
111 | 111 |
112 { | 112 { |
(...skipping 28 matching lines...) Expand all Loading... |
141 // Change back to external encoder again. | 141 // Change back to external encoder again. |
142 codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1); | 142 codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1); |
143 info = codec_owner_.Encoder()->Encode(2, audio, arraysize(audio), | 143 info = codec_owner_.Encoder()->Encode(2, audio, arraysize(audio), |
144 arraysize(encoded), encoded); | 144 arraysize(encoded), encoded); |
145 EXPECT_EQ(2u, info.encoded_timestamp); | 145 EXPECT_EQ(2u, info.encoded_timestamp); |
146 external_encoder.Reset(); // Dummy call to mark the sequence of expectations. | 146 external_encoder.Reset(); // Dummy call to mark the sequence of expectations. |
147 } | 147 } |
148 | 148 |
149 } // namespace acm2 | 149 } // namespace acm2 |
150 } // namespace webrtc | 150 } // namespace webrtc |
OLD | NEW |