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

Side by Side Diff: media/video/capture/mac/video_capture_device_mac.mm

Issue 308813002: Mac Video Capture: Connect error logging to WebRTC Log (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 "media/video/capture/mac/video_capture_device_mac.h" 5 #include "media/video/capture/mac/video_capture_device_mac.h"
6 6
7 #include <IOKit/IOCFPlugIn.h> 7 #include <IOKit/IOCFPlugIn.h>
8 #include <IOKit/usb/IOUSBLib.h> 8 #include <IOKit/usb/IOUSBLib.h>
9 #include <IOKit/usb/USBSpec.h> 9 #include <IOKit/usb/USBSpec.h>
10 10
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 int height = params.requested_format.frame_size.height(); 371 int height = params.requested_format.frame_size.height();
372 int frame_rate = params.requested_format.frame_rate; 372 int frame_rate = params.requested_format.frame_rate;
373 373
374 // QTKit API can scale captured frame to any size requested, which would lead 374 // QTKit API can scale captured frame to any size requested, which would lead
375 // to undesired aspect ratio changes. Try to open the camera with a known 375 // to undesired aspect ratio changes. Try to open the camera with a known
376 // supported format and let the client crop/pad the captured frames. 376 // supported format and let the client crop/pad the captured frames.
377 if (!AVFoundationGlue::IsAVFoundationSupported()) 377 if (!AVFoundationGlue::IsAVFoundationSupported())
378 GetBestMatchSupportedResolution(&width, &height); 378 GetBestMatchSupportedResolution(&width, &height);
379 379
380 client_ = client.Pass(); 380 client_ = client.Pass();
381 if (device_name_.capture_api_type() == Name::AVFOUNDATION)
382 SendSystemLog("Using AVFoundation for device: " + device_name_.name());
Henrik Grunell 2014/05/30 11:48:32 Just to confirm: device_name_.name() is a user fri
mcasas 2014/05/30 12:15:27 Yes, is the camera user friendly name, with the ve
383 else
384 SendSystemLog("Using QTKit for device: " + device_name_.name());
381 NSString* deviceId = 385 NSString* deviceId =
382 [NSString stringWithUTF8String:device_name_.id().c_str()]; 386 [NSString stringWithUTF8String:device_name_.id().c_str()];
383 387
384 [capture_device_ setFrameReceiver:this]; 388 [capture_device_ setFrameReceiver:this];
385 389
386 if (![capture_device_ setCaptureDevice:deviceId]) { 390 if (![capture_device_ setCaptureDevice:deviceId]) {
387 SetErrorState("Could not open capture device."); 391 SetErrorState("Could not open capture device.");
388 return; 392 return;
389 } 393 }
390 if (frame_rate < kMinFrameRate) 394 if (frame_rate < kMinFrameRate)
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 reason)); 557 reason));
554 } 558 }
555 559
556 void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) { 560 void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) {
557 DCHECK(task_runner_->BelongsToCurrentThread()); 561 DCHECK(task_runner_->BelongsToCurrentThread());
558 DLOG(ERROR) << reason; 562 DLOG(ERROR) << reason;
559 state_ = kError; 563 state_ = kError;
560 client_->OnError(reason); 564 client_->OnError(reason);
561 } 565 }
562 566
567 void VideoCaptureDeviceMac::SendSystemLog(const std::string& message) {
Henrik Grunell 2014/05/30 11:48:32 Unclear to me why it's called SendSystemLog. Can y
mcasas 2014/05/30 12:15:27 Renamed to a more simpler name.
568 DCHECK(task_runner_->BelongsToCurrentThread());
569 if (client_)
570 client_->OnLog(message);
571 }
572
563 bool VideoCaptureDeviceMac::UpdateCaptureResolution() { 573 bool VideoCaptureDeviceMac::UpdateCaptureResolution() {
564 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() 574 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height()
565 width:capture_format_.frame_size.width() 575 width:capture_format_.frame_size.width()
566 frameRate:capture_format_.frame_rate]) { 576 frameRate:capture_format_.frame_rate]) {
567 ReceiveError("Could not configure capture device."); 577 ReceiveError("Could not configure capture device.");
568 return false; 578 return false;
569 } 579 }
570 return true; 580 return true;
571 } 581 }
572 582
573 } // namespace media 583 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698