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

Unified Diff: media/video/capture/mac/video_capture_device_avfoundation_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: grunell@ second round of comments. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: media/video/capture/mac/video_capture_device_avfoundation_mac.mm
diff --git a/media/video/capture/mac/video_capture_device_avfoundation_mac.mm b/media/video/capture/mac/video_capture_device_avfoundation_mac.mm
index e4f4431ec96291a24a3f2d2bc7cda4d845d34ef7..b80b0fbbe1e7ec77a6095586e9ce03878c6d6fc5 100644
--- a/media/video/capture/mac/video_capture_device_avfoundation_mac.mm
+++ b/media/video/capture/mac/video_capture_device_avfoundation_mac.mm
@@ -49,8 +49,8 @@
if (device == nil)
return;
for (CrAVCaptureDeviceFormat* format in device.formats) {
- // MediaSubType comes is a CMPixelFormatType but can be used as
- // CVPixelFormatType as well according to CMFormatDescription.h
+ // MediaSubType is a CMPixelFormatType but can be used as CVPixelFormatType
+ // as well according to CMFormatDescription.h
media::VideoPixelFormat pixelFormat = media::PIXEL_FORMAT_UNKNOWN;
switch (CoreMediaGlue::CMFormatDescriptionGetMediaSubType(
[format formatDescription])) {
@@ -129,7 +129,8 @@
// Look for input device with requested name.
captureDevice_ = [AVCaptureDeviceGlue deviceWithUniqueID:deviceId];
if (!captureDevice_) {
- DLOG(ERROR) << "Could not open video capture device.";
+ [self sendErrorString:[NSString
+ stringWithUTF8String:"Could not open video capture device."]];
return NO;
}
@@ -140,8 +141,10 @@
error:&error];
if (!captureDeviceInput_) {
captureDevice_ = nil;
- DLOG(ERROR) << "Could not create video capture input: "
- << [[error localizedDescription] UTF8String];
+ [self sendErrorString:[NSString
+ stringWithFormat:@"Could not create video capture input (%@): %@",
+ [error localizedDescription],
+ [error localizedFailureReason]]];
return NO;
}
[captureSession_ addInput:captureDeviceInput_];
@@ -152,7 +155,8 @@
[[AVFoundationGlue::AVCaptureVideoDataOutputClass() alloc] init]);
if (!captureVideoDataOutput_) {
[captureSession_ removeInput:captureDeviceInput_];
- DLOG(ERROR) << "Could not create video data output.";
+ [self sendErrorString:[NSString
+ stringWithUTF8String:"Could not create video data output."]];
return NO;
}
[captureVideoDataOutput_
@@ -270,14 +274,17 @@
- (void)onVideoError:(NSNotification*)errorNotification {
NSError* error = base::mac::ObjCCast<NSError>([[errorNotification userInfo]
objectForKey:AVFoundationGlue::AVCaptureSessionErrorKey()]);
- NSString* str_error =
- [NSString stringWithFormat:@"%@: %@",
- [error localizedDescription],
- [error localizedFailureReason]];
+ [self sendErrorString:[NSString
+ stringWithFormat:@"%@: %@",
+ [error localizedDescription],
+ [error localizedFailureReason]]];
+}
+- (void)sendErrorString:(NSString*)error {
+ DLOG(ERROR) << [error UTF8String];
base::AutoLock lock(lock_);
if (frameReceiver_)
- frameReceiver_->ReceiveError([str_error UTF8String]);
+ frameReceiver_->ReceiveError([error UTF8String]);
}
@end
« no previous file with comments | « content/browser/renderer_host/media/video_capture_controller.cc ('k') | media/video/capture/mac/video_capture_device_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698