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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "content/browser/renderer_host/media/media_stream_manager.h" | 12 #include "content/browser/renderer_host/media/media_stream_manager.h" |
13 #include "content/browser/renderer_host/media/video_capture_manager.h" | 13 #include "content/browser/renderer_host/media/video_capture_manager.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "media/base/yuv_convert.h" | 15 #include "media/base/yuv_convert.h" |
| 16 |
| 17 #if !defined(OS_IOS) && !defined(OS_ANDROID) |
16 #include "third_party/libyuv/include/libyuv.h" | 18 #include "third_party/libyuv/include/libyuv.h" |
| 19 #endif |
17 | 20 |
18 namespace content { | 21 namespace content { |
19 | 22 |
20 // The number of DIBs VideoCaptureController allocate. | 23 // The number of DIBs VideoCaptureController allocate. |
21 static const size_t kNoOfDIBS = 3; | 24 static const size_t kNoOfDIBS = 3; |
22 | 25 |
23 struct VideoCaptureController::ControllerClient { | 26 struct VideoCaptureController::ControllerClient { |
24 ControllerClient( | 27 ControllerClient( |
25 const VideoCaptureControllerID& id, | 28 const VideoCaptureControllerID& id, |
26 VideoCaptureControllerEventHandler* handler, | 29 VideoCaptureControllerEventHandler* handler, |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 rgb_stride, ystride, uvstride); | 328 rgb_stride, ystride, uvstride); |
326 break; | 329 break; |
327 } | 330 } |
328 case media::VideoCaptureCapability::kARGB: { | 331 case media::VideoCaptureCapability::kARGB: { |
329 media::ConvertRGB32ToYUV(data, yplane, uplane, vplane, frame_info_.width, | 332 media::ConvertRGB32ToYUV(data, yplane, uplane, vplane, frame_info_.width, |
330 frame_info_.height, | 333 frame_info_.height, |
331 (frame_info_.width + chopped_width_) * 4, | 334 (frame_info_.width + chopped_width_) * 4, |
332 frame_info_.width, frame_info_.width / 2); | 335 frame_info_.width, frame_info_.width / 2); |
333 break; | 336 break; |
334 } | 337 } |
335 #if !defined(OS_IOS) | 338 #if !defined(OS_IOS) && !defined(OS_ANDROID) |
336 case media::VideoCaptureCapability::kMJPEG: { | 339 case media::VideoCaptureCapability::kMJPEG: { |
337 int yplane_stride = frame_info_.width; | 340 int yplane_stride = frame_info_.width; |
338 int uv_plane_stride = (frame_info_.width + 1) / 2; | 341 int uv_plane_stride = (frame_info_.width + 1) / 2; |
339 int crop_x = 0; | 342 int crop_x = 0; |
340 int crop_y = 0; | 343 int crop_y = 0; |
341 libyuv::ConvertToI420(data, length, yplane, yplane_stride, uplane, | 344 libyuv::ConvertToI420(data, length, yplane, yplane_stride, uplane, |
342 uv_plane_stride, vplane, uv_plane_stride, crop_x, | 345 uv_plane_stride, vplane, uv_plane_stride, crop_x, |
343 crop_y, frame_info_.width, frame_info_.height, | 346 crop_y, frame_info_.width, frame_info_.height, |
344 frame_info_.width, frame_info_.height, | 347 frame_info_.width, frame_info_.height, |
345 libyuv::kRotate0, libyuv::FOURCC_MJPG); | 348 libyuv::kRotate0, libyuv::FOURCC_MJPG); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 base::AutoLock lock(lock_); | 593 base::AutoLock lock(lock_); |
591 for (DIBMap::iterator dib_it = owned_dibs_.begin(); | 594 for (DIBMap::iterator dib_it = owned_dibs_.begin(); |
592 dib_it != owned_dibs_.end(); dib_it++) { | 595 dib_it != owned_dibs_.end(); dib_it++) { |
593 if (dib_it->second->references > 0) | 596 if (dib_it->second->references > 0) |
594 return true; | 597 return true; |
595 } | 598 } |
596 return false; | 599 return false; |
597 } | 600 } |
598 | 601 |
599 } // namespace content | 602 } // namespace content |
OLD | NEW |