| 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 "media/video/capture/fake_video_capture_device.h" | 5 #include "media/video/capture/fake_video_capture_device.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return; // Wrong state. | 142 return; // Wrong state. |
| 143 } | 143 } |
| 144 capture_thread_.Stop(); | 144 capture_thread_.Stop(); |
| 145 state_ = kIdle; | 145 state_ = kIdle; |
| 146 } | 146 } |
| 147 | 147 |
| 148 const VideoCaptureDevice::Name& FakeVideoCaptureDevice::device_name() { | 148 const VideoCaptureDevice::Name& FakeVideoCaptureDevice::device_name() { |
| 149 return device_name_; | 149 return device_name_; |
| 150 } | 150 } |
| 151 | 151 |
| 152 void FakeVideoCaptureDevice::GetDeviceSupportedFormats( |
| 153 const std::string& device_name, |
| 154 VideoCaptureFormats* capture_formats) { |
| 155 media::VideoCaptureCapability capture_format; |
| 156 capture_format.color = media::PIXEL_FORMAT_I420; |
| 157 capture_format.width = 640; |
| 158 capture_format.height = 480; |
| 159 capture_format.frame_rate = GetFrameRate(); |
| 160 capture_formats->insert(capture_formats->end(), capture_format); |
| 161 } |
| 162 |
| 163 int FakeVideoCaptureDevice::GetFrameRate() const { |
| 164 return (1000 / kFakeCaptureTimeoutMs); |
| 165 } |
| 166 |
| 152 void FakeVideoCaptureDevice::OnCaptureTask() { | 167 void FakeVideoCaptureDevice::OnCaptureTask() { |
| 153 if (state_ != kCapturing) { | 168 if (state_ != kCapturing) { |
| 154 return; | 169 return; |
| 155 } | 170 } |
| 156 | 171 |
| 157 const size_t frame_size = VideoFrame::AllocationSize( | 172 const size_t frame_size = VideoFrame::AllocationSize( |
| 158 VideoFrame::I420, | 173 VideoFrame::I420, |
| 159 gfx::Size(capture_format_.width, capture_format_.height)); | 174 gfx::Size(capture_format_.width, capture_format_.height)); |
| 160 memset(fake_frame_.get(), 0, frame_size); | 175 memset(fake_frame_.get(), 0, frame_size); |
| 161 | 176 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 media::VideoCaptureCapability(800, | 261 media::VideoCaptureCapability(800, |
| 247 600, | 262 600, |
| 248 30, | 263 30, |
| 249 PIXEL_FORMAT_I420, | 264 PIXEL_FORMAT_I420, |
| 250 0, | 265 0, |
| 251 false, | 266 false, |
| 252 VariableResolutionVideoCaptureDevice)); | 267 VariableResolutionVideoCaptureDevice)); |
| 253 | 268 |
| 254 capabilities_roster_index_ = 0; | 269 capabilities_roster_index_ = 0; |
| 255 } | 270 } |
| 256 | |
| 257 } // namespace media | 271 } // namespace media |
| OLD | NEW |