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/renderer/media/video_capture_impl.h" | 5 #include "content/renderer/media/video_capture_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "content/common/child_process.h" | 9 #include "content/common/child_process.h" |
10 #include "content/common/media/video_capture_messages.h" | 10 #include "content/common/media/video_capture_messages.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 VideoCaptureImpl::VideoCaptureImpl( | 46 VideoCaptureImpl::VideoCaptureImpl( |
47 const media::VideoCaptureSessionId id, | 47 const media::VideoCaptureSessionId id, |
48 base::MessageLoopProxy* capture_message_loop_proxy, | 48 base::MessageLoopProxy* capture_message_loop_proxy, |
49 VideoCaptureMessageFilter* filter) | 49 VideoCaptureMessageFilter* filter) |
50 : VideoCapture(), | 50 : VideoCapture(), |
51 message_filter_(filter), | 51 message_filter_(filter), |
52 capture_message_loop_proxy_(capture_message_loop_proxy), | 52 capture_message_loop_proxy_(capture_message_loop_proxy), |
53 device_id_(0), | 53 device_id_(0), |
54 video_type_(media::VideoFrame::I420), | 54 video_type_(media::VideoCaptureCapability::kI420), |
55 device_info_available_(false), | 55 device_info_available_(false), |
56 state_(video_capture::kStopped) { | 56 state_(video_capture::kStopped) { |
57 DCHECK(filter); | 57 DCHECK(filter); |
58 memset(¤t_params_, 0, sizeof(current_params_)); | 58 memset(¤t_params_, 0, sizeof(current_params_)); |
59 memset(&device_info_, 0, sizeof(device_info_)); | 59 memset(&device_info_, 0, sizeof(device_info_)); |
60 current_params_.session_id = id; | 60 current_params_.session_id = id; |
61 } | 61 } |
62 | 62 |
63 VideoCaptureImpl::~VideoCaptureImpl() { | 63 VideoCaptureImpl::~VideoCaptureImpl() { |
64 STLDeleteContainerPairSecondPointers(cached_dibs_.begin(), | 64 STLDeleteContainerPairSecondPointers(cached_dibs_.begin(), |
(...skipping 23 matching lines...) Expand all Loading... |
88 Send(new VideoCaptureHostMsg_Stop(device_id_)); | 88 Send(new VideoCaptureHostMsg_Stop(device_id_)); |
89 | 89 |
90 io_message_loop_proxy_->PostTask(FROM_HERE, | 90 io_message_loop_proxy_->PostTask(FROM_HERE, |
91 base::Bind(&VideoCaptureImpl::RemoveDelegateOnIOThread, | 91 base::Bind(&VideoCaptureImpl::RemoveDelegateOnIOThread, |
92 base::Unretained(this), task)); | 92 base::Unretained(this), task)); |
93 } | 93 } |
94 | 94 |
95 void VideoCaptureImpl::StartCapture( | 95 void VideoCaptureImpl::StartCapture( |
96 media::VideoCapture::EventHandler* handler, | 96 media::VideoCapture::EventHandler* handler, |
97 const media::VideoCaptureCapability& capability) { | 97 const media::VideoCaptureCapability& capability) { |
98 DCHECK_EQ(capability.color, media::VideoFrame::I420); | 98 DCHECK_EQ(capability.color, media::VideoCaptureCapability::kI420); |
99 | 99 |
100 capture_message_loop_proxy_->PostTask(FROM_HERE, | 100 capture_message_loop_proxy_->PostTask(FROM_HERE, |
101 base::Bind(&VideoCaptureImpl::DoStartCapture, | 101 base::Bind(&VideoCaptureImpl::DoStartCapture, |
102 base::Unretained(this), handler, capability)); | 102 base::Unretained(this), handler, capability)); |
103 } | 103 } |
104 | 104 |
105 void VideoCaptureImpl::StopCapture(media::VideoCapture::EventHandler* handler) { | 105 void VideoCaptureImpl::StopCapture(media::VideoCapture::EventHandler* handler) { |
106 capture_message_loop_proxy_->PostTask(FROM_HERE, | 106 capture_message_loop_proxy_->PostTask(FROM_HERE, |
107 base::Bind(&VideoCaptureImpl::DoStopCapture, | 107 base::Bind(&VideoCaptureImpl::DoStopCapture, |
108 base::Unretained(this), handler)); | 108 base::Unretained(this), handler)); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 | 432 |
433 bool VideoCaptureImpl::ClientHasDIB() { | 433 bool VideoCaptureImpl::ClientHasDIB() { |
434 CachedDIB::iterator it; | 434 CachedDIB::iterator it; |
435 for (it = cached_dibs_.begin(); it != cached_dibs_.end(); it++) { | 435 for (it = cached_dibs_.begin(); it != cached_dibs_.end(); it++) { |
436 if (it->second->references > 0) | 436 if (it->second->references > 0) |
437 return true; | 437 return true; |
438 } | 438 } |
439 return false; | 439 return false; |
440 } | 440 } |
OLD | NEW |