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

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

Issue 223513002: Mac AVfoundation: Change AVVideoScalingModeResizeAspect -> AVVideoScalingModeResizeAspectFill (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « media/video/capture/mac/avfoundation_glue.mm ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #import "media/video/capture/mac/video_capture_device_avfoundation_mac.h" 5 #import "media/video/capture/mac/video_capture_device_avfoundation_mac.h"
6 6
7 #import <CoreVideo/CoreVideo.h> 7 #import <CoreVideo/CoreVideo.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 DLOG(ERROR) << "Video capture device does not support current preset"; 200 DLOG(ERROR) << "Video capture device does not support current preset";
201 return NO; 201 return NO;
202 } 202 }
203 203
204 // Despite all Mac documentation detailing that setting the sessionPreset is 204 // Despite all Mac documentation detailing that setting the sessionPreset is
205 // enough, that is not the case for, at least, the MacBook Air built-in 205 // enough, that is not the case for, at least, the MacBook Air built-in
206 // FaceTime HD Camera, and the capture output has to be configured as well. 206 // FaceTime HD Camera, and the capture output has to be configured as well.
207 // The reason for this mismatch is probably because most of the AVFoundation 207 // The reason for this mismatch is probably because most of the AVFoundation
208 // docs are written for iOS and not for MacOsX. 208 // docs are written for iOS and not for MacOsX.
209 // AVVideoScalingModeKey() refers to letterboxing yes/no and preserve aspect 209 // AVVideoScalingModeKey() refers to letterboxing yes/no and preserve aspect
210 // ratio yes/no when scaling. Currently we set letterbox and preservation. 210 // ratio yes/no when scaling. Currently we set cropping and preservation.
211 NSDictionary* videoSettingsDictionary = @{ 211 NSDictionary* videoSettingsDictionary = @{
212 (id)kCVPixelBufferWidthKey : @(width), 212 (id)kCVPixelBufferWidthKey : @(width),
213 (id)kCVPixelBufferHeightKey : @(height), 213 (id)kCVPixelBufferHeightKey : @(height),
214 (id)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_422YpCbCr8), 214 (id)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_422YpCbCr8),
215 AVFoundationGlue::AVVideoScalingModeKey() : 215 AVFoundationGlue::AVVideoScalingModeKey() :
216 AVFoundationGlue::AVVideoScalingModeResizeAspect() 216 AVFoundationGlue::AVVideoScalingModeResizeAspectFill()
217 }; 217 };
218 [captureVideoDataOutput_ setVideoSettings:videoSettingsDictionary]; 218 [captureVideoDataOutput_ setVideoSettings:videoSettingsDictionary];
219 219
220 CrAVCaptureConnection* captureConnection = [captureVideoDataOutput_ 220 CrAVCaptureConnection* captureConnection = [captureVideoDataOutput_
221 connectionWithMediaType:AVFoundationGlue::AVMediaTypeVideo()]; 221 connectionWithMediaType:AVFoundationGlue::AVMediaTypeVideo()];
222 // Check selector existence, related to bugs http://crbug.com/327532 and 222 // Check selector existence, related to bugs http://crbug.com/327532 and
223 // http://crbug.com/328096. 223 // http://crbug.com/328096.
224 if ([captureConnection 224 if ([captureConnection
225 respondsToSelector:@selector(isVideoMinFrameDurationSupported)] && 225 respondsToSelector:@selector(isVideoMinFrameDurationSupported)] &&
226 [captureConnection isVideoMinFrameDurationSupported]) { 226 [captureConnection isVideoMinFrameDurationSupported]) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 - (void)onVideoError:(NSNotification*)errorNotification { 297 - (void)onVideoError:(NSNotification*)errorNotification {
298 NSError* error = base::mac::ObjCCast<NSError>([[errorNotification userInfo] 298 NSError* error = base::mac::ObjCCast<NSError>([[errorNotification userInfo]
299 objectForKey:AVFoundationGlue::AVCaptureSessionErrorKey()]); 299 objectForKey:AVFoundationGlue::AVCaptureSessionErrorKey()]);
300 base::AutoLock lock(lock_); 300 base::AutoLock lock(lock_);
301 if (frameReceiver_) 301 if (frameReceiver_)
302 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]); 302 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]);
303 } 303 }
304 304
305 @end 305 @end
OLDNEW
« no previous file with comments | « media/video/capture/mac/avfoundation_glue.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698