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

Side by Side Diff: talk/media/webrtc/webrtcvideoengine2_unittest.cc

Issue 1225153002: Let WebRtcVideoChannel2::WebRtcVideoSendStream::InputFrame carry the input frame's timestamp to out… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Black frame timestamp Created 5 years, 5 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
OLDNEW
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
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
459 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( 520 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory(
460 cricket::WebRtcVideoEncoderFactory* encoder_factory, 521 cricket::WebRtcVideoEncoderFactory* encoder_factory,
461 const std::vector<VideoCodec>& codecs) { 522 const std::vector<VideoCodec>& codecs) {
462 engine_.SetExternalEncoderFactory(encoder_factory); 523 engine_.SetExternalEncoderFactory(encoder_factory);
463 engine_.Init(); 524 engine_.Init();
464 525
465 VideoMediaChannel* channel = 526 VideoMediaChannel* channel =
466 engine_.CreateChannel(cricket::VideoOptions(), NULL); 527 engine_.CreateChannel(cricket::VideoOptions(), NULL);
467 EXPECT_TRUE(channel->SetSendCodecs(codecs)); 528 EXPECT_TRUE(channel->SetSendCodecs(codecs));
468 529
(...skipping 2556 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 // Ensures that the correct settings are applied to the codec when two temporal 3086 // 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 3087 // layer screencasting is enabled, and that the correct simulcast settings are
3027 // reapplied when disabling screencasting. 3088 // reapplied when disabling screencasting.
3028 TEST_F(WebRtcVideoChannel2SimulcastTest, 3089 TEST_F(WebRtcVideoChannel2SimulcastTest,
3029 DISABLED_TwoTemporalLayerScreencastSettings) { 3090 DISABLED_TwoTemporalLayerScreencastSettings) {
3030 // TODO(pbos): Implement. 3091 // TODO(pbos): Implement.
3031 FAIL() << "Not implemented."; 3092 FAIL() << "Not implemented.";
3032 } 3093 }
3033 3094
3034 } // namespace cricket 3095 } // namespace cricket
OLDNEW
« talk/media/webrtc/webrtcvideoengine2.cc ('K') | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698