diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-12-15 15:02:59 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-12-15 15:02:59 -0500 |
commit | e6717aa5a27b81ff1aeb07736ff25d90693cc23c (patch) | |
tree | 00b4b47fc48ff1b8c8a40c1b79b779eb53039333 | |
parent | 7a82d7dbb1b47af8870cec5ab2bc2cfa8a6f7a96 (diff) | |
download | sdl_ios-e6717aa5a27b81ff1aeb07736ff25d90693cc23c.tar.gz |
Reduce the default frame rate and set a hard data limit
-rw-r--r-- | SmartDeviceLink/SDLH264VideoEncoder.m | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/SmartDeviceLink/SDLH264VideoEncoder.m b/SmartDeviceLink/SDLH264VideoEncoder.m index 0feab023e..c9c7f3c40 100644 --- a/SmartDeviceLink/SDLH264VideoEncoder.m +++ b/SmartDeviceLink/SDLH264VideoEncoder.m @@ -35,13 +35,14 @@ static NSDictionary<NSString *, id>* _defaultVideoEncoderSettings; if (self != [SDLH264VideoEncoder class]) { return; } - + + // https://support.google.com/youtube/answer/1722171?hl=en _defaultVideoEncoderSettings = @{ (__bridge NSString *)kVTCompressionPropertyKey_ProfileLevel: (__bridge NSString *)kVTProfileLevel_H264_Baseline_AutoLevel, (__bridge NSString *)kVTCompressionPropertyKey_RealTime: @YES, - (__bridge NSString *)kVTCompressionPropertyKey_ExpectedFrameRate: @30, + (__bridge NSString *)kVTCompressionPropertyKey_ExpectedFrameRate: @20, (__bridge NSString *)kVTCompressionPropertyKey_AverageBitRate: @1000000, - (__bridge NSString *)kVTCompressionPropertyKey_DataRateLimits: @[@150000, @1, @130000, @5], + (__bridge NSString *)kVTCompressionPropertyKey_DataRateLimits: @[@700000, @5] }; } @@ -105,7 +106,8 @@ static NSDictionary<NSString *, id>* _defaultVideoEncoderSettings; status = VTSessionSetProperty(self.compressionSession, (__bridge CFStringRef)key, (__bridge CFTypeRef)value); if (status != noErr) { if (!*error) { - *error = [NSError errorWithDomain:SDLErrorDomainVideoEncoder code:SDLVideoEncoderErrorConfigurationCompressionSessionSetPropertyFailure userInfo:@{ @"OSStatus": @(status) }]; + NSString *description = [NSString stringWithFormat:@"Setting key failed \"%@\"", key]; + *error = [NSError errorWithDomain:SDLErrorDomainVideoEncoder code:SDLVideoEncoderErrorConfigurationCompressionSessionSetPropertyFailure userInfo:@{NSLocalizedDescriptionKey: description, @"OSStatus": @(status)}]; } return nil; } |