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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 MockAudioEncoderMutable external_encoder; |
103 EXPECT_CALL(external_encoder, GetTargetBitrate()) | |
104 .WillRepeatedly(Return(-1)); // Flag adaptive bitrate (doesn't matter). | |
105 codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1); | 103 codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1); |
106 const int kSampleRateHz = 8000; | 104 const int kSampleRateHz = 8000; |
107 const int kPacketSizeSamples = kSampleRateHz / 100; | 105 const int kPacketSizeSamples = kSampleRateHz / 100; |
108 int16_t audio[kPacketSizeSamples] = {0}; | 106 int16_t audio[kPacketSizeSamples] = {0}; |
109 uint8_t encoded[kPacketSizeSamples]; | 107 uint8_t encoded[kPacketSizeSamples]; |
110 AudioEncoder::EncodedInfo info; | 108 AudioEncoder::EncodedInfo info; |
111 EXPECT_CALL(external_encoder, SampleRateHz()) | 109 EXPECT_CALL(external_encoder, SampleRateHz()) |
112 .WillRepeatedly(Return(kSampleRateHz)); | 110 .WillRepeatedly(Return(kSampleRateHz)); |
113 | 111 |
114 { | 112 { |
(...skipping 28 matching lines...) Expand all Loading... |
143 // Change back to external encoder again. | 141 // Change back to external encoder again. |
144 codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1); | 142 codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1); |
145 info = codec_owner_.Encoder()->Encode(2, audio, arraysize(audio), | 143 info = codec_owner_.Encoder()->Encode(2, audio, arraysize(audio), |
146 arraysize(encoded), encoded); | 144 arraysize(encoded), encoded); |
147 EXPECT_EQ(2u, info.encoded_timestamp); | 145 EXPECT_EQ(2u, info.encoded_timestamp); |
148 external_encoder.Reset(); // Dummy call to mark the sequence of expectations. | 146 external_encoder.Reset(); // Dummy call to mark the sequence of expectations. |
149 } | 147 } |
150 | 148 |
151 } // namespace acm2 | 149 } // namespace acm2 |
152 } // namespace webrtc | 150 } // namespace webrtc |
OLD | NEW |