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

Unified Diff: webrtc/media/engine/webrtcvideoframe_unittest.cc

Issue 1865283002: Use microsecond timestamp in cricket::VideoFrame. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add missing override, intending to reland. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/engine/webrtcvideoframe.cc ('k') | webrtc/media/engine/webrtcvideoframefactory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvideoframe_unittest.cc
diff --git a/webrtc/media/engine/webrtcvideoframe_unittest.cc b/webrtc/media/engine/webrtcvideoframe_unittest.cc
index 12c8bfe741e043801d3690856393dc2ea38f59a2..7849de61b0a8bf4914f7eb30aeddbb6e009f0416 100644
--- a/webrtc/media/engine/webrtcvideoframe_unittest.cc
+++ b/webrtc/media/engine/webrtcvideoframe_unittest.cc
@@ -20,6 +20,7 @@ namespace {
class WebRtcVideoTestFrame : public cricket::WebRtcVideoFrame {
public:
+ // The ApplyRotationToFrame test needs this as a public method.
using cricket::WebRtcVideoFrame::set_rotation;
virtual VideoFrame* CreateEmptyFrame(int w,
@@ -47,7 +48,7 @@ class WebRtcVideoFrameTest : public VideoFrameTest<cricket::WebRtcVideoFrame> {
// Build the CapturedFrame.
cricket::CapturedFrame captured_frame;
captured_frame.fourcc = cricket::FOURCC_I420;
- captured_frame.time_stamp = 5678;
+ captured_frame.time_stamp = rtc::TimeNanos();
captured_frame.rotation = frame_rotation;
captured_frame.width = frame_width;
captured_frame.height = frame_height;
@@ -66,7 +67,8 @@ class WebRtcVideoFrameTest : public VideoFrameTest<cricket::WebRtcVideoFrame> {
apply_rotation));
// Verify the new frame.
- EXPECT_EQ(5678, frame.GetTimeStamp());
+ EXPECT_EQ(captured_frame.time_stamp / rtc::kNumNanosecsPerMicrosec,
+ frame.timestamp_us());
if (apply_rotation)
EXPECT_EQ(webrtc::kVideoRotation_0, frame.rotation());
else
@@ -271,13 +273,16 @@ TEST_F(WebRtcVideoFrameTest, TextureInitialValues) {
webrtc::NativeHandleBuffer* buffer =
new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>(
dummy_handle, 640, 480);
- cricket::WebRtcVideoFrame frame(buffer, 200, webrtc::kVideoRotation_0);
+ // Timestamp is converted from ns to us, so last three digits are lost.
+ cricket::WebRtcVideoFrame frame(buffer, 20000, webrtc::kVideoRotation_0);
EXPECT_EQ(dummy_handle, frame.GetNativeHandle());
EXPECT_EQ(640, frame.width());
EXPECT_EQ(480, frame.height());
- EXPECT_EQ(200, frame.GetTimeStamp());
- frame.SetTimeStamp(400);
- EXPECT_EQ(400, frame.GetTimeStamp());
+ EXPECT_EQ(20000, frame.GetTimeStamp());
+ EXPECT_EQ(20, frame.timestamp_us());
+ frame.set_timestamp_us(40);
+ EXPECT_EQ(40000, frame.GetTimeStamp());
+ EXPECT_EQ(40, frame.timestamp_us());
}
TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) {
@@ -286,12 +291,14 @@ TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) {
webrtc::NativeHandleBuffer* buffer =
new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>(
dummy_handle, 640, 480);
- cricket::WebRtcVideoFrame frame1(buffer, 200, webrtc::kVideoRotation_0);
+ // Timestamp is converted from ns to us, so last three digits are lost.
+ cricket::WebRtcVideoFrame frame1(buffer, 20000, webrtc::kVideoRotation_0);
cricket::VideoFrame* frame2 = frame1.Copy();
EXPECT_EQ(frame1.GetNativeHandle(), frame2->GetNativeHandle());
EXPECT_EQ(frame1.width(), frame2->width());
EXPECT_EQ(frame1.height(), frame2->height());
EXPECT_EQ(frame1.GetTimeStamp(), frame2->GetTimeStamp());
+ EXPECT_EQ(frame1.timestamp_us(), frame2->timestamp_us());
delete frame2;
}
« no previous file with comments | « webrtc/media/engine/webrtcvideoframe.cc ('k') | webrtc/media/engine/webrtcvideoframefactory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698