From 4865b9dba15a2e70fc4e963770ed44f12bc2a9c3 Mon Sep 17 00:00:00 2001 From: Yasuhiro Yoneyama Date: Wed, 10 Jul 2019 10:39:36 +0900 Subject: [PATCH 1/5] implement proposal SDL-0237 'Add feature do disable "Video Streaming Backgrounded String" feature' --- SmartDeviceLink/SDLStreamingMediaConfiguration.h | 5 +++++ SmartDeviceLink/SDLStreamingMediaConfiguration.m | 1 + SmartDeviceLink/SDLStreamingVideoLifecycleManager.m | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.h b/SmartDeviceLink/SDLStreamingMediaConfiguration.h index 3e4f91849..37e3ef433 100644 --- a/SmartDeviceLink/SDLStreamingMediaConfiguration.h +++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.h @@ -85,6 +85,11 @@ typedef NS_ENUM(NSUInteger, SDLCarWindowRenderingType) { */ @property (assign, nonatomic) BOOL allowMultipleViewControllerOrientations; +/** + When YES, the StreamingMediaManager will send a black screen with "Video Backgrounded String". Defaults to YES. + */ +@property (assign, nonatomic) BOOL showVideoBackgroundDisplay; + /** Create an insecure video streaming configuration. No security managers will be provided and the encryption flag will be set to None. If you'd like custom video encoder settings, you can set the property manually. diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.m b/SmartDeviceLink/SDLStreamingMediaConfiguration.m index 41c7df822..b100ea361 100644 --- a/SmartDeviceLink/SDLStreamingMediaConfiguration.m +++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.m @@ -37,6 +37,7 @@ - (instancetype)initWithSecurityManagers:(nullable NSArray @property (copy, nonatomic, readonly) NSString *appName; @property (assign, nonatomic) CV_NULLABLE CVPixelBufferRef backgroundingPixelBuffer; +@property (assign, nonatomic) BOOL showVideoBackgroundDisplay; @property (strong, nonatomic, nullable) CADisplayLink *displayLink; @property (assign, nonatomic) BOOL useDisplayLink; @@ -122,6 +123,7 @@ - (instancetype)initWithConnectionManager:(id)connecti _useDisplayLink = configuration.streamingMediaConfig.enableForcedFramerateSync; _screenSize = SDLDefaultScreenSize; _backgroundingPixelBuffer = NULL; + _showVideoBackgroundDisplay = configuration.showVideoBackgroundDisplay; _preferredFormatIndex = 0; _preferredResolutionIndex = 0; @@ -272,7 +274,9 @@ - (void)didEnterStateAppInactive { SDLLogD(@"App became inactive"); if (!self.protocol) { return; } - [self sdl_sendBackgroundFrames]; + if (_showVideoBackgroundDisplay) { + [self sdl_sendBackgroundFrames]; + } [self.touchManager cancelPendingTouches]; if (self.isVideoConnected) { From 7f3f46e21e9e0d0800bd880fe9f495adda901bd7 Mon Sep 17 00:00:00 2001 From: Takamitsu Yoshii Date: Wed, 24 Jul 2019 10:06:40 +0900 Subject: [PATCH 2/5] fix-review: fix incorrect variable reference --- SmartDeviceLink/SDLStreamingVideoLifecycleManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m index ffb4b3796..1a0076b39 100644 --- a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m +++ b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m @@ -123,7 +123,7 @@ - (instancetype)initWithConnectionManager:(id)connecti _useDisplayLink = configuration.streamingMediaConfig.enableForcedFramerateSync; _screenSize = SDLDefaultScreenSize; _backgroundingPixelBuffer = NULL; - _showVideoBackgroundDisplay = configuration.showVideoBackgroundDisplay; + _showVideoBackgroundDisplay = configuration.streamingMediaConfig.showVideoBackgroundDisplay; _preferredFormatIndex = 0; _preferredResolutionIndex = 0; From 478c594347d76410d72cf3e0dd659fd1499b2295 Mon Sep 17 00:00:00 2001 From: Takamitsu Yoshii Date: Wed, 24 Jul 2019 10:17:33 +0900 Subject: [PATCH 3/5] add test --- .../DevAPISpecs/SDLStreamingMediaConfigurationSpec.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m index c5fc8949c..096dac630 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m @@ -38,6 +38,7 @@ expect(testConfig.allowMultipleViewControllerOrientations).to(equal(NO)); expect(testConfig.dataSource).to(equal(testDataSource)); expect(testConfig.rootViewController).to(equal(testViewController)); + expect(testConfig.showVideoBackgroundDisplay).to(equal(YES)); }); }); @@ -53,6 +54,7 @@ expect(testConfig.allowMultipleViewControllerOrientations).to(equal(NO)); expect(testConfig.dataSource).to(beNil()); expect(testConfig.rootViewController).to(beNil()); + expect(testConfig.showVideoBackgroundDisplay).to(equal(YES)); }); }); @@ -72,6 +74,7 @@ expect(testConfig.allowMultipleViewControllerOrientations).to(equal(NO)); expect(testConfig.dataSource).to(beNil()); expect(testConfig.rootViewController).to(beNil()); + expect(testConfig.showVideoBackgroundDisplay).to(equal(YES)); }); }); }); From cb560a116064d6dfc4086a4bb1859dbacc6da48e Mon Sep 17 00:00:00 2001 From: Takamitsu Yoshii Date: Fri, 9 Aug 2019 10:46:26 +0900 Subject: [PATCH 4/5] make `showVideoBackgroundDisplay` togglable --- SmartDeviceLink/SDLStreamingMediaConfiguration.h | 5 ----- SmartDeviceLink/SDLStreamingMediaConfiguration.m | 1 - SmartDeviceLink/SDLStreamingMediaManager.h | 5 +++++ SmartDeviceLink/SDLStreamingMediaManager.m | 9 +++++++++ SmartDeviceLink/SDLStreamingVideoLifecycleManager.h | 6 ++++++ SmartDeviceLink/SDLStreamingVideoLifecycleManager.m | 3 +-- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.h b/SmartDeviceLink/SDLStreamingMediaConfiguration.h index 37e3ef433..3e4f91849 100644 --- a/SmartDeviceLink/SDLStreamingMediaConfiguration.h +++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.h @@ -85,11 +85,6 @@ typedef NS_ENUM(NSUInteger, SDLCarWindowRenderingType) { */ @property (assign, nonatomic) BOOL allowMultipleViewControllerOrientations; -/** - When YES, the StreamingMediaManager will send a black screen with "Video Backgrounded String". Defaults to YES. - */ -@property (assign, nonatomic) BOOL showVideoBackgroundDisplay; - /** Create an insecure video streaming configuration. No security managers will be provided and the encryption flag will be set to None. If you'd like custom video encoder settings, you can set the property manually. diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.m b/SmartDeviceLink/SDLStreamingMediaConfiguration.m index b100ea361..41c7df822 100644 --- a/SmartDeviceLink/SDLStreamingMediaConfiguration.m +++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.m @@ -37,7 +37,6 @@ - (instancetype)initWithSecurityManagers:(nullable NSArray @property (copy, nonatomic, readonly) NSString *appName; @property (assign, nonatomic) CV_NULLABLE CVPixelBufferRef backgroundingPixelBuffer; -@property (assign, nonatomic) BOOL showVideoBackgroundDisplay; @property (strong, nonatomic, nullable) CADisplayLink *displayLink; @property (assign, nonatomic) BOOL useDisplayLink; @@ -123,7 +122,7 @@ - (instancetype)initWithConnectionManager:(id)connecti _useDisplayLink = configuration.streamingMediaConfig.enableForcedFramerateSync; _screenSize = SDLDefaultScreenSize; _backgroundingPixelBuffer = NULL; - _showVideoBackgroundDisplay = configuration.streamingMediaConfig.showVideoBackgroundDisplay; + _showVideoBackgroundDisplay = YES; _preferredFormatIndex = 0; _preferredResolutionIndex = 0; From 3eb24df69b4d84aac2730b9d8793c396018cf1c8 Mon Sep 17 00:00:00 2001 From: Takamitsu Yoshii Date: Fri, 9 Aug 2019 11:14:05 +0900 Subject: [PATCH 5/5] update test --- .../DevAPISpecs/SDLStreamingMediaConfigurationSpec.m | 3 --- .../DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m index 096dac630..c5fc8949c 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m @@ -38,7 +38,6 @@ expect(testConfig.allowMultipleViewControllerOrientations).to(equal(NO)); expect(testConfig.dataSource).to(equal(testDataSource)); expect(testConfig.rootViewController).to(equal(testViewController)); - expect(testConfig.showVideoBackgroundDisplay).to(equal(YES)); }); }); @@ -54,7 +53,6 @@ expect(testConfig.allowMultipleViewControllerOrientations).to(equal(NO)); expect(testConfig.dataSource).to(beNil()); expect(testConfig.rootViewController).to(beNil()); - expect(testConfig.showVideoBackgroundDisplay).to(equal(YES)); }); }); @@ -74,7 +72,6 @@ expect(testConfig.allowMultipleViewControllerOrientations).to(equal(NO)); expect(testConfig.dataSource).to(beNil()); expect(testConfig.rootViewController).to(beNil()); - expect(testConfig.showVideoBackgroundDisplay).to(equal(YES)); }); }); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m index 872f5eb72..31737c214 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m @@ -90,6 +90,7 @@ __block void (^sendNotificationForHMILevel)(SDLHMILevel hmiLevel, SDLVideoStream expect(@(CGSizeEqualToSize(streamingLifecycleManager.screenSize, CGSizeZero))).to(equal(@YES)); expect(@(streamingLifecycleManager.pixelBufferPool == NULL)).to(equal(@YES)); expect(@(streamingLifecycleManager.requestedEncryptionType)).to(equal(@(SDLStreamingEncryptionFlagNone))); + expect(@(streamingLifecycleManager.showVideoBackgroundDisplay)).to(equal(@YES)); expect(streamingLifecycleManager.currentAppState).to(equal(SDLAppStateActive)); expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped)); expect(streamingLifecycleManager.videoFormat).to(beNil());