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

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

Issue 1324263004: Remove cricket::VideoFrame::Set/GetElapsedTime() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased. Re-added CapturedFrame.elapsed_time. Remove once Chromium is updated. Created 5 years, 2 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
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | talk/media/webrtc/webrtcvideoframe.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 485
486 cricket::CapturedFrame frame; 486 cricket::CapturedFrame frame;
487 frame.width = 1280; 487 frame.width = 1280;
488 frame.height = 720; 488 frame.height = 720;
489 frame.fourcc = cricket::FOURCC_I420; 489 frame.fourcc = cricket::FOURCC_I420;
490 frame.data_size = static_cast<uint32>( 490 frame.data_size = static_cast<uint32>(
491 cricket::VideoFrame::SizeOf(frame.width, frame.height)); 491 cricket::VideoFrame::SizeOf(frame.width, frame.height));
492 rtc::scoped_ptr<char[]> data(new char[frame.data_size]); 492 rtc::scoped_ptr<char[]> data(new char[frame.data_size]);
493 frame.data = data.get(); 493 frame.data = data.get();
494 memset(frame.data, 1, frame.data_size); 494 memset(frame.data, 1, frame.data_size);
495 frame.elapsed_time = 0;
496 const int kInitialTimestamp = 123456; 495 const int kInitialTimestamp = 123456;
497 frame.time_stamp = kInitialTimestamp; 496 frame.time_stamp = kInitialTimestamp;
498 497
499 // Deliver initial frame. 498 // Deliver initial frame.
500 capturer1.SignalCapturedFrame(&frame); 499 capturer1.SignalCapturedFrame(&frame);
501 // Deliver next frame 1 second later. 500 // Deliver next frame 1 second later.
502 frame.time_stamp += rtc::kNumNanosecsPerSec; 501 frame.time_stamp += rtc::kNumNanosecsPerSec;
503 rtc::Thread::Current()->SleepMs(1000); 502 rtc::Thread::Current()->SleepMs(1000);
504 capturer1.SignalCapturedFrame(&frame); 503 capturer1.SignalCapturedFrame(&frame);
505 504
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 EXPECT_TRUE(capturer.CaptureFrame()); 1802 EXPECT_TRUE(capturer.CaptureFrame());
1804 1803
1805 EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames()); 1804 EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames());
1806 1805
1807 EXPECT_EQ(codec.width, send_stream->GetLastWidth()); 1806 EXPECT_EQ(codec.width, send_stream->GetLastWidth());
1808 EXPECT_EQ(codec.height, send_stream->GetLastHeight()); 1807 EXPECT_EQ(codec.height, send_stream->GetLastHeight());
1809 1808
1810 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL)); 1809 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
1811 } 1810 }
1812 1811
1813 TEST_F(WebRtcVideoChannel2Test, EstimatesNtpStartTimeAndElapsedTimeCorrectly) { 1812 TEST_F(WebRtcVideoChannel2Test, EstimatesNtpStartTimeCorrectly) {
1814 // Start at last timestamp to verify that wraparounds are estimated correctly. 1813 // Start at last timestamp to verify that wraparounds are estimated correctly.
1815 static const uint32_t kInitialTimestamp = 0xFFFFFFFFu; 1814 static const uint32_t kInitialTimestamp = 0xFFFFFFFFu;
1816 static const int64_t kInitialNtpTimeMs = 1247891230; 1815 static const int64_t kInitialNtpTimeMs = 1247891230;
1817 static const int kFrameOffsetMs = 20; 1816 static const int kFrameOffsetMs = 20;
1818 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 1817 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
1819 1818
1820 FakeVideoReceiveStream* stream = AddRecvStream(); 1819 FakeVideoReceiveStream* stream = AddRecvStream();
1821 cricket::FakeVideoRenderer renderer; 1820 cricket::FakeVideoRenderer renderer;
1822 EXPECT_TRUE(channel_->SetRenderer(last_ssrc_, &renderer)); 1821 EXPECT_TRUE(channel_->SetRenderer(last_ssrc_, &renderer));
1823 1822
1824 webrtc::VideoFrame video_frame; 1823 webrtc::VideoFrame video_frame;
1825 CreateBlackFrame(&video_frame, 4, 4); 1824 CreateBlackFrame(&video_frame, 4, 4);
1826 video_frame.set_timestamp(kInitialTimestamp); 1825 video_frame.set_timestamp(kInitialTimestamp);
1827 // Initial NTP time is not available on the first frame, but should still be 1826 // Initial NTP time is not available on the first frame, but should still be
1828 // able to be estimated. 1827 // able to be estimated.
1829 stream->InjectFrame(video_frame, 0); 1828 stream->InjectFrame(video_frame, 0);
1830 1829
1831 EXPECT_EQ(1, renderer.num_rendered_frames()); 1830 EXPECT_EQ(1, renderer.num_rendered_frames());
1832 EXPECT_EQ(0, renderer.last_frame_elapsed_time_ns());
1833 1831
1834 // This timestamp is kInitialTimestamp (-1) + kFrameOffsetMs * 90, which 1832 // This timestamp is kInitialTimestamp (-1) + kFrameOffsetMs * 90, which
1835 // triggers a constant-overflow warning, hence we're calculating it explicitly 1833 // triggers a constant-overflow warning, hence we're calculating it explicitly
1836 // here. 1834 // here.
1837 video_frame.set_timestamp(kFrameOffsetMs * 90 - 1); 1835 video_frame.set_timestamp(kFrameOffsetMs * 90 - 1);
1838 video_frame.set_ntp_time_ms(kInitialNtpTimeMs + kFrameOffsetMs); 1836 video_frame.set_ntp_time_ms(kInitialNtpTimeMs + kFrameOffsetMs);
1839 stream->InjectFrame(video_frame, 0); 1837 stream->InjectFrame(video_frame, 0);
1840 1838
1841 EXPECT_EQ(2, renderer.num_rendered_frames()); 1839 EXPECT_EQ(2, renderer.num_rendered_frames());
1842 EXPECT_EQ(kFrameOffsetMs * rtc::kNumNanosecsPerMillisec,
1843 renderer.last_frame_elapsed_time_ns());
1844 1840
1845 // Verify that NTP time has been correctly deduced. 1841 // Verify that NTP time has been correctly deduced.
1846 cricket::VideoMediaInfo info; 1842 cricket::VideoMediaInfo info;
1847 ASSERT_TRUE(channel_->GetStats(&info)); 1843 ASSERT_TRUE(channel_->GetStats(&info));
1848 ASSERT_EQ(1u, info.receivers.size()); 1844 ASSERT_EQ(1u, info.receivers.size());
1849 EXPECT_EQ(kInitialNtpTimeMs, info.receivers[0].capture_start_ntp_time_ms); 1845 EXPECT_EQ(kInitialNtpTimeMs, info.receivers[0].capture_start_ntp_time_ms);
1850 } 1846 }
1851 1847
1852 TEST_F(WebRtcVideoChannel2Test, SetDefaultSendCodecs) { 1848 TEST_F(WebRtcVideoChannel2Test, SetDefaultSendCodecs) {
1853 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); 1849 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_));
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
3201 // Ensures that the correct settings are applied to the codec when two temporal 3197 // Ensures that the correct settings are applied to the codec when two temporal
3202 // layer screencasting is enabled, and that the correct simulcast settings are 3198 // layer screencasting is enabled, and that the correct simulcast settings are
3203 // reapplied when disabling screencasting. 3199 // reapplied when disabling screencasting.
3204 TEST_F(WebRtcVideoChannel2SimulcastTest, 3200 TEST_F(WebRtcVideoChannel2SimulcastTest,
3205 DISABLED_TwoTemporalLayerScreencastSettings) { 3201 DISABLED_TwoTemporalLayerScreencastSettings) {
3206 // TODO(pbos): Implement. 3202 // TODO(pbos): Implement.
3207 FAIL() << "Not implemented."; 3203 FAIL() << "Not implemented.";
3208 } 3204 }
3209 3205
3210 } // namespace cricket 3206 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | talk/media/webrtc/webrtcvideoframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698