| 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 |
| 11 #include <memory> |
| 12 |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h" | 14 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h" |
| 13 #include "webrtc/modules/audio_coding/acm2/codec_manager.h" | 15 #include "webrtc/modules/audio_coding/acm2/codec_manager.h" |
| 14 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" | 16 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" |
| 15 | 17 |
| 16 namespace webrtc { | 18 namespace webrtc { |
| 17 namespace acm2 { | 19 namespace acm2 { |
| 18 | 20 |
| 19 using ::testing::Return; | 21 using ::testing::Return; |
| 20 | 22 |
| 21 namespace { | 23 namespace { |
| 22 | 24 |
| 23 // Create a MockAudioEncoder with some reasonable default behavior. | 25 // Create a MockAudioEncoder with some reasonable default behavior. |
| 24 rtc::scoped_ptr<MockAudioEncoder> CreateMockEncoder() { | 26 std::unique_ptr<MockAudioEncoder> CreateMockEncoder() { |
| 25 auto enc = rtc_make_scoped_ptr(new MockAudioEncoder); | 27 auto enc = std::unique_ptr<MockAudioEncoder>(new MockAudioEncoder); |
| 26 EXPECT_CALL(*enc, SampleRateHz()).WillRepeatedly(Return(8000)); | 28 EXPECT_CALL(*enc, SampleRateHz()).WillRepeatedly(Return(8000)); |
| 27 EXPECT_CALL(*enc, NumChannels()).WillRepeatedly(Return(1)); | 29 EXPECT_CALL(*enc, NumChannels()).WillRepeatedly(Return(1)); |
| 28 EXPECT_CALL(*enc, Max10MsFramesInAPacket()).WillRepeatedly(Return(1)); | 30 EXPECT_CALL(*enc, Max10MsFramesInAPacket()).WillRepeatedly(Return(1)); |
| 29 EXPECT_CALL(*enc, Die()); | 31 EXPECT_CALL(*enc, Die()); |
| 30 return enc; | 32 return enc; |
| 31 } | 33 } |
| 32 | 34 |
| 33 } // namespace | 35 } // namespace |
| 34 | 36 |
| 35 TEST(CodecManagerTest, ExternalEncoderFec) { | 37 TEST(CodecManagerTest, ExternalEncoderFec) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 64 EXPECT_TRUE(rac.RentEncoderStack(cm.GetStackParams())); | 66 EXPECT_TRUE(rac.RentEncoderStack(cm.GetStackParams())); |
| 65 enc0->Mark("B"); | 67 enc0->Mark("B"); |
| 66 EXPECT_FALSE(cm.GetStackParams()->use_codec_fec); | 68 EXPECT_FALSE(cm.GetStackParams()->use_codec_fec); |
| 67 cm.GetStackParams()->speech_encoder = enc0.get(); | 69 cm.GetStackParams()->speech_encoder = enc0.get(); |
| 68 EXPECT_TRUE(rac.RentEncoderStack(cm.GetStackParams())); | 70 EXPECT_TRUE(rac.RentEncoderStack(cm.GetStackParams())); |
| 69 EXPECT_FALSE(cm.GetStackParams()->use_codec_fec); | 71 EXPECT_FALSE(cm.GetStackParams()->use_codec_fec); |
| 70 } | 72 } |
| 71 | 73 |
| 72 } // namespace acm2 | 74 } // namespace acm2 |
| 73 } // namespace webrtc | 75 } // namespace webrtc |
| OLD | NEW |