Chromium Code Reviews| 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..7cbc75c4511f51a1b7da2d690cd53728767dacd1 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,16 @@ |
| - (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], |
|
Henrik Grunell
2014/05/30 11:48:32
Fix indentation.
mcasas
2014/05/30 12:15:27
Done.
Henrik Grunell
2014/05/30 12:30:48
Nit: I don't know how objective-c is usually inden
|
| + [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 |