Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/codec_manager_unittest.cc

Issue 1416633011: CodecManager::RegisterEncoder: Call SetFec on new encoder, not old (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@rac3
Patch Set: better test Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/codec_manager.cc ('k') | webrtc/modules/modules.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h"
13 #include "webrtc/modules/audio_coding/main/acm2/codec_manager.h"
14
15 namespace webrtc {
16 namespace acm2 {
17
18 using ::testing::Return;
19
20 namespace {
21
22 // Create a MockAudioEncoder with some reasonable default behavior.
23 rtc::scoped_ptr<MockAudioEncoder> CreateMockEncoder() {
24 auto enc = rtc_make_scoped_ptr(new MockAudioEncoder);
25 EXPECT_CALL(*enc, SampleRateHz()).WillRepeatedly(Return(8000));
26 EXPECT_CALL(*enc, NumChannels()).WillRepeatedly(Return(1));
27 EXPECT_CALL(*enc, Max10MsFramesInAPacket()).WillRepeatedly(Return(1));
28 EXPECT_CALL(*enc, Die());
29 return enc;
30 }
31
32 } // namespace
33
34 TEST(CodecManagerTest, ExternalEncoderFec) {
35 auto enc0 = CreateMockEncoder();
36 auto enc1 = CreateMockEncoder();
37 {
38 ::testing::InSequence s;
39 EXPECT_CALL(*enc0, Mark("A"));
40 EXPECT_CALL(*enc0, SetFec(true)).WillOnce(Return(true));
41 EXPECT_CALL(*enc1, SetFec(true)).WillOnce(Return(true));
42 }
43
44 CodecManager cm;
45 EXPECT_FALSE(cm.codec_fec_enabled());
46 cm.RegisterEncoder(enc0.get());
47 EXPECT_FALSE(cm.codec_fec_enabled());
48 enc0->Mark("A");
49 EXPECT_EQ(0, cm.SetCodecFEC(true));
50 EXPECT_TRUE(cm.codec_fec_enabled());
51 cm.RegisterEncoder(enc1.get());
52 EXPECT_TRUE(cm.codec_fec_enabled());
hlundin-webrtc 2015/11/11 11:56:02 Also try the opposite: disable FEC and verify that
kwiberg-webrtc 2015/11/11 14:09:22 Done.
53 }
54
55 } // namespace acm2
56 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/codec_manager.cc ('k') | webrtc/modules/modules.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698