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

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

Issue 660493002: VideoCapture: Sort VideoPixelFormat in order of preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use temp enum Created 6 years, 2 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/video_capture_types.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); 83 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
84 #endif 84 #endif
85 DCHECK(gl_helper); 85 DCHECK(gl_helper);
86 // UpdateReleaseSyncPoint() creates a new sync_point using |gl_helper|, so 86 // UpdateReleaseSyncPoint() creates a new sync_point using |gl_helper|, so
87 // wait the given |sync_point| using |gl_helper|. 87 // wait the given |sync_point| using |gl_helper|.
88 gl_helper->WaitSyncPoint(sync_point); 88 gl_helper->WaitSyncPoint(sync_point);
89 SyncPointClientImpl client(gl_helper); 89 SyncPointClientImpl client(gl_helper);
90 video_frame->UpdateReleaseSyncPoint(&client); 90 video_frame->UpdateReleaseSyncPoint(&client);
91 } 91 }
92 92
93 // Get the correct UMA int label for the pixel format.
94 static int GetUmaLabel(media::VideoPixelFormat format) {
mcasas 2014/10/19 13:13:14 const media::VideoPixelFormat format ?
magjed_chromium 2014/10/19 13:30:16 I haven't seen anyone else make a const non-ref, I
mcasas 2014/10/20 09:06:19 Ah, true, VPF is an enum. That's the evil with typ
95 // This enum must be in sync with CapturePixelFormat defined in
96 // histograms.xml.
97 enum UmaPixelFormat {
98 UNKNOWN,
99 I420,
100 YUY2,
101 UYVY,
102 RGB24,
103 ARGB,
104 MJPEG,
105 NV21,
106 YV12,
107 TEXTURE
108 };
109 switch (format) {
mcasas 2014/10/20 09:06:19 Paraphrasing tommi@, I'd like to see this data dri
110 case media::PIXEL_FORMAT_I420:
111 return I420;
112 case media::PIXEL_FORMAT_YV12:
113 return YV12;
114 case media::PIXEL_FORMAT_NV21:
115 return NV21;
116 case media::PIXEL_FORMAT_UYVY:
117 return UYVY;
118 case media::PIXEL_FORMAT_YUY2:
119 return YUY2;
120 case media::PIXEL_FORMAT_RGB24:
121 return RGB24;
122 case media::PIXEL_FORMAT_ARGB:
123 return ARGB;
124 case media::PIXEL_FORMAT_MJPEG:
125 return MJPEG;
126 case media::PIXEL_FORMAT_TEXTURE:
127 return TEXTURE;
128 case media::PIXEL_FORMAT_UNKNOWN:
129 return UNKNOWN;
130 default:
131 NOTIMPLEMENTED();
132 return 0;
133 };
134 }
135
93 } // anonymous namespace 136 } // anonymous namespace
94 137
95 struct VideoCaptureController::ControllerClient { 138 struct VideoCaptureController::ControllerClient {
96 ControllerClient(const VideoCaptureControllerID& id, 139 ControllerClient(const VideoCaptureControllerID& id,
97 VideoCaptureControllerEventHandler* handler, 140 VideoCaptureControllerEventHandler* handler,
98 base::ProcessHandle render_process, 141 base::ProcessHandle render_process,
99 media::VideoCaptureSessionId session_id, 142 media::VideoCaptureSessionId session_id,
100 const media::VideoCaptureParams& params) 143 const media::VideoCaptureParams& params)
101 : controller_id(id), 144 : controller_id(id),
102 event_handler(handler), 145 event_handler(handler),
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Width", 673 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Width",
631 buffer_format.frame_size.width()); 674 buffer_format.frame_size.width());
632 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Height", 675 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Height",
633 buffer_format.frame_size.height()); 676 buffer_format.frame_size.height());
634 UMA_HISTOGRAM_ASPECT_RATIO("Media.VideoCapture.AspectRatio", 677 UMA_HISTOGRAM_ASPECT_RATIO("Media.VideoCapture.AspectRatio",
635 buffer_format.frame_size.width(), 678 buffer_format.frame_size.width(),
636 buffer_format.frame_size.height()); 679 buffer_format.frame_size.height());
637 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.FrameRate", 680 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.FrameRate",
638 buffer_format.frame_rate); 681 buffer_format.frame_rate);
639 UMA_HISTOGRAM_ENUMERATION("Media.VideoCapture.PixelFormat", 682 UMA_HISTOGRAM_ENUMERATION("Media.VideoCapture.PixelFormat",
640 buffer_format.pixel_format, 683 GetUmaLabel(buffer_format.pixel_format),
641 media::PIXEL_FORMAT_MAX); 684 media::PIXEL_FORMAT_MAX);
642 has_received_frames_ = true; 685 has_received_frames_ = true;
643 } 686 }
644 687
645 buffer_pool_->HoldForConsumers(buffer->id(), count); 688 buffer_pool_->HoldForConsumers(buffer->id(), count);
646 } 689 }
647 690
648 void VideoCaptureController::DoErrorOnIOThread() { 691 void VideoCaptureController::DoErrorOnIOThread() {
649 DCHECK_CURRENTLY_ON(BrowserThread::IO); 692 DCHECK_CURRENTLY_ON(BrowserThread::IO);
650 state_ = VIDEO_CAPTURE_STATE_ERROR; 693 state_ = VIDEO_CAPTURE_STATE_ERROR;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 DCHECK_CURRENTLY_ON(BrowserThread::IO); 756 DCHECK_CURRENTLY_ON(BrowserThread::IO);
714 int active_client_count = 0; 757 int active_client_count = 0;
715 for (ControllerClient* client : controller_clients_) { 758 for (ControllerClient* client : controller_clients_) {
716 if (!client->paused) 759 if (!client->paused)
717 ++active_client_count; 760 ++active_client_count;
718 } 761 }
719 return active_client_count; 762 return active_client_count;
720 } 763 }
721 764
722 } // namespace content 765 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/video/capture/video_capture_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698