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, SendStreamTimestampCarryOver) { | |
pbos-webrtc
2015/07/12 15:30:22
PropagatesInputFrameTimestamp
qiangchen
2015/07/13 17:48:02
Done.
| |
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_LE(cricket::VideoFormat::FpsToInterval(60) / 1000000, interval); | |
pbos-webrtc
2015/07/12 15:30:22
Is EXPECT_NEAR applicable here?
qiangchen
2015/07/13 17:48:02
Done.
| |
497 EXPECT_GE(cricket::VideoFormat::FpsToInterval(60) / 1000000 + 1, interval); | |
498 | |
499 last_timestamp = timestamp; | |
500 } | |
501 | |
502 capturer.Start(cricket::VideoFormat(1280, 720, | |
503 cricket::VideoFormat::FpsToInterval(30), | |
504 cricket::FOURCC_I420)); | |
505 | |
506 EXPECT_TRUE(capturer.CaptureFrame()); | |
507 last_timestamp = stream->GetLastTimestamp(); | |
508 for (int i = 0; i < 10; i++) { | |
509 EXPECT_TRUE(capturer.CaptureFrame()); | |
510 timestamp = stream->GetLastTimestamp(); | |
511 int64_t interval = timestamp - last_timestamp; | |
512 | |
513 // Precision changes from nanosecond to millisecond. | |
514 // Allow error to be no more than 1. | |
515 EXPECT_LE(cricket::VideoFormat::FpsToInterval(30) / 1000000, interval); | |
516 EXPECT_GE(cricket::VideoFormat::FpsToInterval(30) / 1000000 + 1, interval); | |
517 | |
518 last_timestamp = timestamp; | |
519 } | |
520 } | |
521 | |
459 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( | 522 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( |
460 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 523 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
461 const std::vector<VideoCodec>& codecs) { | 524 const std::vector<VideoCodec>& codecs) { |
462 engine_.SetExternalEncoderFactory(encoder_factory); | 525 engine_.SetExternalEncoderFactory(encoder_factory); |
463 engine_.Init(); | 526 engine_.Init(); |
464 | 527 |
465 VideoMediaChannel* channel = | 528 VideoMediaChannel* channel = |
466 engine_.CreateChannel(cricket::VideoOptions(), NULL); | 529 engine_.CreateChannel(cricket::VideoOptions(), NULL); |
467 EXPECT_TRUE(channel->SetSendCodecs(codecs)); | 530 EXPECT_TRUE(channel->SetSendCodecs(codecs)); |
468 | 531 |
(...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 | 3088 // 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 | 3089 // layer screencasting is enabled, and that the correct simulcast settings are |
3027 // reapplied when disabling screencasting. | 3090 // reapplied when disabling screencasting. |
3028 TEST_F(WebRtcVideoChannel2SimulcastTest, | 3091 TEST_F(WebRtcVideoChannel2SimulcastTest, |
3029 DISABLED_TwoTemporalLayerScreencastSettings) { | 3092 DISABLED_TwoTemporalLayerScreencastSettings) { |
3030 // TODO(pbos): Implement. | 3093 // TODO(pbos): Implement. |
3031 FAIL() << "Not implemented."; | 3094 FAIL() << "Not implemented."; |
3032 } | 3095 } |
3033 | 3096 |
3034 } // namespace cricket | 3097 } // namespace cricket |
OLD | NEW |