| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // Add CVO extension. | 252 // Add CVO extension. |
| 253 const int id = 1; | 253 const int id = 1; |
| 254 parameters.extensions.push_back( | 254 parameters.extensions.push_back( |
| 255 cricket::RtpHeaderExtension(kRtpVideoRotationHeaderExtension, id)); | 255 cricket::RtpHeaderExtension(kRtpVideoRotationHeaderExtension, id)); |
| 256 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 256 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
| 257 | 257 |
| 258 // Set capturer. | 258 // Set capturer. |
| 259 channel->SetSource(kSsrc, &capturer); | 259 channel->SetSource(kSsrc, &capturer); |
| 260 | 260 |
| 261 // Verify capturer has turned off applying rotation. | 261 // Verify capturer has turned off applying rotation. |
| 262 EXPECT_FALSE(capturer.GetApplyRotation()); | 262 EXPECT_FALSE(capturer.apply_rotation()); |
| 263 | 263 |
| 264 // Verify removing header extension turns on applying rotation. | 264 // Verify removing header extension turns on applying rotation. |
| 265 parameters.extensions.clear(); | 265 parameters.extensions.clear(); |
| 266 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 266 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
| 267 EXPECT_TRUE(capturer.GetApplyRotation()); | 267 EXPECT_TRUE(capturer.apply_rotation()); |
| 268 } | 268 } |
| 269 | 269 |
| 270 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeAddSendStream) { | 270 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeAddSendStream) { |
| 271 // Allocate the capturer first to prevent early destruction before channel's | 271 // Allocate the capturer first to prevent early destruction before channel's |
| 272 // dtor is called. | 272 // dtor is called. |
| 273 cricket::FakeVideoCapturer capturer; | 273 cricket::FakeVideoCapturer capturer; |
| 274 | 274 |
| 275 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 275 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 276 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); | 276 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); |
| 277 cricket::VideoSendParameters parameters; | 277 cricket::VideoSendParameters parameters; |
| 278 parameters.codecs.push_back(kVp8Codec); | 278 parameters.codecs.push_back(kVp8Codec); |
| 279 | 279 |
| 280 std::unique_ptr<VideoMediaChannel> channel( | 280 std::unique_ptr<VideoMediaChannel> channel( |
| 281 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs)); | 281 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs)); |
| 282 // Add CVO extension. | 282 // Add CVO extension. |
| 283 const int id = 1; | 283 const int id = 1; |
| 284 parameters.extensions.push_back( | 284 parameters.extensions.push_back( |
| 285 cricket::RtpHeaderExtension(kRtpVideoRotationHeaderExtension, id)); | 285 cricket::RtpHeaderExtension(kRtpVideoRotationHeaderExtension, id)); |
| 286 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 286 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
| 287 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc))); | 287 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc))); |
| 288 | 288 |
| 289 // Set capturer. | 289 // Set capturer. |
| 290 channel->SetSource(kSsrc, &capturer); | 290 channel->SetSource(kSsrc, &capturer); |
| 291 | 291 |
| 292 // Verify capturer has turned off applying rotation. | 292 // Verify capturer has turned off applying rotation. |
| 293 EXPECT_FALSE(capturer.GetApplyRotation()); | 293 EXPECT_FALSE(capturer.apply_rotation()); |
| 294 } | 294 } |
| 295 | 295 |
| 296 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionAfterCapturer) { | 296 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionAfterCapturer) { |
| 297 cricket::FakeVideoCapturer capturer; | 297 cricket::FakeVideoCapturer capturer; |
| 298 | 298 |
| 299 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 299 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 300 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); | 300 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); |
| 301 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP9, "VP9"); | 301 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP9, "VP9"); |
| 302 cricket::VideoSendParameters parameters; | 302 cricket::VideoSendParameters parameters; |
| 303 parameters.codecs.push_back(kVp8Codec); | 303 parameters.codecs.push_back(kVp8Codec); |
| 304 parameters.codecs.push_back(kVp9Codec); | 304 parameters.codecs.push_back(kVp9Codec); |
| 305 | 305 |
| 306 std::unique_ptr<VideoMediaChannel> channel( | 306 std::unique_ptr<VideoMediaChannel> channel( |
| 307 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs)); | 307 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs)); |
| 308 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc))); | 308 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc))); |
| 309 | 309 |
| 310 // Set capturer. | 310 // Set capturer. |
| 311 channel->SetSource(kSsrc, &capturer); | 311 channel->SetSource(kSsrc, &capturer); |
| 312 | 312 |
| 313 // Verify capturer has turned on applying rotation. | 313 // Verify capturer has turned on applying rotation. |
| 314 EXPECT_TRUE(capturer.GetApplyRotation()); | 314 EXPECT_TRUE(capturer.apply_rotation()); |
| 315 | 315 |
| 316 // Add CVO extension. | 316 // Add CVO extension. |
| 317 const int id = 1; | 317 const int id = 1; |
| 318 parameters.extensions.push_back( | 318 parameters.extensions.push_back( |
| 319 cricket::RtpHeaderExtension(kRtpVideoRotationHeaderExtension, id)); | 319 cricket::RtpHeaderExtension(kRtpVideoRotationHeaderExtension, id)); |
| 320 // Also remove the first codec to trigger a codec change as well. | 320 // Also remove the first codec to trigger a codec change as well. |
| 321 parameters.codecs.erase(parameters.codecs.begin()); | 321 parameters.codecs.erase(parameters.codecs.begin()); |
| 322 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 322 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
| 323 | 323 |
| 324 // Verify capturer has turned off applying rotation. | 324 // Verify capturer has turned off applying rotation. |
| 325 EXPECT_FALSE(capturer.GetApplyRotation()); | 325 EXPECT_FALSE(capturer.apply_rotation()); |
| 326 | 326 |
| 327 // Verify removing header extension turns on applying rotation. | 327 // Verify removing header extension turns on applying rotation. |
| 328 parameters.extensions.clear(); | 328 parameters.extensions.clear(); |
| 329 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 329 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
| 330 EXPECT_TRUE(capturer.GetApplyRotation()); | 330 EXPECT_TRUE(capturer.apply_rotation()); |
| 331 } | 331 } |
| 332 | 332 |
| 333 TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) { | 333 TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) { |
| 334 engine_.Init(); | 334 engine_.Init(); |
| 335 std::unique_ptr<VideoMediaChannel> channel( | 335 std::unique_ptr<VideoMediaChannel> channel( |
| 336 engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions())); | 336 engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions())); |
| 337 | 337 |
| 338 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); | 338 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); |
| 339 | 339 |
| 340 EXPECT_FALSE(channel->SetSend(true)) | 340 EXPECT_FALSE(channel->SetSend(true)) |
| (...skipping 3438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3779 } | 3779 } |
| 3780 | 3780 |
| 3781 // Test that we normalize send codec format size in simulcast. | 3781 // Test that we normalize send codec format size in simulcast. |
| 3782 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3782 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
| 3783 cricket::VideoCodec codec(kVp8Codec270p); | 3783 cricket::VideoCodec codec(kVp8Codec270p); |
| 3784 codec.width += 1; | 3784 codec.width += 1; |
| 3785 codec.height += 1; | 3785 codec.height += 1; |
| 3786 VerifySimulcastSettings(codec, 2, 2); | 3786 VerifySimulcastSettings(codec, 2, 2); |
| 3787 } | 3787 } |
| 3788 } // namespace cricket | 3788 } // namespace cricket |
| OLD | NEW |