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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 case media::PIXEL_FORMAT_ARGB: | 462 case media::PIXEL_FORMAT_ARGB: |
463 origin_colorspace = libyuv::FOURCC_ARGB; | 463 origin_colorspace = libyuv::FOURCC_ARGB; |
464 break; | 464 break; |
465 case media::PIXEL_FORMAT_MJPEG: | 465 case media::PIXEL_FORMAT_MJPEG: |
466 origin_colorspace = libyuv::FOURCC_MJPG; | 466 origin_colorspace = libyuv::FOURCC_MJPG; |
467 break; | 467 break; |
468 default: | 468 default: |
469 NOTREACHED(); | 469 NOTREACHED(); |
470 } | 470 } |
471 | 471 |
472 // The input |length| can be greater than the required buffer size because of | |
473 // paddings and/or alignments, but it cannot be less. However, on some | |
474 // platforms, such as Win with C920 webcams, |length| is set as 0, and we need | |
475 // to take that into account. | |
476 #if defined(OS_WIN) | |
477 DCHECK(length == 0 || | |
478 static_cast<size_t>(length) >= frame_format.ImageAllocationSize()); | |
perkj_chrome
2015/02/10 08:01:00
please fix the problem at its source instead. ie,
| |
479 #else | |
480 DCHECK_GE(static_cast<size_t>(length), frame_format.ImageAllocationSize()); | |
481 #endif | |
482 | |
472 if (libyuv::ConvertToI420(data, | 483 if (libyuv::ConvertToI420(data, |
473 length, | 484 length, |
474 yplane, | 485 yplane, |
475 yplane_stride, | 486 yplane_stride, |
476 uplane, | 487 uplane, |
477 uv_plane_stride, | 488 uv_plane_stride, |
478 vplane, | 489 vplane, |
479 uv_plane_stride, | 490 uv_plane_stride, |
480 crop_x, | 491 crop_x, |
481 crop_y, | 492 crop_y, |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
729 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 740 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
730 int active_client_count = 0; | 741 int active_client_count = 0; |
731 for (ControllerClient* client : controller_clients_) { | 742 for (ControllerClient* client : controller_clients_) { |
732 if (!client->paused) | 743 if (!client->paused) |
733 ++active_client_count; | 744 ++active_client_count; |
734 } | 745 } |
735 return active_client_count; | 746 return active_client_count; |
736 } | 747 } |
737 | 748 |
738 } // namespace content | 749 } // namespace content |
OLD | NEW |