diff options
author | mcasas@chromium.org <mcasas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-12 17:07:59 +0000 |
---|---|---|
committer | mcasas@chromium.org <mcasas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-12 17:09:26 +0000 |
commit | 747d99d98c77bd3b97fe7c7fabe5b9db171aa7ab (patch) | |
tree | 3d80ae8120a066b0d8144ab0ebeab6bf8ba8b10c /media | |
parent | 22fe91d3732cc46b9782792384bced33ffeee480 (diff) | |
download | chromium_src-747d99d98c77bd3b97fe7c7fabe5b9db171aa7ab.zip chromium_src-747d99d98c77bd3b97fe7c7fabe5b9db171aa7ab.tar.gz chromium_src-747d99d98c77bd3b97fe7c7fabe5b9db171aa7ab.tar.bz2 |
Mac Video Capture: correct to float the erroneous handling of frame rate as int.
This is a fix for a latent bug.
Tentatively, this is also causing http://crbug.com/394315.
BUG=380463, 394315
Review URL: https://codereview.chromium.org/464853002
Cr-Commit-Position: refs/heads/master@{#289008}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289008 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
5 files changed, 21 insertions, 11 deletions
diff --git a/media/video/capture/mac/platform_video_capturing_mac.h b/media/video/capture/mac/platform_video_capturing_mac.h index 466ae1b..29bc497 100644 --- a/media/video/capture/mac/platform_video_capturing_mac.h +++ b/media/video/capture/mac/platform_video_capturing_mac.h @@ -36,7 +36,9 @@ class VideoCaptureDeviceMac; - (BOOL)setCaptureDevice:(NSString*)deviceId; // Configures the capture properties. -- (BOOL)setCaptureHeight:(int)height width:(int)width frameRate:(int)frameRate; +- (BOOL)setCaptureHeight:(int)height + width:(int)width + frameRate:(float)frameRate; // Start video capturing, register observers. Returns YES on sucess, NO // otherwise. diff --git a/media/video/capture/mac/video_capture_device_avfoundation_mac.h b/media/video/capture/mac/video_capture_device_avfoundation_mac.h index 1c607b1..d2262ae 100644 --- a/media/video/capture/mac/video_capture_device_avfoundation_mac.h +++ b/media/video/capture/mac/video_capture_device_avfoundation_mac.h @@ -62,7 +62,7 @@ class VideoCaptureDeviceMac; // The following attributes are set via -setCaptureHeight:width:frameRate:. int frameWidth_; int frameHeight_; - int frameRate_; + float frameRate_; base::Lock lock_; // Protects concurrent setting and using of frameReceiver_. media::VideoCaptureDeviceMac* frameReceiver_; // weak. @@ -105,7 +105,9 @@ class VideoCaptureDeviceMac; // Configures the capture properties for the capture session and the video data // output; this means it MUST be called after setCaptureDevice:. Return YES on // success, else NO. -- (BOOL)setCaptureHeight:(int)height width:(int)width frameRate:(int)frameRate; +- (BOOL)setCaptureHeight:(int)height + width:(int)width + frameRate:(float)frameRate; // Starts video capturing and register the notification listeners. Must be // called after setCaptureDevice:, and, eventually, also after 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 399ad7d..c700ca2 100644 --- a/media/video/capture/mac/video_capture_device_avfoundation_mac.mm +++ b/media/video/capture/mac/video_capture_device_avfoundation_mac.mm @@ -171,7 +171,9 @@ return YES; } -- (BOOL)setCaptureHeight:(int)height width:(int)width frameRate:(int)frameRate { +- (BOOL)setCaptureHeight:(int)height + width:(int)width + frameRate:(float)frameRate { // Check if either of VideoCaptureDeviceMac::AllocateAndStart() or // VideoCaptureDeviceMac::ReceiveFrame() is calling here, depending on the // running state. VCDM::ReceiveFrame() calls here to change aspect ratio. @@ -208,14 +210,14 @@ [captureConnection isVideoMinFrameDurationSupported]) { [captureConnection setVideoMinFrameDuration: CoreMediaGlue::CMTimeMake(media::kFrameRatePrecision, - frameRate * media::kFrameRatePrecision)]; + (int)(frameRate * media::kFrameRatePrecision))]; } if ([captureConnection respondsToSelector:@selector(isVideoMaxFrameDurationSupported)] && [captureConnection isVideoMaxFrameDurationSupported]) { [captureConnection setVideoMaxFrameDuration: CoreMediaGlue::CMTimeMake(media::kFrameRatePrecision, - frameRate * media::kFrameRatePrecision)]; + (int)(frameRate * media::kFrameRatePrecision))]; } return YES; } diff --git a/media/video/capture/mac/video_capture_device_qtkit_mac.h b/media/video/capture/mac/video_capture_device_qtkit_mac.h index 1ed511b..c1af697 100644 --- a/media/video/capture/mac/video_capture_device_qtkit_mac.h +++ b/media/video/capture/mac/video_capture_device_qtkit_mac.h @@ -24,7 +24,7 @@ class VideoCaptureDeviceMac; @interface VideoCaptureDeviceQTKit : NSObject<PlatformVideoCapturingMac> { @private // Settings. - int frameRate_; + float frameRate_; NSLock *lock_; media::VideoCaptureDeviceMac *frameReceiver_; @@ -58,7 +58,9 @@ class VideoCaptureDeviceMac; - (BOOL)setCaptureDevice:(NSString*)deviceId; // Configures the capture properties. -- (BOOL)setCaptureHeight:(int)height width:(int)width frameRate:(int)frameRate; +- (BOOL)setCaptureHeight:(int)height + width:(int)width + frameRate:(float)frameRate; // Start video capturing. Returns YES on sucess, NO otherwise. - (BOOL)startCapture; diff --git a/media/video/capture/mac/video_capture_device_qtkit_mac.mm b/media/video/capture/mac/video_capture_device_qtkit_mac.mm index 599cfac..7f4a853 100644 --- a/media/video/capture/mac/video_capture_device_qtkit_mac.mm +++ b/media/video/capture/mac/video_capture_device_qtkit_mac.mm @@ -174,7 +174,9 @@ } } -- (BOOL)setCaptureHeight:(int)height width:(int)width frameRate:(int)frameRate { +- (BOOL)setCaptureHeight:(int)height + width:(int)width + frameRate:(float)frameRate { if (!captureDeviceInput_) { [self sendErrorString:[NSString stringWithUTF8String:"No video capture device set."]]; @@ -185,7 +187,7 @@ stringWithUTF8String:"Video capture capabilities already set."]]; return NO; } - if (frameRate <= 0) { + if (frameRate <= 0.0f) { [self sendErrorString:[NSString stringWithUTF8String: "Wrong frame rate."]]; return NO; } @@ -205,7 +207,7 @@ }; [output setPixelBufferAttributes:videoSettingsDictionary]; - [output setMinimumVideoFrameInterval:(NSTimeInterval)1/(float)frameRate]; + [output setMinimumVideoFrameInterval:(NSTimeInterval)1/frameRate]; return YES; } |