| 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 505 |
| 506 cricket::CapturedFrame frame; | 506 cricket::CapturedFrame frame; |
| 507 frame.width = 1280; | 507 frame.width = 1280; |
| 508 frame.height = 720; | 508 frame.height = 720; |
| 509 frame.fourcc = cricket::FOURCC_I420; | 509 frame.fourcc = cricket::FOURCC_I420; |
| 510 frame.data_size = frame.width * frame.height + | 510 frame.data_size = frame.width * frame.height + |
| 511 2 * ((frame.width + 1) / 2) * ((frame.height + 1) / 2); | 511 2 * ((frame.width + 1) / 2) * ((frame.height + 1) / 2); |
| 512 std::unique_ptr<char[]> data(new char[frame.data_size]); | 512 std::unique_ptr<char[]> data(new char[frame.data_size]); |
| 513 frame.data = data.get(); | 513 frame.data = data.get(); |
| 514 memset(frame.data, 1, frame.data_size); | 514 memset(frame.data, 1, frame.data_size); |
| 515 const int kInitialTimestamp = 123456; | 515 int64_t initial_timestamp = rtc::TimeNanos(); |
| 516 frame.time_stamp = kInitialTimestamp; | 516 frame.time_stamp = initial_timestamp; |
| 517 | 517 |
| 518 // Deliver initial frame. | 518 // Deliver initial frame. |
| 519 capturer1.SignalCapturedFrame(&frame); | 519 capturer1.SignalCapturedFrame(&frame); |
| 520 // Deliver next frame 1 second later. | 520 // Deliver next frame 1 second later. |
| 521 frame.time_stamp += rtc::kNumNanosecsPerSec; | 521 frame.time_stamp += rtc::kNumNanosecsPerSec; |
| 522 rtc::Thread::Current()->SleepMs(1000); | 522 rtc::Thread::Current()->SleepMs(1000); |
| 523 capturer1.SignalCapturedFrame(&frame); | 523 capturer1.SignalCapturedFrame(&frame); |
| 524 | 524 |
| 525 int64_t capturer1_last_timestamp = stream->GetLastTimestamp(); | 525 int64_t capturer1_last_timestamp = stream->GetLastTimestamp(); |
| 526 // Reset input source, should still be continuous even though input-frame | 526 // Reset input source, should still be continuous even though input-frame |
| 527 // timestamp is less than before. | 527 // timestamp is less than before. |
| 528 FakeVideoCapturer capturer2; | 528 FakeVideoCapturer capturer2; |
| 529 channel->SetSource(kSsrc, &capturer2); | 529 channel->SetSource(kSsrc, &capturer2); |
| 530 | 530 |
| 531 rtc::Thread::Current()->SleepMs(1); | 531 rtc::Thread::Current()->SleepMs(1); |
| 532 // Deliver with a timestamp (10 seconds) before the previous initial one, | 532 // Deliver with a timestamp (10 seconds) before the previous initial one, |
| 533 // these should not be related at all anymore and it should still work fine. | 533 // these should not be related at all anymore and it should still work fine. |
| 534 frame.time_stamp = kInitialTimestamp - 10000; | 534 frame.time_stamp = initial_timestamp - 10 * rtc::kNumNanosecsPerSec; |
| 535 capturer2.SignalCapturedFrame(&frame); | 535 capturer2.SignalCapturedFrame(&frame); |
| 536 | 536 |
| 537 // New timestamp should be at least 1ms in the future and not old. | 537 // New timestamp should be at least 1ms in the future and not old. |
| 538 EXPECT_GT(stream->GetLastTimestamp(), capturer1_last_timestamp); | 538 EXPECT_GT(stream->GetLastTimestamp(), capturer1_last_timestamp); |
| 539 | 539 |
| 540 EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); | 540 EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); |
| 541 } | 541 } |
| 542 | 542 |
| 543 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( | 543 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( |
| 544 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 544 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| (...skipping 3035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3580 } | 3580 } |
| 3581 | 3581 |
| 3582 // Test that we normalize send codec format size in simulcast. | 3582 // Test that we normalize send codec format size in simulcast. |
| 3583 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3583 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
| 3584 cricket::VideoCodec codec(kVp8Codec270p); | 3584 cricket::VideoCodec codec(kVp8Codec270p); |
| 3585 codec.width += 1; | 3585 codec.width += 1; |
| 3586 codec.height += 1; | 3586 codec.height += 1; |
| 3587 VerifySimulcastSettings(codec, 2, 2); | 3587 VerifySimulcastSettings(codec, 2, 2); |
| 3588 } | 3588 } |
| 3589 } // namespace cricket | 3589 } // namespace cricket |
| OLD | NEW |