OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2008 Google Inc. | 3 * Copyright 2008 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 cricket::VideoChannel* video_channel = | 176 cricket::VideoChannel* video_channel = |
177 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, | 177 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, |
178 cricket::CN_VIDEO, false, VideoOptions()); | 178 cricket::CN_VIDEO, false, VideoOptions()); |
179 EXPECT_TRUE(video_channel == nullptr); | 179 EXPECT_TRUE(video_channel == nullptr); |
180 cricket::DataChannel* data_channel = cm_->CreateDataChannel( | 180 cricket::DataChannel* data_channel = cm_->CreateDataChannel( |
181 transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP); | 181 transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP); |
182 EXPECT_TRUE(data_channel == nullptr); | 182 EXPECT_TRUE(data_channel == nullptr); |
183 cm_->Terminate(); | 183 cm_->Terminate(); |
184 } | 184 } |
185 | 185 |
186 // Test that SetDefaultVideoCodec passes through the right values. | |
187 TEST_F(ChannelManagerTest, SetDefaultVideoEncoderConfig) { | |
188 cricket::VideoCodec codec(96, "G264", 1280, 720, 60, 0); | |
189 cricket::VideoEncoderConfig config(codec, 1, 2); | |
190 EXPECT_TRUE(cm_->Init()); | |
191 EXPECT_TRUE(cm_->SetDefaultVideoEncoderConfig(config)); | |
192 EXPECT_EQ(config, fme_->default_video_encoder_config()); | |
193 } | |
194 | |
195 struct GetCapturerFrameSize : public sigslot::has_slots<> { | |
196 void OnVideoFrame(VideoCapturer* capturer, const VideoFrame* frame) { | |
197 width = frame->GetWidth(); | |
198 height = frame->GetHeight(); | |
199 } | |
200 GetCapturerFrameSize(VideoCapturer* capturer) : width(0), height(0) { | |
201 capturer->SignalVideoFrame.connect(this, | |
202 &GetCapturerFrameSize::OnVideoFrame); | |
203 static_cast<FakeVideoCapturer*>(capturer)->CaptureFrame(); | |
204 } | |
205 size_t width; | |
206 size_t height; | |
207 }; | |
208 | |
209 // Test that SetDefaultVideoCodec passes through the right values. | |
210 TEST_F(ChannelManagerTest, SetDefaultVideoCodecBeforeInit) { | |
211 cricket::VideoCodec codec(96, "G264", 1280, 720, 60, 0); | |
212 cricket::VideoEncoderConfig config(codec, 1, 2); | |
213 EXPECT_TRUE(cm_->SetDefaultVideoEncoderConfig(config)); | |
214 EXPECT_TRUE(cm_->Init()); | |
215 EXPECT_EQ(config, fme_->default_video_encoder_config()); | |
216 } | |
217 | |
218 TEST_F(ChannelManagerTest, GetSetOutputVolumeBeforeInit) { | 186 TEST_F(ChannelManagerTest, GetSetOutputVolumeBeforeInit) { |
219 int level; | 187 int level; |
220 // Before init, SetOutputVolume() remembers the volume but does not change the | 188 // Before init, SetOutputVolume() remembers the volume but does not change the |
221 // volume of the engine. GetOutputVolume() should fail. | 189 // volume of the engine. GetOutputVolume() should fail. |
222 EXPECT_EQ(-1, fme_->output_volume()); | 190 EXPECT_EQ(-1, fme_->output_volume()); |
223 EXPECT_FALSE(cm_->GetOutputVolume(&level)); | 191 EXPECT_FALSE(cm_->GetOutputVolume(&level)); |
224 EXPECT_FALSE(cm_->SetOutputVolume(-1)); // Invalid volume. | 192 EXPECT_FALSE(cm_->SetOutputVolume(-1)); // Invalid volume. |
225 EXPECT_TRUE(cm_->SetOutputVolume(99)); | 193 EXPECT_TRUE(cm_->SetOutputVolume(99)); |
226 EXPECT_EQ(-1, fme_->output_volume()); | 194 EXPECT_EQ(-1, fme_->output_volume()); |
227 | 195 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); | 242 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); |
275 | 243 |
276 // Can set again after terminate. | 244 // Can set again after terminate. |
277 cm_->Terminate(); | 245 cm_->Terminate(); |
278 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 246 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
279 cm_->GetSupportedVideoCodecs(&codecs); | 247 cm_->GetSupportedVideoCodecs(&codecs); |
280 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); | 248 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); |
281 } | 249 } |
282 | 250 |
283 } // namespace cricket | 251 } // namespace cricket |
OLD | NEW |