Index: webrtc/media/engine/webrtcvideoframe_unittest.cc |
diff --git a/webrtc/media/engine/webrtcvideoframe_unittest.cc b/webrtc/media/engine/webrtcvideoframe_unittest.cc |
index 9d6bd5f7b5c4e6c116259422cdb269063c49d22b..fb7be22c537cb55c4f4d0907f0e5670c784721be 100644 |
--- a/webrtc/media/engine/webrtcvideoframe_unittest.cc |
+++ b/webrtc/media/engine/webrtcvideoframe_unittest.cc |
@@ -223,6 +223,9 @@ |
// TEST_WEBRTCVIDEOFRAME(ConvertToI422Buffer) |
// TEST_WEBRTCVIDEOFRAME(ConstructARGBBlackWhitePixel) |
+TEST_WEBRTCVIDEOFRAME(Copy) |
+TEST_WEBRTCVIDEOFRAME(CopyIsRef) |
+ |
// These functions test implementation-specific details. |
// Tests the Init function with different cropped size. |
TEST_F(WebRtcVideoFrameTest, InitEvenSize) { |
@@ -267,6 +270,24 @@ |
EXPECT_EQ(40, frame.timestamp_us()); |
} |
+TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) { |
+ webrtc::test::FakeNativeHandle* dummy_handle = |
+ new webrtc::test::FakeNativeHandle(); |
+ webrtc::NativeHandleBuffer* buffer = |
+ new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( |
+ dummy_handle, 640, 480); |
+ // Timestamp is converted from ns to us, so last three digits are lost. |
+ WebRtcVideoFrame frame1(buffer, 20000, webrtc::kVideoRotation_0); |
+ VideoFrame* frame2 = frame1.Copy(); |
+ EXPECT_EQ(frame1.video_frame_buffer()->native_handle(), |
+ frame2->video_frame_buffer()->native_handle()); |
+ 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; |
+} |
+ |
TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { |
WebRtcVideoFrame applied0; |
EXPECT_TRUE(IsNull(applied0)); |