| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 std::vector<cricket::VideoCodec> codecs; | 449 std::vector<cricket::VideoCodec> codecs; |
| 450 codecs.push_back(kVp9Codec); | 450 codecs.push_back(kVp9Codec); |
| 451 | 451 |
| 452 rtc::scoped_ptr<VideoMediaChannel> channel( | 452 rtc::scoped_ptr<VideoMediaChannel> channel( |
| 453 SetUpForExternalEncoderFactory(&encoder_factory, codecs)); | 453 SetUpForExternalEncoderFactory(&encoder_factory, codecs)); |
| 454 | 454 |
| 455 EXPECT_TRUE( | 455 EXPECT_TRUE( |
| 456 channel->AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrc))); | 456 channel->AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
| 457 } | 457 } |
| 458 | 458 |
| 459 TEST_F(WebRtcVideoEngine2Test, PropagatesInputFrameTimestamp) { |
| 460 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 461 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); |
| 462 std::vector<cricket::VideoCodec> codecs; |
| 463 codecs.push_back(kVp8Codec); |
| 464 |
| 465 FakeCallFactory factory; |
| 466 engine_.SetCallFactory(&factory); |
| 467 rtc::scoped_ptr<VideoMediaChannel> channel( |
| 468 SetUpForExternalEncoderFactory(&encoder_factory, codecs)); |
| 469 |
| 470 EXPECT_TRUE( |
| 471 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
| 472 |
| 473 FakeVideoCapturer capturer; |
| 474 EXPECT_TRUE(channel->SetCapturer(kSsrc, &capturer)); |
| 475 capturer.Start(cricket::VideoFormat(1280, 720, |
| 476 cricket::VideoFormat::FpsToInterval(60), |
| 477 cricket::FOURCC_I420)); |
| 478 channel->SetSend(true); |
| 479 |
| 480 FakeCall* call = factory.GetCall(); |
| 481 std::vector<FakeVideoSendStream*> streams = call->GetVideoSendStreams(); |
| 482 FakeVideoSendStream* stream = streams[0]; |
| 483 |
| 484 int64_t timestamp; |
| 485 int64_t last_timestamp; |
| 486 |
| 487 EXPECT_TRUE(capturer.CaptureFrame()); |
| 488 last_timestamp = stream->GetLastTimestamp(); |
| 489 for (int i = 0; i < 10; i++) { |
| 490 EXPECT_TRUE(capturer.CaptureFrame()); |
| 491 timestamp = stream->GetLastTimestamp(); |
| 492 int64_t interval = timestamp - last_timestamp; |
| 493 |
| 494 // Precision changes from nanosecond to millisecond. |
| 495 // Allow error to be no more than 1. |
| 496 EXPECT_NEAR(cricket::VideoFormat::FpsToInterval(60) / 1E6, interval, 1); |
| 497 |
| 498 last_timestamp = timestamp; |
| 499 } |
| 500 |
| 501 capturer.Start(cricket::VideoFormat(1280, 720, |
| 502 cricket::VideoFormat::FpsToInterval(30), |
| 503 cricket::FOURCC_I420)); |
| 504 |
| 505 EXPECT_TRUE(capturer.CaptureFrame()); |
| 506 last_timestamp = stream->GetLastTimestamp(); |
| 507 for (int i = 0; i < 10; i++) { |
| 508 EXPECT_TRUE(capturer.CaptureFrame()); |
| 509 timestamp = stream->GetLastTimestamp(); |
| 510 int64_t interval = timestamp - last_timestamp; |
| 511 |
| 512 // Precision changes from nanosecond to millisecond. |
| 513 // Allow error to be no more than 1. |
| 514 EXPECT_NEAR(cricket::VideoFormat::FpsToInterval(30) / 1E6, interval, 1); |
| 515 |
| 516 last_timestamp = timestamp; |
| 517 } |
| 518 |
| 519 // Remove stream previously added to free the external encoder instance. |
| 520 EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); |
| 521 } |
| 522 |
| 459 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( | 523 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( |
| 460 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 524 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 461 const std::vector<VideoCodec>& codecs) { | 525 const std::vector<VideoCodec>& codecs) { |
| 462 engine_.SetExternalEncoderFactory(encoder_factory); | 526 engine_.SetExternalEncoderFactory(encoder_factory); |
| 463 engine_.Init(); | 527 engine_.Init(); |
| 464 | 528 |
| 465 VideoMediaChannel* channel = | 529 VideoMediaChannel* channel = |
| 466 engine_.CreateChannel(cricket::VideoOptions(), NULL); | 530 engine_.CreateChannel(cricket::VideoOptions(), NULL); |
| 467 EXPECT_TRUE(channel->SetSendCodecs(codecs)); | 531 EXPECT_TRUE(channel->SetSendCodecs(codecs)); |
| 468 | 532 |
| (...skipping 2556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3025 // Ensures that the correct settings are applied to the codec when two temporal | 3089 // Ensures that the correct settings are applied to the codec when two temporal |
| 3026 // layer screencasting is enabled, and that the correct simulcast settings are | 3090 // layer screencasting is enabled, and that the correct simulcast settings are |
| 3027 // reapplied when disabling screencasting. | 3091 // reapplied when disabling screencasting. |
| 3028 TEST_F(WebRtcVideoChannel2SimulcastTest, | 3092 TEST_F(WebRtcVideoChannel2SimulcastTest, |
| 3029 DISABLED_TwoTemporalLayerScreencastSettings) { | 3093 DISABLED_TwoTemporalLayerScreencastSettings) { |
| 3030 // TODO(pbos): Implement. | 3094 // TODO(pbos): Implement. |
| 3031 FAIL() << "Not implemented."; | 3095 FAIL() << "Not implemented."; |
| 3032 } | 3096 } |
| 3033 | 3097 |
| 3034 } // namespace cricket | 3098 } // namespace cricket |
| OLD | NEW |