| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents_video_capture_device.h" | 5 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 11 #include "base/debug/debugger.h" | 12 #include "base/debug/debugger.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 14 #include "base/test/test_timeouts.h" | 15 #include "base/test/test_timeouts.h" |
| 15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 16 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 18 #include "content/browser/browser_thread_impl.h" | 19 #include "content/browser/browser_thread_impl.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 422 |
| 422 private: | 423 private: |
| 423 class AutoReleaseBuffer : public media::VideoCaptureDevice::Client::Buffer { | 424 class AutoReleaseBuffer : public media::VideoCaptureDevice::Client::Buffer { |
| 424 public: | 425 public: |
| 425 AutoReleaseBuffer( | 426 AutoReleaseBuffer( |
| 426 const scoped_refptr<VideoCaptureBufferPool>& pool, | 427 const scoped_refptr<VideoCaptureBufferPool>& pool, |
| 427 scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle, | 428 scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle, |
| 428 int buffer_id) | 429 int buffer_id) |
| 429 : id_(buffer_id), | 430 : id_(buffer_id), |
| 430 pool_(pool), | 431 pool_(pool), |
| 431 buffer_handle_(buffer_handle.Pass()) { | 432 buffer_handle_(std::move(buffer_handle)) { |
| 432 DCHECK(pool_.get()); | 433 DCHECK(pool_.get()); |
| 433 } | 434 } |
| 434 int id() const override { return id_; } | 435 int id() const override { return id_; } |
| 435 gfx::Size dimensions() const override { return gfx::Size(); } | 436 gfx::Size dimensions() const override { return gfx::Size(); } |
| 436 size_t mapped_size() const override { | 437 size_t mapped_size() const override { |
| 437 return buffer_handle_->mapped_size(); | 438 return buffer_handle_->mapped_size(); |
| 438 } | 439 } |
| 439 void* data(int plane) override { return buffer_handle_->data(plane); } | 440 void* data(int plane) override { return buffer_handle_->data(plane); } |
| 440 ClientBuffer AsClientBuffer(int plane) override { return nullptr; } | 441 ClientBuffer AsClientBuffer(int plane) override { return nullptr; } |
| 441 #if defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS)) | 442 #if defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS)) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 467 wait_size_(kTestWidth, kTestHeight) { | 468 wait_size_(kTestWidth, kTestHeight) { |
| 468 client_.reset(new StubClient( | 469 client_.reset(new StubClient( |
| 469 base::Bind(&StubClientObserver::DidDeliverFrame, | 470 base::Bind(&StubClientObserver::DidDeliverFrame, |
| 470 base::Unretained(this)), | 471 base::Unretained(this)), |
| 471 base::Bind(&StubClientObserver::OnError, base::Unretained(this)))); | 472 base::Bind(&StubClientObserver::OnError, base::Unretained(this)))); |
| 472 } | 473 } |
| 473 | 474 |
| 474 virtual ~StubClientObserver() {} | 475 virtual ~StubClientObserver() {} |
| 475 | 476 |
| 476 scoped_ptr<media::VideoCaptureDevice::Client> PassClient() { | 477 scoped_ptr<media::VideoCaptureDevice::Client> PassClient() { |
| 477 return client_.Pass(); | 478 return std::move(client_); |
| 478 } | 479 } |
| 479 | 480 |
| 480 void QuitIfConditionsMet(SkColor color, const gfx::Size& size) { | 481 void QuitIfConditionsMet(SkColor color, const gfx::Size& size) { |
| 481 base::AutoLock guard(lock_); | 482 base::AutoLock guard(lock_); |
| 482 if (error_encountered_) | 483 if (error_encountered_) |
| 483 base::MessageLoop::current()->QuitWhenIdle(); | 484 base::MessageLoop::current()->QuitWhenIdle(); |
| 484 else if (wait_color_yuv_ == color && wait_size_.IsEmpty()) | 485 else if (wait_color_yuv_ == color && wait_size_.IsEmpty()) |
| 485 base::MessageLoop::current()->QuitWhenIdle(); | 486 base::MessageLoop::current()->QuitWhenIdle(); |
| 486 else if (wait_color_yuv_ == color && wait_size_ == size) | 487 else if (wait_color_yuv_ == color && wait_size_ == size) |
| 487 base::MessageLoop::current()->QuitWhenIdle(); | 488 base::MessageLoop::current()->QuitWhenIdle(); |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 policies[i], gfx::Size(1000, 1000), gfx::Size(1000, 1000)); | 1143 policies[i], gfx::Size(1000, 1000), gfx::Size(1000, 1000)); |
| 1143 RunTestForPreferredSize( | 1144 RunTestForPreferredSize( |
| 1144 policies[i], gfx::Size(1600, 1000), gfx::Size(1600, 1000)); | 1145 policies[i], gfx::Size(1600, 1000), gfx::Size(1600, 1000)); |
| 1145 RunTestForPreferredSize( | 1146 RunTestForPreferredSize( |
| 1146 policies[i], gfx::Size(837, 999), gfx::Size(837, 999)); | 1147 policies[i], gfx::Size(837, 999), gfx::Size(837, 999)); |
| 1147 } | 1148 } |
| 1148 } | 1149 } |
| 1149 | 1150 |
| 1150 } // namespace | 1151 } // namespace |
| 1151 } // namespace content | 1152 } // namespace content |
| OLD | NEW |