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

Side by Side Diff: webrtc/pc/channelmanager_unittest.cc

Issue 2408153002: Remove cricket::VideoCodec with, height and framerate properties (Closed)
Patch Set: Rebased Created 4 years, 2 months 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/pc/channel_unittest.cc ('k') | webrtc/pc/mediasession_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2008 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 "webrtc/api/fakemediacontroller.h" 11 #include "webrtc/api/fakemediacontroller.h"
12 #include "webrtc/base/gunit.h" 12 #include "webrtc/base/gunit.h"
13 #include "webrtc/base/logging.h" 13 #include "webrtc/base/logging.h"
14 #include "webrtc/base/thread.h" 14 #include "webrtc/base/thread.h"
15 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 15 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
16 #include "webrtc/media/base/fakemediaengine.h" 16 #include "webrtc/media/base/fakemediaengine.h"
17 #include "webrtc/media/base/fakevideocapturer.h" 17 #include "webrtc/media/base/fakevideocapturer.h"
18 #include "webrtc/media/base/testutils.h" 18 #include "webrtc/media/base/testutils.h"
19 #include "webrtc/media/engine/fakewebrtccall.h" 19 #include "webrtc/media/engine/fakewebrtccall.h"
20 #include "webrtc/p2p/base/faketransportcontroller.h" 20 #include "webrtc/p2p/base/faketransportcontroller.h"
21 #include "webrtc/pc/channelmanager.h" 21 #include "webrtc/pc/channelmanager.h"
22 22
23 namespace cricket { 23 namespace cricket {
24 24
25 static const AudioCodec kAudioCodecs[] = { 25 static const AudioCodec kAudioCodecs[] = {
26 AudioCodec(97, "voice", 1, 2, 3), AudioCodec(111, "OPUS", 48000, 32000, 2), 26 AudioCodec(97, "voice", 1, 2, 3), AudioCodec(111, "OPUS", 48000, 32000, 2),
27 }; 27 };
28 28
29 static const VideoCodec kVideoCodecs[] = { 29 static const VideoCodec kVideoCodecs[] = {
30 VideoCodec(99, "H264", 100, 200, 300), 30 VideoCodec(99, "H264"), VideoCodec(100, "VP8"), VideoCodec(96, "rtx"),
31 VideoCodec(100, "VP8", 100, 200, 300), VideoCodec(96, "rtx", 100, 200, 300),
32 }; 31 };
33 32
34 class ChannelManagerTest : public testing::Test { 33 class ChannelManagerTest : public testing::Test {
35 protected: 34 protected:
36 ChannelManagerTest() 35 ChannelManagerTest()
37 : fme_(new cricket::FakeMediaEngine()), 36 : fme_(new cricket::FakeMediaEngine()),
38 fdme_(new cricket::FakeDataEngine()), 37 fdme_(new cricket::FakeDataEngine()),
39 cm_(new cricket::ChannelManager(fme_, fdme_, rtc::Thread::Current())), 38 cm_(new cricket::ChannelManager(fme_, fdme_, rtc::Thread::Current())),
40 fake_call_(webrtc::Call::Config(&event_log_)), 39 fake_call_(webrtc::Call::Config(&event_log_)),
41 fake_mc_(cm_, &fake_call_), 40 fake_mc_(cm_, &fake_call_),
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 EXPECT_TRUE(video_channel == nullptr); 163 EXPECT_TRUE(video_channel == nullptr);
165 cricket::DataChannel* data_channel = 164 cricket::DataChannel* data_channel =
166 cm_->CreateDataChannel(transport_controller_, cricket::CN_DATA, nullptr, 165 cm_->CreateDataChannel(transport_controller_, cricket::CN_DATA, nullptr,
167 false, cricket::DCT_RTP); 166 false, cricket::DCT_RTP);
168 EXPECT_TRUE(data_channel == nullptr); 167 EXPECT_TRUE(data_channel == nullptr);
169 cm_->Terminate(); 168 cm_->Terminate();
170 } 169 }
171 170
172 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { 171 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) {
173 std::vector<VideoCodec> codecs; 172 std::vector<VideoCodec> codecs;
174 const VideoCodec rtx_codec(96, "rtx", 0, 0, 0); 173 const VideoCodec rtx_codec(96, "rtx");
175 174
176 // By default RTX is disabled. 175 // By default RTX is disabled.
177 cm_->GetSupportedVideoCodecs(&codecs); 176 cm_->GetSupportedVideoCodecs(&codecs);
178 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec)); 177 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec));
179 178
180 // Enable and check. 179 // Enable and check.
181 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); 180 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true));
182 cm_->GetSupportedVideoCodecs(&codecs); 181 cm_->GetSupportedVideoCodecs(&codecs);
183 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); 182 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec));
184 183
185 // Disable and check. 184 // Disable and check.
186 EXPECT_TRUE(cm_->SetVideoRtxEnabled(false)); 185 EXPECT_TRUE(cm_->SetVideoRtxEnabled(false));
187 cm_->GetSupportedVideoCodecs(&codecs); 186 cm_->GetSupportedVideoCodecs(&codecs);
188 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec)); 187 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec));
189 188
190 // Cannot toggle rtx after initialization. 189 // Cannot toggle rtx after initialization.
191 EXPECT_TRUE(cm_->Init()); 190 EXPECT_TRUE(cm_->Init());
192 EXPECT_FALSE(cm_->SetVideoRtxEnabled(true)); 191 EXPECT_FALSE(cm_->SetVideoRtxEnabled(true));
193 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); 192 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false));
194 193
195 // Can set again after terminate. 194 // Can set again after terminate.
196 cm_->Terminate(); 195 cm_->Terminate();
197 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); 196 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true));
198 cm_->GetSupportedVideoCodecs(&codecs); 197 cm_->GetSupportedVideoCodecs(&codecs);
199 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); 198 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec));
200 } 199 }
201 200
202 } // namespace cricket 201 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/pc/channel_unittest.cc ('k') | webrtc/pc/mediasession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698