| 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/renderer_host/media/video_capture_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 bool flip_vert, | 117 bool flip_vert, |
| 118 bool flip_horiz) OVERRIDE; | 118 bool flip_horiz) OVERRIDE; |
| 119 virtual void OnIncomingCapturedVideoFrame( | 119 virtual void OnIncomingCapturedVideoFrame( |
| 120 const scoped_refptr<media::VideoFrame>& frame, | 120 const scoped_refptr<media::VideoFrame>& frame, |
| 121 base::Time timestamp) OVERRIDE; | 121 base::Time timestamp) OVERRIDE; |
| 122 virtual void OnError() OVERRIDE; | 122 virtual void OnError() OVERRIDE; |
| 123 virtual void OnFrameInfo( | 123 virtual void OnFrameInfo( |
| 124 const media::VideoCaptureCapability& info) OVERRIDE; | 124 const media::VideoCaptureCapability& info) OVERRIDE; |
| 125 virtual void OnFrameInfoChanged( | 125 virtual void OnFrameInfoChanged( |
| 126 const media::VideoCaptureCapability& info) OVERRIDE; | 126 const media::VideoCaptureCapability& info) OVERRIDE; |
| 127 virtual void OnDeviceSupportedFormatsEnumerated( |
| 128 const media::VideoCaptureFormats& formats) OVERRIDE; |
| 127 | 129 |
| 128 private: | 130 private: |
| 129 // The controller to which we post events. | 131 // The controller to which we post events. |
| 130 const base::WeakPtr<VideoCaptureController> controller_; | 132 const base::WeakPtr<VideoCaptureController> controller_; |
| 131 | 133 |
| 132 // The pool of shared-memory buffers used for capturing. | 134 // The pool of shared-memory buffers used for capturing. |
| 133 scoped_refptr<VideoCaptureBufferPool> buffer_pool_; | 135 scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
| 134 | 136 |
| 135 // Chopped pixels in width/height in case video capture device has odd | 137 // Chopped pixels in width/height in case video capture device has odd |
| 136 // numbers for width/height. | 138 // numbers for width/height. |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 } | 672 } |
| 671 | 673 |
| 672 void VideoCaptureController::VideoCaptureDeviceClient::OnFrameInfoChanged( | 674 void VideoCaptureController::VideoCaptureDeviceClient::OnFrameInfoChanged( |
| 673 const media::VideoCaptureCapability& info) { | 675 const media::VideoCaptureCapability& info) { |
| 674 BrowserThread::PostTask(BrowserThread::IO, | 676 BrowserThread::PostTask(BrowserThread::IO, |
| 675 FROM_HERE, | 677 FROM_HERE, |
| 676 base::Bind(&VideoCaptureController::DoFrameInfoChangedOnIOThread, | 678 base::Bind(&VideoCaptureController::DoFrameInfoChangedOnIOThread, |
| 677 controller_, info)); | 679 controller_, info)); |
| 678 } | 680 } |
| 679 | 681 |
| 682 void VideoCaptureController::VideoCaptureDeviceClient:: |
| 683 OnDeviceSupportedFormatsEnumerated( |
| 684 const media::VideoCaptureFormats& formats) { |
| 685 NOTIMPLEMENTED(); |
| 686 } |
| 687 |
| 680 VideoCaptureController::~VideoCaptureController() { | 688 VideoCaptureController::~VideoCaptureController() { |
| 681 buffer_pool_ = NULL; // Release all buffers. | 689 buffer_pool_ = NULL; // Release all buffers. |
| 682 STLDeleteContainerPointers(controller_clients_.begin(), | 690 STLDeleteContainerPointers(controller_clients_.begin(), |
| 683 controller_clients_.end()); | 691 controller_clients_.end()); |
| 684 } | 692 } |
| 685 | 693 |
| 686 void VideoCaptureController::DoIncomingCapturedFrameOnIOThread( | 694 void VideoCaptureController::DoIncomingCapturedFrameOnIOThread( |
| 687 const scoped_refptr<media::VideoFrame>& reserved_frame, | 695 const scoped_refptr<media::VideoFrame>& reserved_frame, |
| 688 base::Time timestamp) { | 696 base::Time timestamp) { |
| 689 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 697 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 } | 819 } |
| 812 return NULL; | 820 return NULL; |
| 813 } | 821 } |
| 814 | 822 |
| 815 int VideoCaptureController::GetClientCount() { | 823 int VideoCaptureController::GetClientCount() { |
| 816 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 824 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 817 return controller_clients_.size(); | 825 return controller_clients_.size(); |
| 818 } | 826 } |
| 819 | 827 |
| 820 } // namespace content | 828 } // namespace content |
| OLD | NEW |