Index: webrtc/media/engine/webrtcvideoframe_unittest.cc |
diff --git a/webrtc/media/engine/webrtcvideoframe_unittest.cc b/webrtc/media/engine/webrtcvideoframe_unittest.cc |
index a725246a43c414115227fe75f3bb1ce3df976272..abfd0aea3cdfe43ea36c86c42d40fed1cbea29bb 100644 |
--- a/webrtc/media/engine/webrtcvideoframe_unittest.cc |
+++ b/webrtc/media/engine/webrtcvideoframe_unittest.cc |
@@ -245,6 +245,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) { |
@@ -289,6 +292,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. |
+ cricket::WebRtcVideoFrame frame1(buffer, 20000, webrtc::kVideoRotation_0); |
+ cricket::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) { |
WebRtcVideoTestFrame applied0; |
EXPECT_TRUE(IsNull(applied0)); |