| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 11 matching lines...) Expand all Loading... |
| 22 #include "webrtc/modules/video_capture/video_capture_factory.h" | 22 #include "webrtc/modules/video_capture/video_capture_factory.h" |
| 23 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 23 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 24 #include "webrtc/system_wrappers/include/sleep.h" | 24 #include "webrtc/system_wrappers/include/sleep.h" |
| 25 #include "webrtc/test/frame_utils.h" | 25 #include "webrtc/test/frame_utils.h" |
| 26 #include "webrtc/test/gtest.h" | 26 #include "webrtc/test/gtest.h" |
| 27 #include "webrtc/video_frame.h" | 27 #include "webrtc/video_frame.h" |
| 28 | 28 |
| 29 using webrtc::CriticalSectionWrapper; | 29 using webrtc::CriticalSectionWrapper; |
| 30 using webrtc::CriticalSectionScoped; | 30 using webrtc::CriticalSectionScoped; |
| 31 using webrtc::SleepMs; | 31 using webrtc::SleepMs; |
| 32 using webrtc::VideoCaptureAlarm; | |
| 33 using webrtc::VideoCaptureCapability; | 32 using webrtc::VideoCaptureCapability; |
| 34 using webrtc::VideoCaptureDataCallback; | |
| 35 using webrtc::VideoCaptureFactory; | 33 using webrtc::VideoCaptureFactory; |
| 36 using webrtc::VideoCaptureFeedBack; | |
| 37 using webrtc::VideoCaptureModule; | 34 using webrtc::VideoCaptureModule; |
| 38 | 35 |
| 39 | 36 |
| 40 #define WAIT_(ex, timeout, res) \ | 37 #define WAIT_(ex, timeout, res) \ |
| 41 do { \ | 38 do { \ |
| 42 res = (ex); \ | 39 res = (ex); \ |
| 43 int64_t start = rtc::TimeMillis(); \ | 40 int64_t start = rtc::TimeMillis(); \ |
| 44 while (!res && rtc::TimeMillis() < start + timeout) { \ | 41 while (!res && rtc::TimeMillis() < start + timeout) { \ |
| 45 SleepMs(5); \ | 42 SleepMs(5); \ |
| 46 res = (ex); \ | 43 res = (ex); \ |
| 47 } \ | 44 } \ |
| 48 } while (0) | 45 } while (0) |
| 49 | 46 |
| 50 #define EXPECT_TRUE_WAIT(ex, timeout) \ | 47 #define EXPECT_TRUE_WAIT(ex, timeout) \ |
| 51 do { \ | 48 do { \ |
| 52 bool res; \ | 49 bool res; \ |
| 53 WAIT_(ex, timeout, res); \ | 50 WAIT_(ex, timeout, res); \ |
| 54 if (!res) EXPECT_TRUE(ex); \ | 51 if (!res) EXPECT_TRUE(ex); \ |
| 55 } while (0) | 52 } while (0) |
| 56 | 53 |
| 57 | 54 |
| 58 static const int kTimeOut = 5000; | 55 static const int kTimeOut = 5000; |
| 59 static const int kTestHeight = 288; | 56 static const int kTestHeight = 288; |
| 60 static const int kTestWidth = 352; | 57 static const int kTestWidth = 352; |
| 61 static const int kTestFramerate = 30; | 58 static const int kTestFramerate = 30; |
| 62 | 59 |
| 63 class TestVideoCaptureCallback : public VideoCaptureDataCallback { | 60 class TestVideoCaptureCallback |
| 61 : public rtc::VideoSinkInterface<webrtc::VideoFrame> { |
| 64 public: | 62 public: |
| 65 TestVideoCaptureCallback() | 63 TestVideoCaptureCallback() |
| 66 : capture_cs_(CriticalSectionWrapper::CreateCriticalSection()), | 64 : capture_cs_(CriticalSectionWrapper::CreateCriticalSection()), |
| 67 capture_delay_(-1), | 65 capture_delay_(-1), |
| 68 last_render_time_ms_(0), | 66 last_render_time_ms_(0), |
| 69 incoming_frames_(0), | 67 incoming_frames_(0), |
| 70 timing_warnings_(0), | 68 timing_warnings_(0), |
| 71 rotate_frame_(webrtc::kVideoRotation_0) {} | 69 rotate_frame_(webrtc::kVideoRotation_0) {} |
| 72 | 70 |
| 73 ~TestVideoCaptureCallback() { | 71 ~TestVideoCaptureCallback() { |
| 74 if (timing_warnings_ > 0) | 72 if (timing_warnings_ > 0) |
| 75 printf("No of timing warnings %d\n", timing_warnings_); | 73 printf("No of timing warnings %d\n", timing_warnings_); |
| 76 } | 74 } |
| 77 | 75 |
| 78 virtual void OnIncomingCapturedFrame(const int32_t id, | 76 void OnFrame(const webrtc::VideoFrame& videoFrame) override { |
| 79 const webrtc::VideoFrame& videoFrame) { | |
| 80 CriticalSectionScoped cs(capture_cs_.get()); | 77 CriticalSectionScoped cs(capture_cs_.get()); |
| 81 int height = videoFrame.height(); | 78 int height = videoFrame.height(); |
| 82 int width = videoFrame.width(); | 79 int width = videoFrame.width(); |
| 83 #if defined(ANDROID) && ANDROID | 80 #if defined(ANDROID) && ANDROID |
| 84 // Android camera frames may be rotated depending on test device | 81 // Android camera frames may be rotated depending on test device |
| 85 // orientation. | 82 // orientation. |
| 86 EXPECT_TRUE(height == capability_.height || height == capability_.width); | 83 EXPECT_TRUE(height == capability_.height || height == capability_.width); |
| 87 EXPECT_TRUE(width == capability_.width || width == capability_.height); | 84 EXPECT_TRUE(width == capability_.width || width == capability_.height); |
| 88 #else | 85 #else |
| 89 EXPECT_EQ(height, capability_.height); | 86 EXPECT_EQ(height, capability_.height); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 102 last_render_time_ms_ + (1000 * 0.9) / capability_.maxFPS && | 99 last_render_time_ms_ + (1000 * 0.9) / capability_.maxFPS && |
| 103 last_render_time_ms_ > 0)) { | 100 last_render_time_ms_ > 0)) { |
| 104 timing_warnings_++; | 101 timing_warnings_++; |
| 105 } | 102 } |
| 106 | 103 |
| 107 incoming_frames_++; | 104 incoming_frames_++; |
| 108 last_render_time_ms_ = videoFrame.render_time_ms(); | 105 last_render_time_ms_ = videoFrame.render_time_ms(); |
| 109 last_frame_ = videoFrame.video_frame_buffer(); | 106 last_frame_ = videoFrame.video_frame_buffer(); |
| 110 } | 107 } |
| 111 | 108 |
| 112 virtual void OnCaptureDelayChanged(const int32_t id, | |
| 113 const int32_t delay) { | |
| 114 CriticalSectionScoped cs(capture_cs_.get()); | |
| 115 capture_delay_ = delay; | |
| 116 } | |
| 117 | |
| 118 void SetExpectedCapability(VideoCaptureCapability capability) { | 109 void SetExpectedCapability(VideoCaptureCapability capability) { |
| 119 CriticalSectionScoped cs(capture_cs_.get()); | 110 CriticalSectionScoped cs(capture_cs_.get()); |
| 120 capability_= capability; | 111 capability_= capability; |
| 121 incoming_frames_ = 0; | 112 incoming_frames_ = 0; |
| 122 last_render_time_ms_ = 0; | 113 last_render_time_ms_ = 0; |
| 123 capture_delay_ = -1; | 114 capture_delay_ = -1; |
| 124 } | 115 } |
| 125 int incoming_frames() { | 116 int incoming_frames() { |
| 126 CriticalSectionScoped cs(capture_cs_.get()); | 117 CriticalSectionScoped cs(capture_cs_.get()); |
| 127 return incoming_frames_; | 118 return incoming_frames_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 155 std::unique_ptr<CriticalSectionWrapper> capture_cs_; | 146 std::unique_ptr<CriticalSectionWrapper> capture_cs_; |
| 156 VideoCaptureCapability capability_; | 147 VideoCaptureCapability capability_; |
| 157 int capture_delay_; | 148 int capture_delay_; |
| 158 int64_t last_render_time_ms_; | 149 int64_t last_render_time_ms_; |
| 159 int incoming_frames_; | 150 int incoming_frames_; |
| 160 int timing_warnings_; | 151 int timing_warnings_; |
| 161 rtc::scoped_refptr<webrtc::VideoFrameBuffer> last_frame_; | 152 rtc::scoped_refptr<webrtc::VideoFrameBuffer> last_frame_; |
| 162 webrtc::VideoRotation rotate_frame_; | 153 webrtc::VideoRotation rotate_frame_; |
| 163 }; | 154 }; |
| 164 | 155 |
| 165 class TestVideoCaptureFeedBack : public VideoCaptureFeedBack { | |
| 166 public: | |
| 167 TestVideoCaptureFeedBack() : | |
| 168 capture_cs_(CriticalSectionWrapper::CreateCriticalSection()), | |
| 169 frame_rate_(0), | |
| 170 alarm_(webrtc::Cleared) { | |
| 171 } | |
| 172 | |
| 173 virtual void OnCaptureFrameRate(const int32_t id, | |
| 174 const uint32_t frameRate) { | |
| 175 CriticalSectionScoped cs(capture_cs_.get()); | |
| 176 frame_rate_ = frameRate; | |
| 177 } | |
| 178 | |
| 179 virtual void OnNoPictureAlarm(const int32_t id, | |
| 180 const VideoCaptureAlarm reported_alarm) { | |
| 181 CriticalSectionScoped cs(capture_cs_.get()); | |
| 182 alarm_ = reported_alarm; | |
| 183 } | |
| 184 int frame_rate() { | |
| 185 CriticalSectionScoped cs(capture_cs_.get()); | |
| 186 return frame_rate_; | |
| 187 | |
| 188 } | |
| 189 VideoCaptureAlarm alarm() { | |
| 190 CriticalSectionScoped cs(capture_cs_.get()); | |
| 191 return alarm_; | |
| 192 } | |
| 193 | |
| 194 private: | |
| 195 std::unique_ptr<CriticalSectionWrapper> capture_cs_; | |
| 196 unsigned int frame_rate_; | |
| 197 VideoCaptureAlarm alarm_; | |
| 198 }; | |
| 199 | |
| 200 class VideoCaptureTest : public testing::Test { | 156 class VideoCaptureTest : public testing::Test { |
| 201 public: | 157 public: |
| 202 VideoCaptureTest() : number_of_devices_(0) {} | 158 VideoCaptureTest() : number_of_devices_(0) {} |
| 203 | 159 |
| 204 void SetUp() { | 160 void SetUp() { |
| 205 device_info_.reset(VideoCaptureFactory::CreateDeviceInfo(0)); | 161 device_info_.reset(VideoCaptureFactory::CreateDeviceInfo()); |
| 206 assert(device_info_.get()); | 162 assert(device_info_.get()); |
| 207 number_of_devices_ = device_info_->NumberOfDevices(); | 163 number_of_devices_ = device_info_->NumberOfDevices(); |
| 208 ASSERT_GT(number_of_devices_, 0u); | 164 ASSERT_GT(number_of_devices_, 0u); |
| 209 } | 165 } |
| 210 | 166 |
| 211 rtc::scoped_refptr<VideoCaptureModule> OpenVideoCaptureDevice( | 167 rtc::scoped_refptr<VideoCaptureModule> OpenVideoCaptureDevice( |
| 212 unsigned int device, | 168 unsigned int device, |
| 213 VideoCaptureDataCallback* callback) { | 169 rtc::VideoSinkInterface<webrtc::VideoFrame>* callback) { |
| 214 char device_name[256]; | 170 char device_name[256]; |
| 215 char unique_name[256]; | 171 char unique_name[256]; |
| 216 | 172 |
| 217 EXPECT_EQ(0, device_info_->GetDeviceName( | 173 EXPECT_EQ(0, device_info_->GetDeviceName( |
| 218 device, device_name, 256, unique_name, 256)); | 174 device, device_name, 256, unique_name, 256)); |
| 219 | 175 |
| 220 rtc::scoped_refptr<VideoCaptureModule> module( | 176 rtc::scoped_refptr<VideoCaptureModule> module( |
| 221 VideoCaptureFactory::Create(device, unique_name)); | 177 VideoCaptureFactory::Create(unique_name)); |
| 222 if (module.get() == NULL) | 178 if (module.get() == NULL) |
| 223 return NULL; | 179 return NULL; |
| 224 | 180 |
| 225 EXPECT_FALSE(module->CaptureStarted()); | 181 EXPECT_FALSE(module->CaptureStarted()); |
| 226 | 182 |
| 227 module->RegisterCaptureDataCallback(*callback); | 183 module->RegisterCaptureDataCallback(callback); |
| 228 return module; | 184 return module; |
| 229 } | 185 } |
| 230 | 186 |
| 231 void StartCapture(VideoCaptureModule* capture_module, | 187 void StartCapture(VideoCaptureModule* capture_module, |
| 232 VideoCaptureCapability capability) { | 188 VideoCaptureCapability capability) { |
| 233 ASSERT_EQ(0, capture_module->StartCapture(capability)); | 189 ASSERT_EQ(0, capture_module->StartCapture(capability)); |
| 234 EXPECT_TRUE(capture_module->CaptureStarted()); | 190 EXPECT_TRUE(capture_module->CaptureStarted()); |
| 235 | 191 |
| 236 VideoCaptureCapability resulting_capability; | 192 VideoCaptureCapability resulting_capability; |
| 237 EXPECT_EQ(0, capture_module->CaptureSettings(resulting_capability)); | 193 EXPECT_EQ(0, capture_module->CaptureSettings(resulting_capability)); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 EXPECT_TRUE_WAIT(capture_observer2.incoming_frames() >= 5, kTimeOut); | 357 EXPECT_TRUE_WAIT(capture_observer2.incoming_frames() >= 5, kTimeOut); |
| 402 EXPECT_EQ(0, module2->StopCapture()); | 358 EXPECT_EQ(0, module2->StopCapture()); |
| 403 EXPECT_EQ(0, module1->StopCapture()); | 359 EXPECT_EQ(0, module1->StopCapture()); |
| 404 } | 360 } |
| 405 | 361 |
| 406 // Test class for testing external capture and capture feedback information | 362 // Test class for testing external capture and capture feedback information |
| 407 // such as frame rate and picture alarm. | 363 // such as frame rate and picture alarm. |
| 408 class VideoCaptureExternalTest : public testing::Test { | 364 class VideoCaptureExternalTest : public testing::Test { |
| 409 public: | 365 public: |
| 410 void SetUp() { | 366 void SetUp() { |
| 411 capture_module_ = VideoCaptureFactory::Create(0, capture_input_interface_); | 367 capture_module_ = VideoCaptureFactory::Create(capture_input_interface_); |
| 412 process_module_ = webrtc::ProcessThread::Create("ProcessThread"); | 368 process_module_ = webrtc::ProcessThread::Create("ProcessThread"); |
| 413 process_module_->Start(); | 369 process_module_->Start(); |
| 414 process_module_->RegisterModule(capture_module_); | 370 process_module_->RegisterModule(capture_module_); |
| 415 | 371 |
| 416 VideoCaptureCapability capability; | 372 VideoCaptureCapability capability; |
| 417 capability.width = kTestWidth; | 373 capability.width = kTestWidth; |
| 418 capability.height = kTestHeight; | 374 capability.height = kTestHeight; |
| 419 capability.rawType = webrtc::kVideoYV12; | 375 capability.rawType = webrtc::kVideoYV12; |
| 420 capability.maxFPS = kTestFramerate; | 376 capability.maxFPS = kTestFramerate; |
| 421 capture_callback_.SetExpectedCapability(capability); | 377 capture_callback_.SetExpectedCapability(capability); |
| 422 | 378 |
| 423 rtc::scoped_refptr<webrtc::I420Buffer> buffer = webrtc::I420Buffer::Create( | 379 rtc::scoped_refptr<webrtc::I420Buffer> buffer = webrtc::I420Buffer::Create( |
| 424 kTestWidth, kTestHeight, | 380 kTestWidth, kTestHeight, |
| 425 kTestWidth, ((kTestWidth + 1) / 2), (kTestWidth + 1) / 2); | 381 kTestWidth, ((kTestWidth + 1) / 2), (kTestWidth + 1) / 2); |
| 426 | 382 |
| 427 memset(buffer->MutableDataY(), 127, kTestWidth * kTestHeight); | 383 memset(buffer->MutableDataY(), 127, kTestWidth * kTestHeight); |
| 428 memset(buffer->MutableDataU(), 127, | 384 memset(buffer->MutableDataU(), 127, |
| 429 ((kTestWidth + 1) / 2) * ((kTestHeight + 1) / 2)); | 385 ((kTestWidth + 1) / 2) * ((kTestHeight + 1) / 2)); |
| 430 memset(buffer->MutableDataV(), 127, | 386 memset(buffer->MutableDataV(), 127, |
| 431 ((kTestWidth + 1) / 2) * ((kTestHeight + 1) / 2)); | 387 ((kTestWidth + 1) / 2) * ((kTestHeight + 1) / 2)); |
| 432 test_frame_.reset( | 388 test_frame_.reset( |
| 433 new webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); | 389 new webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); |
| 434 | 390 |
| 435 SleepMs(1); // Wait 1ms so that two tests can't have the same timestamp. | 391 SleepMs(1); // Wait 1ms so that two tests can't have the same timestamp. |
| 436 | 392 |
| 437 capture_module_->RegisterCaptureDataCallback(capture_callback_); | 393 capture_module_->RegisterCaptureDataCallback(&capture_callback_); |
| 438 capture_module_->RegisterCaptureCallback(capture_feedback_); | |
| 439 capture_module_->EnableFrameRateCallback(true); | |
| 440 capture_module_->EnableNoPictureAlarm(true); | |
| 441 } | 394 } |
| 442 | 395 |
| 443 void TearDown() { | 396 void TearDown() { |
| 444 process_module_->Stop(); | 397 process_module_->Stop(); |
| 445 } | 398 } |
| 446 | 399 |
| 447 webrtc::VideoCaptureExternal* capture_input_interface_; | 400 webrtc::VideoCaptureExternal* capture_input_interface_; |
| 448 rtc::scoped_refptr<VideoCaptureModule> capture_module_; | 401 rtc::scoped_refptr<VideoCaptureModule> capture_module_; |
| 449 std::unique_ptr<webrtc::ProcessThread> process_module_; | 402 std::unique_ptr<webrtc::ProcessThread> process_module_; |
| 450 std::unique_ptr<webrtc::VideoFrame> test_frame_; | 403 std::unique_ptr<webrtc::VideoFrame> test_frame_; |
| 451 TestVideoCaptureCallback capture_callback_; | 404 TestVideoCaptureCallback capture_callback_; |
| 452 TestVideoCaptureFeedBack capture_feedback_; | |
| 453 }; | 405 }; |
| 454 | 406 |
| 455 // Test input of external video frames. | 407 // Test input of external video frames. |
| 456 TEST_F(VideoCaptureExternalTest, TestExternalCapture) { | 408 TEST_F(VideoCaptureExternalTest, TestExternalCapture) { |
| 457 size_t length = webrtc::CalcBufferSize(webrtc::kI420, | 409 size_t length = webrtc::CalcBufferSize(webrtc::kI420, |
| 458 test_frame_->width(), | 410 test_frame_->width(), |
| 459 test_frame_->height()); | 411 test_frame_->height()); |
| 460 std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]); | 412 std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]); |
| 461 webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get()); | 413 webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get()); |
| 462 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 414 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
| 463 length, capture_callback_.capability(), 0)); | 415 length, capture_callback_.capability(), 0)); |
| 464 EXPECT_TRUE(capture_callback_.CompareLastFrame(*test_frame_)); | 416 EXPECT_TRUE(capture_callback_.CompareLastFrame(*test_frame_)); |
| 465 } | 417 } |
| 466 | 418 |
| 467 // Test frame rate and no picture alarm. | |
| 468 // Flaky on Win32, see webrtc:3270. | |
| 469 #if defined(WEBRTC_WIN) || defined(WEBRTC_MAC) | |
| 470 #define MAYBE_FrameRate DISABLED_FrameRate | |
| 471 #else | |
| 472 #define MAYBE_FrameRate FrameRate | |
| 473 #endif | |
| 474 TEST_F(VideoCaptureExternalTest, MAYBE_FrameRate) { | |
| 475 int64_t testTime = 3 * rtc::kNumNanosecsPerSec; | |
| 476 int64_t startTime = rtc::TimeNanos(); | |
| 477 | |
| 478 while ((rtc::TimeNanos() - startTime) < testTime) { | |
| 479 size_t length = webrtc::CalcBufferSize(webrtc::kI420, | |
| 480 test_frame_->width(), | |
| 481 test_frame_->height()); | |
| 482 std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]); | |
| 483 webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get()); | |
| 484 EXPECT_EQ( | |
| 485 0, capture_input_interface_->IncomingFrame( | |
| 486 test_buffer.get(), length, capture_callback_.capability(), 0)); | |
| 487 SleepMs(100); | |
| 488 } | |
| 489 EXPECT_TRUE(capture_feedback_.frame_rate() >= 8 && | |
| 490 capture_feedback_.frame_rate() <= 10); | |
| 491 SleepMs(500); | |
| 492 EXPECT_EQ(webrtc::Raised, capture_feedback_.alarm()); | |
| 493 | |
| 494 startTime = rtc::TimeNanos(); | |
| 495 while ((rtc::TimeNanos() - startTime) < testTime) { | |
| 496 size_t length = webrtc::CalcBufferSize(webrtc::kI420, | |
| 497 test_frame_->width(), | |
| 498 test_frame_->height()); | |
| 499 std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]); | |
| 500 webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get()); | |
| 501 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | |
| 502 length, capture_callback_.capability(), 0)); | |
| 503 SleepMs(1000 / 30); | |
| 504 } | |
| 505 EXPECT_EQ(webrtc::Cleared, capture_feedback_.alarm()); | |
| 506 // Frame rate might be less than 33 since we have paused providing | |
| 507 // frames for a while. | |
| 508 EXPECT_TRUE(capture_feedback_.frame_rate() >= 25 && | |
| 509 capture_feedback_.frame_rate() <= 33); | |
| 510 } | |
| 511 | |
| 512 TEST_F(VideoCaptureExternalTest, Rotation) { | 419 TEST_F(VideoCaptureExternalTest, Rotation) { |
| 513 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_0)); | 420 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_0)); |
| 514 size_t length = webrtc::CalcBufferSize(webrtc::kI420, | 421 size_t length = webrtc::CalcBufferSize(webrtc::kI420, |
| 515 test_frame_->width(), | 422 test_frame_->width(), |
| 516 test_frame_->height()); | 423 test_frame_->height()); |
| 517 std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]); | 424 std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]); |
| 518 webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get()); | 425 webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get()); |
| 519 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 426 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
| 520 length, capture_callback_.capability(), 0)); | 427 length, capture_callback_.capability(), 0)); |
| 521 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_90)); | 428 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_90)); |
| 522 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_90); | 429 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_90); |
| 523 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 430 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
| 524 length, capture_callback_.capability(), 0)); | 431 length, capture_callback_.capability(), 0)); |
| 525 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_180)); | 432 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_180)); |
| 526 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_180); | 433 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_180); |
| 527 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 434 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
| 528 length, capture_callback_.capability(), 0)); | 435 length, capture_callback_.capability(), 0)); |
| 529 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_270)); | 436 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_270)); |
| 530 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_270); | 437 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_270); |
| 531 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 438 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
| 532 length, capture_callback_.capability(), 0)); | 439 length, capture_callback_.capability(), 0)); |
| 533 } | 440 } |
| OLD | NEW |