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