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

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

Issue 99353005: AVFoundation: Check selector when testing if max frame rate setting is supported. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « 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 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"
11 #include "base/mac/scoped_nsexception_enabler.h"
11 #include "media/video/capture/mac/video_capture_device_mac.h" 12 #include "media/video/capture/mac/video_capture_device_mac.h"
12 #include "ui/gfx/size.h" 13 #include "ui/gfx/size.h"
13 14
14 @implementation VideoCaptureDeviceAVFoundation 15 @implementation VideoCaptureDeviceAVFoundation
15 16
16 #pragma mark Class methods 17 #pragma mark Class methods
17 18
18 + (void)getDeviceNames:(NSMutableDictionary*)deviceNames { 19 + (void)getDeviceNames:(NSMutableDictionary*)deviceNames {
19 // At this stage we already know that AVFoundation is supported and the whole 20 // At this stage we already know that AVFoundation is supported and the whole
20 // library is loaded and initialised, by the device monitoring. 21 // library is loaded and initialised, by the device monitoring.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 AVFoundationGlue::AVVideoScalingModeResizeAspect() 162 AVFoundationGlue::AVVideoScalingModeResizeAspect()
162 }; 163 };
163 [captureVideoDataOutput_ setVideoSettings:videoSettingsDictionary]; 164 [captureVideoDataOutput_ setVideoSettings:videoSettingsDictionary];
164 165
165 CrAVCaptureConnection* captureConnection = [captureVideoDataOutput_ 166 CrAVCaptureConnection* captureConnection = [captureVideoDataOutput_
166 connectionWithMediaType:AVFoundationGlue::AVMediaTypeVideo()]; 167 connectionWithMediaType:AVFoundationGlue::AVMediaTypeVideo()];
167 if ([captureConnection isVideoMinFrameDurationSupported]) { 168 if ([captureConnection isVideoMinFrameDurationSupported]) {
168 [captureConnection setVideoMinFrameDuration: 169 [captureConnection setVideoMinFrameDuration:
169 CoreMediaGlue::CMTimeMake(1, frameRate)]; 170 CoreMediaGlue::CMTimeMake(1, frameRate)];
170 } 171 }
172 // TODO(mcasas): Allow exceptions in the following call, related to bugs
173 // http://crbug.com/327532 and http://crbug.com/328096.
174 base::mac::ScopedNSExceptionEnabler enabler;
171 if ([captureConnection isVideoMaxFrameDurationSupported]) { 175 if ([captureConnection isVideoMaxFrameDurationSupported]) {
Robert Sesek 2013/12/16 15:41:35 Instead, if ([captureConnection respondsToSelector
172 [captureConnection setVideoMaxFrameDuration: 176 [captureConnection setVideoMaxFrameDuration:
173 CoreMediaGlue::CMTimeMake(1, frameRate)]; 177 CoreMediaGlue::CMTimeMake(1, frameRate)];
174 } 178 }
175 return YES; 179 return YES;
176 } 180 }
177 181
178 - (BOOL)startCapture { 182 - (BOOL)startCapture {
179 DCHECK(thread_checker_.CalledOnValidThread()); 183 DCHECK(thread_checker_.CalledOnValidThread());
180 if (!captureSession_) { 184 if (!captureSession_) {
181 DLOG(ERROR) << "Video capture session not initialized."; 185 DLOG(ERROR) << "Video capture session not initialized.";
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 235
232 - (void)onVideoError:(NSNotification*)errorNotification { 236 - (void)onVideoError:(NSNotification*)errorNotification {
233 NSError* error = base::mac::ObjCCast<NSError>([[errorNotification userInfo] 237 NSError* error = base::mac::ObjCCast<NSError>([[errorNotification userInfo]
234 objectForKey:AVFoundationGlue::AVCaptureSessionErrorKey()]); 238 objectForKey:AVFoundationGlue::AVCaptureSessionErrorKey()]);
235 base::AutoLock lock(lock_); 239 base::AutoLock lock(lock_);
236 if (frameReceiver_) 240 if (frameReceiver_)
237 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]); 241 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]);
238 } 242 }
239 243
240 @end 244 @end
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