| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/media/capture/desktop_capture_device.h" | 5 #include "content/browser/media/capture/desktop_capture_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // Use a special value for frame pixels to tell pixel bytes apart from the | 53 // Use a special value for frame pixels to tell pixel bytes apart from the |
| 54 // padding bytes in the unpacked frame test. | 54 // padding bytes in the unpacked frame test. |
| 55 const uint8_t kFakePixelValue = 1; | 55 const uint8_t kFakePixelValue = 1; |
| 56 | 56 |
| 57 // Use a special value for the first pixel to verify the result in the inverted | 57 // Use a special value for the first pixel to verify the result in the inverted |
| 58 // frame test. | 58 // frame test. |
| 59 const uint8_t kFakePixelValueFirst = 2; | 59 const uint8_t kFakePixelValueFirst = 2; |
| 60 | 60 |
| 61 class MockDeviceClient : public media::VideoCaptureDevice::Client { | 61 class MockDeviceClient : public media::VideoCaptureDevice::Client { |
| 62 public: | 62 public: |
| 63 MOCK_METHOD6(OnIncomingCapturedData, | 63 MOCK_METHOD7(OnIncomingCapturedData, |
| 64 void(const uint8_t* data, | 64 void(const uint8_t* data, |
| 65 int length, | 65 int length, |
| 66 const media::VideoCaptureFormat& frame_format, | 66 const media::VideoCaptureFormat& frame_format, |
| 67 int rotation, | 67 int rotation, |
| 68 base::TimeTicks reference_time, | 68 base::TimeTicks reference_time, |
| 69 base::TimeDelta timestamp)); | 69 base::TimeDelta timestamp, |
| 70 int frame_feedback_id)); |
| 70 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); | 71 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); |
| 71 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); | 72 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); |
| 72 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); | 73 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); |
| 73 MOCK_METHOD0(DoResurrectLastOutputBuffer, void(void)); | 74 MOCK_METHOD0(DoResurrectLastOutputBuffer, void(void)); |
| 74 MOCK_METHOD2(OnError, | 75 MOCK_METHOD2(OnError, |
| 75 void(const tracked_objects::Location& from_here, | 76 void(const tracked_objects::Location& from_here, |
| 76 const std::string& reason)); | 77 const std::string& reason)); |
| 77 | 78 |
| 78 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>. | 79 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>. |
| 79 std::unique_ptr<Buffer> ReserveOutputBuffer( | 80 std::unique_ptr<Buffer> ReserveOutputBuffer(const gfx::Size& dimensions, |
| 80 const gfx::Size& dimensions, | 81 media::VideoPixelFormat format, |
| 81 media::VideoPixelFormat format, | 82 media::VideoPixelStorage storage, |
| 82 media::VideoPixelStorage storage) override { | 83 int frame_feedback_id) override { |
| 83 EXPECT_TRUE(format == media::PIXEL_FORMAT_I420 && | 84 EXPECT_TRUE(format == media::PIXEL_FORMAT_I420 && |
| 84 storage == media::PIXEL_STORAGE_CPU); | 85 storage == media::PIXEL_STORAGE_CPU); |
| 85 DoReserveOutputBuffer(); | 86 DoReserveOutputBuffer(); |
| 86 return std::unique_ptr<Buffer>(); | 87 return std::unique_ptr<Buffer>(); |
| 87 } | 88 } |
| 88 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, | 89 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, |
| 89 const media::VideoCaptureFormat& frame_format, | 90 const media::VideoCaptureFormat& format, |
| 90 base::TimeTicks reference_time, | 91 base::TimeTicks reference_time, |
| 91 base::TimeDelta timestamp) override { | 92 base::TimeDelta timestamp) override { |
| 92 DoOnIncomingCapturedBuffer(); | 93 DoOnIncomingCapturedBuffer(); |
| 93 } | 94 } |
| 94 void OnIncomingCapturedVideoFrame( | 95 void OnIncomingCapturedVideoFrame( |
| 95 std::unique_ptr<Buffer> buffer, | 96 std::unique_ptr<Buffer> buffer, |
| 96 scoped_refptr<media::VideoFrame> frame) override { | 97 scoped_refptr<media::VideoFrame> frame) override { |
| 97 DoOnIncomingCapturedVideoFrame(); | 98 DoOnIncomingCapturedVideoFrame(); |
| 98 } | 99 } |
| 99 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( | 100 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( |
| 100 const gfx::Size& dimensions, | 101 const gfx::Size& dimensions, |
| 101 media::VideoPixelFormat format, | 102 media::VideoPixelFormat format, |
| 102 media::VideoPixelStorage storage) override { | 103 media::VideoPixelStorage storage, |
| 104 int frame_feedback_id) override { |
| 103 EXPECT_TRUE(format == media::PIXEL_FORMAT_I420 && | 105 EXPECT_TRUE(format == media::PIXEL_FORMAT_I420 && |
| 104 storage == media::PIXEL_STORAGE_CPU); | 106 storage == media::PIXEL_STORAGE_CPU); |
| 105 DoResurrectLastOutputBuffer(); | 107 DoResurrectLastOutputBuffer(); |
| 106 return std::unique_ptr<Buffer>(); | 108 return std::unique_ptr<Buffer>(); |
| 107 } | 109 } |
| 108 double GetBufferPoolUtilization() const override { return 0.0; } | 110 double GetBufferPoolUtilization() const override { return 0.0; } |
| 109 }; | 111 }; |
| 110 | 112 |
| 111 // Creates a DesktopFrame that has the first pixel bytes set to | 113 // Creates a DesktopFrame that has the first pixel bytes set to |
| 112 // kFakePixelValueFirst, and the rest of the bytes set to kFakePixelValue, for | 114 // kFakePixelValueFirst, and the rest of the bytes set to kFakePixelValue, for |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 std::unique_ptr<webrtc::DesktopCapturer> capturer) { | 259 std::unique_ptr<webrtc::DesktopCapturer> capturer) { |
| 258 capture_device_.reset(new DesktopCaptureDevice( | 260 capture_device_.reset(new DesktopCaptureDevice( |
| 259 std::move(capturer), DesktopMediaID::TYPE_SCREEN)); | 261 std::move(capturer), DesktopMediaID::TYPE_SCREEN)); |
| 260 } | 262 } |
| 261 | 263 |
| 262 void CopyFrame(const uint8_t* frame, | 264 void CopyFrame(const uint8_t* frame, |
| 263 int size, | 265 int size, |
| 264 const media::VideoCaptureFormat&, | 266 const media::VideoCaptureFormat&, |
| 265 int, | 267 int, |
| 266 base::TimeTicks, | 268 base::TimeTicks, |
| 267 base::TimeDelta) { | 269 base::TimeDelta, |
| 270 int) { |
| 268 ASSERT_TRUE(output_frame_); | 271 ASSERT_TRUE(output_frame_); |
| 269 ASSERT_EQ(output_frame_->stride() * output_frame_->size().height(), size); | 272 ASSERT_EQ(output_frame_->stride() * output_frame_->size().height(), size); |
| 270 memcpy(output_frame_->data(), frame, size); | 273 memcpy(output_frame_->data(), frame, size); |
| 271 } | 274 } |
| 272 | 275 |
| 273 protected: | 276 protected: |
| 274 std::unique_ptr<DesktopCaptureDevice> capture_device_; | 277 std::unique_ptr<DesktopCaptureDevice> capture_device_; |
| 275 std::unique_ptr<webrtc::DesktopFrame> output_frame_; | 278 std::unique_ptr<webrtc::DesktopFrame> output_frame_; |
| 276 }; | 279 }; |
| 277 | 280 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 290 CreateScreenCaptureDevice(std::move(capturer)); | 293 CreateScreenCaptureDevice(std::move(capturer)); |
| 291 | 294 |
| 292 media::VideoCaptureFormat format; | 295 media::VideoCaptureFormat format; |
| 293 base::WaitableEvent done_event( | 296 base::WaitableEvent done_event( |
| 294 base::WaitableEvent::ResetPolicy::AUTOMATIC, | 297 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 295 base::WaitableEvent::InitialState::NOT_SIGNALED); | 298 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 296 int frame_size; | 299 int frame_size; |
| 297 | 300 |
| 298 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); | 301 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); |
| 299 EXPECT_CALL(*client, OnError(_, _)).Times(0); | 302 EXPECT_CALL(*client, OnError(_, _)).Times(0); |
| 300 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _)) | 303 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _, _)) |
| 301 .WillRepeatedly( | 304 .WillRepeatedly( |
| 302 DoAll(SaveArg<1>(&frame_size), SaveArg<2>(&format), | 305 DoAll(SaveArg<1>(&frame_size), SaveArg<2>(&format), |
| 303 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); | 306 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); |
| 304 | 307 |
| 305 media::VideoCaptureParams capture_params; | 308 media::VideoCaptureParams capture_params; |
| 306 capture_params.requested_format.frame_size.SetSize(640, 480); | 309 capture_params.requested_format.frame_size.SetSize(640, 480); |
| 307 capture_params.requested_format.frame_rate = kFrameRate; | 310 capture_params.requested_format.frame_rate = kFrameRate; |
| 308 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 311 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
| 309 capture_device_->AllocateAndStart(capture_params, std::move(client)); | 312 capture_device_->AllocateAndStart(capture_params, std::move(client)); |
| 310 EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout())); | 313 EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout())); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 327 std::unique_ptr<webrtc::DesktopCapturer>(mock_capturer)); | 330 std::unique_ptr<webrtc::DesktopCapturer>(mock_capturer)); |
| 328 | 331 |
| 329 FormatChecker format_checker(gfx::Size(kTestFrameWidth1, kTestFrameHeight1), | 332 FormatChecker format_checker(gfx::Size(kTestFrameWidth1, kTestFrameHeight1), |
| 330 gfx::Size(kTestFrameWidth1, kTestFrameHeight1)); | 333 gfx::Size(kTestFrameWidth1, kTestFrameHeight1)); |
| 331 base::WaitableEvent done_event( | 334 base::WaitableEvent done_event( |
| 332 base::WaitableEvent::ResetPolicy::AUTOMATIC, | 335 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 333 base::WaitableEvent::InitialState::NOT_SIGNALED); | 336 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 334 | 337 |
| 335 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); | 338 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); |
| 336 EXPECT_CALL(*client, OnError(_, _)).Times(0); | 339 EXPECT_CALL(*client, OnError(_, _)).Times(0); |
| 337 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _)) | 340 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _, _)) |
| 338 .WillRepeatedly( | 341 .WillRepeatedly( |
| 339 DoAll(WithArg<2>(Invoke(&format_checker, | 342 DoAll(WithArg<2>(Invoke(&format_checker, |
| 340 &FormatChecker::ExpectAcceptableSize)), | 343 &FormatChecker::ExpectAcceptableSize)), |
| 341 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); | 344 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); |
| 342 | 345 |
| 343 media::VideoCaptureParams capture_params; | 346 media::VideoCaptureParams capture_params; |
| 344 capture_params.requested_format.frame_size.SetSize(kTestFrameWidth1, | 347 capture_params.requested_format.frame_size.SetSize(kTestFrameWidth1, |
| 345 kTestFrameHeight1); | 348 kTestFrameHeight1); |
| 346 capture_params.requested_format.frame_rate = kFrameRate; | 349 capture_params.requested_format.frame_rate = kFrameRate; |
| 347 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 350 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 371 CreateScreenCaptureDevice( | 374 CreateScreenCaptureDevice( |
| 372 std::unique_ptr<webrtc::DesktopCapturer>(mock_capturer)); | 375 std::unique_ptr<webrtc::DesktopCapturer>(mock_capturer)); |
| 373 | 376 |
| 374 FormatChecker format_checker(gfx::Size(888, 500), gfx::Size(532, 300)); | 377 FormatChecker format_checker(gfx::Size(888, 500), gfx::Size(532, 300)); |
| 375 base::WaitableEvent done_event( | 378 base::WaitableEvent done_event( |
| 376 base::WaitableEvent::ResetPolicy::AUTOMATIC, | 379 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 377 base::WaitableEvent::InitialState::NOT_SIGNALED); | 380 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 378 | 381 |
| 379 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); | 382 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); |
| 380 EXPECT_CALL(*client, OnError(_,_)).Times(0); | 383 EXPECT_CALL(*client, OnError(_,_)).Times(0); |
| 381 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _)) | 384 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _, _)) |
| 382 .WillRepeatedly( | 385 .WillRepeatedly( |
| 383 DoAll(WithArg<2>(Invoke(&format_checker, | 386 DoAll(WithArg<2>(Invoke(&format_checker, |
| 384 &FormatChecker::ExpectAcceptableSize)), | 387 &FormatChecker::ExpectAcceptableSize)), |
| 385 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); | 388 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); |
| 386 | 389 |
| 387 media::VideoCaptureParams capture_params; | 390 media::VideoCaptureParams capture_params; |
| 388 const gfx::Size high_def_16_by_9(1920, 1080); | 391 const gfx::Size high_def_16_by_9(1920, 1080); |
| 389 ASSERT_GE(high_def_16_by_9.width(), | 392 ASSERT_GE(high_def_16_by_9.width(), |
| 390 std::max(kTestFrameWidth1, kTestFrameWidth2)); | 393 std::max(kTestFrameWidth1, kTestFrameWidth2)); |
| 391 ASSERT_GE(high_def_16_by_9.height(), | 394 ASSERT_GE(high_def_16_by_9.height(), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 419 std::unique_ptr<webrtc::DesktopCapturer>(mock_capturer)); | 422 std::unique_ptr<webrtc::DesktopCapturer>(mock_capturer)); |
| 420 | 423 |
| 421 FormatChecker format_checker(gfx::Size(kTestFrameWidth1, kTestFrameHeight1), | 424 FormatChecker format_checker(gfx::Size(kTestFrameWidth1, kTestFrameHeight1), |
| 422 gfx::Size(kTestFrameWidth2, kTestFrameHeight2)); | 425 gfx::Size(kTestFrameWidth2, kTestFrameHeight2)); |
| 423 base::WaitableEvent done_event( | 426 base::WaitableEvent done_event( |
| 424 base::WaitableEvent::ResetPolicy::AUTOMATIC, | 427 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 425 base::WaitableEvent::InitialState::NOT_SIGNALED); | 428 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 426 | 429 |
| 427 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); | 430 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); |
| 428 EXPECT_CALL(*client, OnError(_,_)).Times(0); | 431 EXPECT_CALL(*client, OnError(_,_)).Times(0); |
| 429 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _)) | 432 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _, _)) |
| 430 .WillRepeatedly( | 433 .WillRepeatedly( |
| 431 DoAll(WithArg<2>(Invoke(&format_checker, | 434 DoAll(WithArg<2>(Invoke(&format_checker, |
| 432 &FormatChecker::ExpectAcceptableSize)), | 435 &FormatChecker::ExpectAcceptableSize)), |
| 433 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); | 436 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); |
| 434 | 437 |
| 435 media::VideoCaptureParams capture_params; | 438 media::VideoCaptureParams capture_params; |
| 436 const gfx::Size high_def_16_by_9(1920, 1080); | 439 const gfx::Size high_def_16_by_9(1920, 1080); |
| 437 ASSERT_GE(high_def_16_by_9.width(), | 440 ASSERT_GE(high_def_16_by_9.width(), |
| 438 std::max(kTestFrameWidth1, kTestFrameWidth2)); | 441 std::max(kTestFrameWidth1, kTestFrameWidth2)); |
| 439 ASSERT_GE(high_def_16_by_9.height(), | 442 ASSERT_GE(high_def_16_by_9.height(), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 469 base::WaitableEvent done_event( | 472 base::WaitableEvent done_event( |
| 470 base::WaitableEvent::ResetPolicy::AUTOMATIC, | 473 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 471 base::WaitableEvent::InitialState::NOT_SIGNALED); | 474 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 472 | 475 |
| 473 int frame_size = 0; | 476 int frame_size = 0; |
| 474 output_frame_.reset(new webrtc::BasicDesktopFrame( | 477 output_frame_.reset(new webrtc::BasicDesktopFrame( |
| 475 webrtc::DesktopSize(kTestFrameWidth1, kTestFrameHeight1))); | 478 webrtc::DesktopSize(kTestFrameWidth1, kTestFrameHeight1))); |
| 476 | 479 |
| 477 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); | 480 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); |
| 478 EXPECT_CALL(*client, OnError(_,_)).Times(0); | 481 EXPECT_CALL(*client, OnError(_,_)).Times(0); |
| 479 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _)) | 482 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _, _)) |
| 480 .WillRepeatedly( | 483 .WillRepeatedly( |
| 481 DoAll(Invoke(this, &DesktopCaptureDeviceTest::CopyFrame), | 484 DoAll(Invoke(this, &DesktopCaptureDeviceTest::CopyFrame), |
| 482 SaveArg<1>(&frame_size), | 485 SaveArg<1>(&frame_size), |
| 483 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); | 486 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); |
| 484 | 487 |
| 485 media::VideoCaptureParams capture_params; | 488 media::VideoCaptureParams capture_params; |
| 486 capture_params.requested_format.frame_size.SetSize(kTestFrameWidth1, | 489 capture_params.requested_format.frame_size.SetSize(kTestFrameWidth1, |
| 487 kTestFrameHeight1); | 490 kTestFrameHeight1); |
| 488 capture_params.requested_format.frame_rate = kFrameRate; | 491 capture_params.requested_format.frame_rate = kFrameRate; |
| 489 capture_params.requested_format.pixel_format = | 492 capture_params.requested_format.pixel_format = |
| (...skipping 26 matching lines...) Expand all Loading... |
| 516 base::WaitableEvent done_event( | 519 base::WaitableEvent done_event( |
| 517 base::WaitableEvent::ResetPolicy::AUTOMATIC, | 520 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 518 base::WaitableEvent::InitialState::NOT_SIGNALED); | 521 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 519 | 522 |
| 520 int frame_size = 0; | 523 int frame_size = 0; |
| 521 output_frame_.reset(new webrtc::BasicDesktopFrame( | 524 output_frame_.reset(new webrtc::BasicDesktopFrame( |
| 522 webrtc::DesktopSize(kTestFrameWidth1, kTestFrameHeight1))); | 525 webrtc::DesktopSize(kTestFrameWidth1, kTestFrameHeight1))); |
| 523 | 526 |
| 524 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); | 527 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); |
| 525 EXPECT_CALL(*client, OnError(_,_)).Times(0); | 528 EXPECT_CALL(*client, OnError(_,_)).Times(0); |
| 526 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _)) | 529 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _, _, _)) |
| 527 .WillRepeatedly( | 530 .WillRepeatedly( |
| 528 DoAll(Invoke(this, &DesktopCaptureDeviceTest::CopyFrame), | 531 DoAll(Invoke(this, &DesktopCaptureDeviceTest::CopyFrame), |
| 529 SaveArg<1>(&frame_size), | 532 SaveArg<1>(&frame_size), |
| 530 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); | 533 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); |
| 531 | 534 |
| 532 media::VideoCaptureParams capture_params; | 535 media::VideoCaptureParams capture_params; |
| 533 capture_params.requested_format.frame_size.SetSize(kTestFrameWidth1, | 536 capture_params.requested_format.frame_size.SetSize(kTestFrameWidth1, |
| 534 kTestFrameHeight1); | 537 kTestFrameHeight1); |
| 535 capture_params.requested_format.frame_rate = kFrameRate; | 538 capture_params.requested_format.frame_rate = kFrameRate; |
| 536 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 539 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 550 frame_size); | 553 frame_size); |
| 551 for (int i = 0; i < output_frame_->size().height(); ++i) { | 554 for (int i = 0; i < output_frame_->size().height(); ++i) { |
| 552 EXPECT_EQ(0, | 555 EXPECT_EQ(0, |
| 553 memcmp(inverted_frame->data() + i * inverted_frame->stride(), | 556 memcmp(inverted_frame->data() + i * inverted_frame->stride(), |
| 554 output_frame_->data() + i * output_frame_->stride(), | 557 output_frame_->data() + i * output_frame_->stride(), |
| 555 output_frame_->stride())); | 558 output_frame_->stride())); |
| 556 } | 559 } |
| 557 } | 560 } |
| 558 | 561 |
| 559 } // namespace content | 562 } // namespace content |
| OLD | NEW |