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

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

Issue 846393002: Add camera color format to webrtc logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | no next file » | 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 private: 173 private:
174 scoped_refptr<Buffer> DoReserveOutputBuffer(media::VideoFrame::Format format, 174 scoped_refptr<Buffer> DoReserveOutputBuffer(media::VideoFrame::Format format,
175 const gfx::Size& dimensions); 175 const gfx::Size& dimensions);
176 176
177 // The controller to which we post events. 177 // The controller to which we post events.
178 const base::WeakPtr<VideoCaptureController> controller_; 178 const base::WeakPtr<VideoCaptureController> controller_;
179 179
180 // The pool of shared-memory buffers used for capturing. 180 // The pool of shared-memory buffers used for capturing.
181 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; 181 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_;
182
183 media::VideoPixelFormat last_captured_pixel_format_;
182 }; 184 };
183 185
184 VideoCaptureController::VideoCaptureController(int max_buffers) 186 VideoCaptureController::VideoCaptureController(int max_buffers)
185 : buffer_pool_(new VideoCaptureBufferPool(max_buffers)), 187 : buffer_pool_(new VideoCaptureBufferPool(max_buffers)),
186 state_(VIDEO_CAPTURE_STATE_STARTED), 188 state_(VIDEO_CAPTURE_STATE_STARTED),
187 has_received_frames_(false), 189 has_received_frames_(false),
188 weak_ptr_factory_(this) { 190 weak_ptr_factory_(this) {
189 } 191 }
190 192
191 VideoCaptureController::VideoCaptureDeviceClient::VideoCaptureDeviceClient( 193 VideoCaptureController::VideoCaptureDeviceClient::VideoCaptureDeviceClient(
192 const base::WeakPtr<VideoCaptureController>& controller, 194 const base::WeakPtr<VideoCaptureController>& controller,
193 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool) 195 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool)
194 : controller_(controller), buffer_pool_(buffer_pool) {} 196 : controller_(controller),
197 buffer_pool_(buffer_pool),
198 last_captured_pixel_format_(media::PIXEL_FORMAT_UNKNOWN) {
199 }
195 200
196 VideoCaptureController::VideoCaptureDeviceClient::~VideoCaptureDeviceClient() {} 201 VideoCaptureController::VideoCaptureDeviceClient::~VideoCaptureDeviceClient() {}
197 202
198 base::WeakPtr<VideoCaptureController> VideoCaptureController::GetWeakPtr() { 203 base::WeakPtr<VideoCaptureController> VideoCaptureController::GetWeakPtr() {
199 return weak_ptr_factory_.GetWeakPtr(); 204 return weak_ptr_factory_.GetWeakPtr();
200 } 205 }
201 206
202 scoped_ptr<media::VideoCaptureDevice::Client> 207 scoped_ptr<media::VideoCaptureDevice::Client>
203 VideoCaptureController::NewDeviceClient() { 208 VideoCaptureController::NewDeviceClient() {
204 scoped_ptr<media::VideoCaptureDevice::Client> result( 209 scoped_ptr<media::VideoCaptureDevice::Client> result(
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 346 }
342 347
343 void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedData( 348 void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedData(
344 const uint8* data, 349 const uint8* data,
345 int length, 350 int length,
346 const VideoCaptureFormat& frame_format, 351 const VideoCaptureFormat& frame_format,
347 int rotation, 352 int rotation,
348 base::TimeTicks timestamp) { 353 base::TimeTicks timestamp) {
349 TRACE_EVENT0("video", "VideoCaptureController::OnIncomingCapturedData"); 354 TRACE_EVENT0("video", "VideoCaptureController::OnIncomingCapturedData");
350 355
356 if (last_captured_pixel_format_ != frame_format.pixel_format) {
357 OnLog("Pixel format: " + media::VideoCaptureFormat::PixelFormatToString(
358 frame_format.pixel_format));
359 last_captured_pixel_format_ = frame_format.pixel_format;
360 }
361
351 if (!frame_format.IsValid()) 362 if (!frame_format.IsValid())
352 return; 363 return;
353 364
354 // Chopped pixels in width/height in case video capture device has odd 365 // Chopped pixels in width/height in case video capture device has odd
355 // numbers for width/height. 366 // numbers for width/height.
356 int chopped_width = 0; 367 int chopped_width = 0;
357 int chopped_height = 0; 368 int chopped_height = 0;
358 int new_unrotated_width = frame_format.frame_size.width(); 369 int new_unrotated_width = frame_format.frame_size.width();
359 int new_unrotated_height = frame_format.frame_size.height(); 370 int new_unrotated_height = frame_format.frame_size.height();
360 371
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 DCHECK_CURRENTLY_ON(BrowserThread::IO); 723 DCHECK_CURRENTLY_ON(BrowserThread::IO);
713 int active_client_count = 0; 724 int active_client_count = 0;
714 for (ControllerClient* client : controller_clients_) { 725 for (ControllerClient* client : controller_clients_) {
715 if (!client->paused) 726 if (!client->paused)
716 ++active_client_count; 727 ++active_client_count;
717 } 728 }
718 return active_client_count; 729 return active_client_count;
719 } 730 }
720 731
721 } // namespace content 732 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698