Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(989)

Side by Side Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 897483002: Refactored pixel format resize operations in media/video/capture into a function called VideoCaptu… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added checks for unsupported pixel formats. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/video/capture/file_video_capture_device.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
474 DCHECK_GE(static_cast<size_t>(length), frame_format.ImageAllocationSize());
475
472 if (libyuv::ConvertToI420(data, 476 if (libyuv::ConvertToI420(data,
473 length, 477 length,
474 yplane, 478 yplane,
475 yplane_stride, 479 yplane_stride,
476 uplane, 480 uplane,
477 uv_plane_stride, 481 uv_plane_stride,
478 vplane, 482 vplane,
479 uv_plane_stride, 483 uv_plane_stride,
480 crop_x, 484 crop_x,
481 crop_y, 485 crop_y,
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 DCHECK_CURRENTLY_ON(BrowserThread::IO); 733 DCHECK_CURRENTLY_ON(BrowserThread::IO);
730 int active_client_count = 0; 734 int active_client_count = 0;
731 for (ControllerClient* client : controller_clients_) { 735 for (ControllerClient* client : controller_clients_) {
732 if (!client->paused) 736 if (!client->paused)
733 ++active_client_count; 737 ++active_client_count;
734 } 738 }
735 return active_client_count; 739 return active_client_count;
736 } 740 }
737 741
738 } // namespace content 742 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/video/capture/file_video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698