| 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 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 void OnError(const tracked_objects::Location& from_here, | 415 void OnError(const tracked_objects::Location& from_here, |
| 416 const std::string& reason) override { | 416 const std::string& reason) override { |
| 417 error_callback_.Run(); | 417 error_callback_.Run(); |
| 418 } | 418 } |
| 419 | 419 |
| 420 double GetBufferPoolUtilization() const override { return 0.0; } | 420 double GetBufferPoolUtilization() const override { return 0.0; } |
| 421 | 421 |
| 422 private: | 422 private: |
| 423 class AutoReleaseBuffer : public media::VideoCaptureDevice::Client::Buffer { | 423 class AutoReleaseBuffer : public media::VideoCaptureDevice::Client::Buffer { |
| 424 public: | 424 public: |
| 425 AutoReleaseBuffer( | 425 AutoReleaseBuffer(const scoped_refptr<VideoCaptureBufferPool>& pool, |
| 426 const scoped_refptr<VideoCaptureBufferPool>& pool, | 426 std::unique_ptr<VideoCaptureBufferHandle> buffer_handle, |
| 427 std::unique_ptr<VideoCaptureBufferPoolBufferHandle> buffer_handle, | 427 int buffer_id) |
| 428 int buffer_id) | |
| 429 : id_(buffer_id), | 428 : id_(buffer_id), |
| 430 pool_(pool), | 429 pool_(pool), |
| 431 buffer_handle_(std::move(buffer_handle)) { | 430 buffer_handle_(std::move(buffer_handle)) { |
| 432 DCHECK(pool_); | 431 DCHECK(pool_); |
| 433 } | 432 } |
| 434 int id() const override { return id_; } | 433 int id() const override { return id_; } |
| 435 gfx::Size dimensions() const override { | 434 gfx::Size dimensions() const override { |
| 436 return buffer_handle_->dimensions(); | 435 return buffer_handle_->dimensions(); |
| 437 } | 436 } |
| 438 size_t mapped_size() const override { | 437 size_t mapped_size() const override { |
| 439 return buffer_handle_->mapped_size(); | 438 return buffer_handle_->mapped_size(); |
| 440 } | 439 } |
| 441 void* data(int plane) override { return buffer_handle_->data(plane); } | 440 void* data(int plane) override { return buffer_handle_->data(plane); } |
| 442 ClientBuffer AsClientBuffer(int plane) override { return nullptr; } | 441 ClientBuffer AsClientBuffer(int plane) override { return nullptr; } |
| 443 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 442 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 444 base::FileDescriptor AsPlatformFile() override { | 443 base::FileDescriptor AsPlatformFile() override { |
| 445 return base::FileDescriptor(); | 444 return base::FileDescriptor(); |
| 446 } | 445 } |
| 447 #endif | 446 #endif |
| 448 | 447 |
| 449 private: | 448 private: |
| 450 ~AutoReleaseBuffer() override { pool_->RelinquishProducerReservation(id_); } | 449 ~AutoReleaseBuffer() override { pool_->RelinquishProducerReservation(id_); } |
| 451 | 450 |
| 452 const int id_; | 451 const int id_; |
| 453 const scoped_refptr<VideoCaptureBufferPool> pool_; | 452 const scoped_refptr<VideoCaptureBufferPool> pool_; |
| 454 const std::unique_ptr<VideoCaptureBufferPoolBufferHandle> buffer_handle_; | 453 const std::unique_ptr<VideoCaptureBufferHandle> buffer_handle_; |
| 455 }; | 454 }; |
| 456 | 455 |
| 457 scoped_refptr<VideoCaptureBufferPool> buffer_pool_; | 456 scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
| 458 base::Callback<void(SkColor, const gfx::Size&)> report_callback_; | 457 base::Callback<void(SkColor, const gfx::Size&)> report_callback_; |
| 459 base::Closure error_callback_; | 458 base::Closure error_callback_; |
| 460 | 459 |
| 461 DISALLOW_COPY_AND_ASSIGN(StubClient); | 460 DISALLOW_COPY_AND_ASSIGN(StubClient); |
| 462 }; | 461 }; |
| 463 | 462 |
| 464 class StubClientObserver { | 463 class StubClientObserver { |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 for (int i = 0; i < 3; ++i) { | 1208 for (int i = 0; i < 3; ++i) { |
| 1210 SimulateRefreshFrameRequest(); | 1209 SimulateRefreshFrameRequest(); |
| 1211 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); | 1210 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
| 1212 } | 1211 } |
| 1213 | 1212 |
| 1214 device()->StopAndDeAllocate(); | 1213 device()->StopAndDeAllocate(); |
| 1215 } | 1214 } |
| 1216 | 1215 |
| 1217 } // namespace | 1216 } // namespace |
| 1218 } // namespace content | 1217 } // namespace content |
| OLD | NEW |