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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 case media::PIXEL_FORMAT_ARGB: | 488 case media::PIXEL_FORMAT_ARGB: |
489 origin_colorspace = libyuv::FOURCC_ARGB; | 489 origin_colorspace = libyuv::FOURCC_ARGB; |
490 break; | 490 break; |
491 case media::PIXEL_FORMAT_MJPEG: | 491 case media::PIXEL_FORMAT_MJPEG: |
492 origin_colorspace = libyuv::FOURCC_MJPG; | 492 origin_colorspace = libyuv::FOURCC_MJPG; |
493 break; | 493 break; |
494 default: | 494 default: |
495 NOTREACHED(); | 495 NOTREACHED(); |
496 } | 496 } |
497 | 497 |
| 498 // The input |length| can be greater than the required buffer size because of |
| 499 // paddings and/or alignments, but it cannot be less. |
| 500 DCHECK_GE(static_cast<size_t>(length), frame_format.ImageAllocationSize()); |
| 501 |
498 if (libyuv::ConvertToI420(data, | 502 if (libyuv::ConvertToI420(data, |
499 length, | 503 length, |
500 yplane, | 504 yplane, |
501 yplane_stride, | 505 yplane_stride, |
502 uplane, | 506 uplane, |
503 uv_plane_stride, | 507 uv_plane_stride, |
504 vplane, | 508 vplane, |
505 uv_plane_stride, | 509 uv_plane_stride, |
506 crop_x, | 510 crop_x, |
507 crop_y, | 511 crop_y, |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 721 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
718 int active_client_count = 0; | 722 int active_client_count = 0; |
719 for (ControllerClient* client : controller_clients_) { | 723 for (ControllerClient* client : controller_clients_) { |
720 if (!client->paused) | 724 if (!client->paused) |
721 ++active_client_count; | 725 ++active_client_count; |
722 } | 726 } |
723 return active_client_count; | 727 return active_client_count; |
724 } | 728 } |
725 | 729 |
726 } // namespace content | 730 } // namespace content |
OLD | NEW |