OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 TEST_F(WebRtcVideoFrameTest, InitRotated90DontApplyRotation) { | 179 TEST_F(WebRtcVideoFrameTest, InitRotated90DontApplyRotation) { |
180 TestInit(640, 360, webrtc::kVideoRotation_90, false); | 180 TestInit(640, 360, webrtc::kVideoRotation_90, false); |
181 } | 181 } |
182 | 182 |
183 TEST_F(WebRtcVideoFrameTest, TextureInitialValues) { | 183 TEST_F(WebRtcVideoFrameTest, TextureInitialValues) { |
184 webrtc::test::FakeNativeHandle* dummy_handle = | 184 webrtc::test::FakeNativeHandle* dummy_handle = |
185 new webrtc::test::FakeNativeHandle(); | 185 new webrtc::test::FakeNativeHandle(); |
186 webrtc::NativeHandleBuffer* buffer = | 186 webrtc::NativeHandleBuffer* buffer = |
187 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( | 187 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( |
188 dummy_handle, 640, 480); | 188 dummy_handle, 640, 480); |
189 // Timestamp is converted from ns to us, so last three digits are lost. | 189 |
190 WebRtcVideoFrame frame(buffer, 20000, webrtc::kVideoRotation_0); | 190 WebRtcVideoFrame frame(buffer, webrtc::kVideoRotation_0, 20); |
191 EXPECT_EQ(dummy_handle, frame.video_frame_buffer()->native_handle()); | 191 EXPECT_EQ(dummy_handle, frame.video_frame_buffer()->native_handle()); |
192 EXPECT_EQ(640, frame.width()); | 192 EXPECT_EQ(640, frame.width()); |
193 EXPECT_EQ(480, frame.height()); | 193 EXPECT_EQ(480, frame.height()); |
194 EXPECT_EQ(20000, frame.GetTimeStamp()); | |
195 EXPECT_EQ(20, frame.timestamp_us()); | 194 EXPECT_EQ(20, frame.timestamp_us()); |
196 frame.set_timestamp_us(40); | 195 frame.set_timestamp_us(40); |
197 EXPECT_EQ(40000, frame.GetTimeStamp()); | |
198 EXPECT_EQ(40, frame.timestamp_us()); | 196 EXPECT_EQ(40, frame.timestamp_us()); |
199 } | 197 } |
200 | 198 |
201 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { | 199 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { |
202 WebRtcVideoFrame applied0; | 200 WebRtcVideoFrame applied0; |
203 EXPECT_TRUE(IsNull(applied0)); | 201 EXPECT_TRUE(IsNull(applied0)); |
204 EXPECT_TRUE(LoadFrame(CreateYuvSample(kWidth, kHeight, 12).get(), FOURCC_I420, | 202 EXPECT_TRUE(LoadFrame(CreateYuvSample(kWidth, kHeight, 12).get(), FOURCC_I420, |
205 kWidth, kHeight, &applied0)); | 203 kWidth, kHeight, &applied0)); |
206 | 204 |
207 // Claim that this frame needs to be rotated for 90 degree. | 205 // Claim that this frame needs to be rotated for 90 degree. |
(...skipping 14 matching lines...) Expand all Loading... |
222 SetFrameRotation(&applied90, webrtc::kVideoRotation_270); | 220 SetFrameRotation(&applied90, webrtc::kVideoRotation_270); |
223 WebRtcVideoFrame applied360( | 221 WebRtcVideoFrame applied360( |
224 webrtc::I420Buffer::Rotate(applied90.video_frame_buffer(), | 222 webrtc::I420Buffer::Rotate(applied90.video_frame_buffer(), |
225 applied90.rotation()), | 223 applied90.rotation()), |
226 webrtc::kVideoRotation_0, applied90.timestamp_us()); | 224 webrtc::kVideoRotation_0, applied90.timestamp_us()); |
227 EXPECT_EQ(applied360.rotation(), webrtc::kVideoRotation_0); | 225 EXPECT_EQ(applied360.rotation(), webrtc::kVideoRotation_0); |
228 EXPECT_TRUE(IsEqual(applied0, applied360, 0)); | 226 EXPECT_TRUE(IsEqual(applied0, applied360, 0)); |
229 } | 227 } |
230 | 228 |
231 } // namespace cricket | 229 } // namespace cricket |
OLD | NEW |