summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakamitsu Yoshii <tyoshii@xevo.com>2019-09-09 14:02:54 +0900
committerTakamitsu Yoshii <tyoshii@xevo.com>2019-09-09 14:15:26 +0900
commit8963eb5d6a989086bd00963cf5ae6b38aab440a3 (patch)
tree7506d587a9b9847dbb6991b1b8fa31db09a9260b
parent1ad0a60e8de5b373583b3dff1a243294a2036401 (diff)
downloadsdl_ios-8963eb5d6a989086bd00963cf5ae6b38aab440a3.tar.gz
fix-review: add `allowOverrideEncoderSettings` to SDLStreamingMediaConfiguration
-rw-r--r--SmartDeviceLink/SDLStreamingMediaConfiguration.h8
-rw-r--r--SmartDeviceLink/SDLStreamingMediaConfiguration.m1
-rw-r--r--SmartDeviceLink/SDLStreamingVideoLifecycleManager.h6
-rw-r--r--SmartDeviceLink/SDLStreamingVideoLifecycleManager.m3
4 files changed, 17 insertions, 1 deletions
diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.h b/SmartDeviceLink/SDLStreamingMediaConfiguration.h
index 3e4f91849..593a0ef3f 100644
--- a/SmartDeviceLink/SDLStreamingMediaConfiguration.h
+++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.h
@@ -45,10 +45,18 @@ typedef NS_ENUM(NSUInteger, SDLCarWindowRenderingType) {
* Properties to use for applications that utilize the video encoder for streaming. See VTCompressionProperties.h for more details. For example, you can set kVTCompressionPropertyKey_ExpectedFrameRate to set your framerate. Setting the framerate this way will also set the framerate if you use CarWindow automatic streaming.
*
* Other properties you may want to try adjusting include kVTCompressionPropertyKey_AverageBitRate and kVTCompressionPropertyKey_DataRateLimits.
+
+ @note Setting values can be override by StreamingMediaManager when `allowOverrideEncoderSettings` property is YES.
+
*/
@property (copy, nonatomic, nullable) NSDictionary<NSString *, id> *customVideoEncoderSettings;
/**
+ When YES, the StreamingMediaManager will override encoder settings by the capability values returned from HMI. If you wish not to allow overriding encoder settings, set it to NO. Defaults to YES.
+ */
+@property (assign, nonatomic) BOOL allowOverrideEncoderSettings;
+
+/**
Usable to change run time video stream setup behavior. Only use this and modify the results if you *really* know what you're doing. The head unit defaults are generally good.
*/
@property (weak, nonatomic, nullable) id<SDLStreamingMediaManagerDataSource> dataSource;
diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.m b/SmartDeviceLink/SDLStreamingMediaConfiguration.m
index 41c7df822..197fd3a9a 100644
--- a/SmartDeviceLink/SDLStreamingMediaConfiguration.m
+++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.m
@@ -37,6 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
_carWindowRenderingType = SDLCarWindowRenderingTypeLayer;
_enableForcedFramerateSync = YES;
_allowMultipleViewControllerOrientations = NO;
+ _allowOverrideEncoderSettings = YES;
return self;
}
diff --git a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.h b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.h
index ca6188904..bd677b32b 100644
--- a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.h
+++ b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.h
@@ -136,6 +136,12 @@ NS_ASSUME_NONNULL_BEGIN
@property (assign, nonatomic) BOOL showVideoBackgroundDisplay;
+/**
+ When YES, the StreamingMediaManager will override encoder settings by the capability values returned from HMI. Defaults to YES.
+ */
+@property (assign, nonatomic) BOOL allowOverrideEncoderSettings;
+
+
- (instancetype)init NS_UNAVAILABLE;
/**
diff --git a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
index d3604453c..b7afdaa07 100644
--- a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
+++ b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
@@ -123,6 +123,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
_screenSize = SDLDefaultScreenSize;
_backgroundingPixelBuffer = NULL;
_showVideoBackgroundDisplay = YES;
+ _allowOverrideEncoderSettings = configuration.streamingMediaConfig.allowOverrideEncoderSettings;
_preferredFormatIndex = 0;
_preferredResolutionIndex = 0;
@@ -344,7 +345,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
weakSelf.preferredFormats = capability.supportedFormats;
weakSelf.preferredResolutions = @[capability.preferredResolution];
- if (capability.maxBitrate != nil) {
+ if (weakSelf.allowOverrideEncoderSettings && capability.maxBitrate != nil) {
NSNumber *bitrate = [[NSNumber alloc] initWithUnsignedLongLong:(capability.maxBitrate.unsignedLongLongValue * 1000)];
NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
[settings addEntriesFromDictionary: self.videoEncoderSettings];