From 323562910580c553d83cc17d4a3ca149b5100a9f Mon Sep 17 00:00:00 2001 From: NicoleYarroch Date: Thu, 18 Mar 2021 15:32:26 -0400 Subject: [PATCH 1/6] Removed unused private API Signed-off-by: NicoleYarroch --- SmartDeviceLink/private/SDLCarWindow.h | 7 ------- SmartDeviceLink/private/SDLCarWindow.m | 4 ---- 2 files changed, 11 deletions(-) diff --git a/SmartDeviceLink/private/SDLCarWindow.h b/SmartDeviceLink/private/SDLCarWindow.h index 5620d4ed9..45d2f0a62 100755 --- a/SmartDeviceLink/private/SDLCarWindow.h +++ b/SmartDeviceLink/private/SDLCarWindow.h @@ -9,7 +9,6 @@ @class SDLStreamingMediaConfiguration; @class SDLStreamingVideoLifecycleManager; -@class SDLVideoStreamingCapability; NS_ASSUME_NONNULL_BEGIN @@ -36,12 +35,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)syncFrame; -/** - Apply the new video streaming capability to the underlying view controller - @param videoStreamingCapability - The video streaming capability to apply -*/ -- (void)updateVideoStreamingCapability:(SDLVideoStreamingCapability *)videoStreamingCapability; - @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/private/SDLCarWindow.m b/SmartDeviceLink/private/SDLCarWindow.m index ce5bb704f..ffeb7e301 100644 --- a/SmartDeviceLink/private/SDLCarWindow.m +++ b/SmartDeviceLink/private/SDLCarWindow.m @@ -108,10 +108,6 @@ - (void)syncFrame { } } -- (void)updateVideoStreamingCapability:(SDLVideoStreamingCapability *)videoStreamingCapability { - [self sdl_applyDisplayDimensionsToRootViewController:self.rootViewController]; -} - #pragma mark - SDLNavigationLockScreenManager Notifications - (void)sdl_willPresentLockScreenViewController:(NSNotification *)notification { self.lockScreenPresenting = YES; From 5c7c6cffe50a8eb04434552f218b515bea97f865 Mon Sep 17 00:00:00 2001 From: NicoleYarroch Date: Thu, 18 Mar 2021 15:32:57 -0400 Subject: [PATCH 2/6] Added slight delay before sending a start service Signed-off-by: NicoleYarroch --- .../private/SDLStreamingVideoLifecycleManager.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m index f778a80e5..78b25b2f2 100644 --- a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m +++ b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m @@ -575,8 +575,7 @@ - (void)protocol:(SDLProtocol *)protocol didReceiveStartServiceACK:(SDLProtocolM // Figure out the definitive format that will be used. If the protocol / codec weren't passed in the payload, it's probably a system that doesn't support those properties, which also means it's a system that requires H.264 RAW encoding self.videoFormat = [[SDLVideoStreamingFormat alloc] initWithCodec:videoAckPayload.videoCodec ?: SDLVideoStreamingCodecH264 protocol:videoAckPayload.videoProtocol ?: SDLVideoStreamingProtocolRAW]; - SDLVideoStreamManagerState *nextState = [self.currentAppState isEqualToEnum:SDLAppStateInactive] ? SDLVideoStreamManagerStateSuspended : SDLVideoStreamManagerStateReady; - [self.videoStreamStateMachine transitionToState:nextState]; + [self.videoStreamStateMachine transitionToState:SDLVideoStreamManagerStateReady]; } - (void)protocol:(SDLProtocol *)protocol didReceiveStartServiceNAK:(SDLProtocolMessage *)startServiceNAK { @@ -748,7 +747,11 @@ - (void)sdl_videoStreamingCapabilityDidUpdate:(SDLSystemCapability *)systemCapab self.focusableItemManager.enableHapticDataRequests = NO; } SDLLogD(@"Using generic video capabilites, preferred formats: %@, resolutions: %@, haptics disabled", self.preferredFormats, self.preferredResolutions); - [self sdl_useVideoCapability:nil]; + + // HAX to support legacy head units (SYNC 3.0) as a slight delay is needed between getting the SDLOnHMIStatus notification and starting the video service. Otherwise, video will stream but the screen will be black. Add the delay here as legacy head units doe not support `videoStreamingCapability`. + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.25 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + [self sdl_useVideoCapability:nil]; + }); } } From 718ae576b664dfc28322c5ce737a5eaf18b76381 Mon Sep 17 00:00:00 2001 From: NicoleYarroch Date: Fri, 19 Mar 2021 10:24:19 -0400 Subject: [PATCH 3/6] Fixed casting warning Signed-off-by: NicoleYarroch --- SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m index 78b25b2f2..76332a6e1 100644 --- a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m +++ b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m @@ -749,7 +749,7 @@ - (void)sdl_videoStreamingCapabilityDidUpdate:(SDLSystemCapability *)systemCapab SDLLogD(@"Using generic video capabilites, preferred formats: %@, resolutions: %@, haptics disabled", self.preferredFormats, self.preferredResolutions); // HAX to support legacy head units (SYNC 3.0) as a slight delay is needed between getting the SDLOnHMIStatus notification and starting the video service. Otherwise, video will stream but the screen will be black. Add the delay here as legacy head units doe not support `videoStreamingCapability`. - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.25 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 250 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{ [self sdl_useVideoCapability:nil]; }); } From f8911e4cd36223e72b4442f8d1992055248e5245 Mon Sep 17 00:00:00 2001 From: NicoleYarroch Date: Fri, 19 Mar 2021 11:10:13 -0400 Subject: [PATCH 4/6] Reverted CarWindow Signed-off-by: NicoleYarroch --- SmartDeviceLink/private/SDLCarWindow.h | 7 +++++++ SmartDeviceLink/private/SDLCarWindow.m | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/SmartDeviceLink/private/SDLCarWindow.h b/SmartDeviceLink/private/SDLCarWindow.h index 45d2f0a62..5620d4ed9 100755 --- a/SmartDeviceLink/private/SDLCarWindow.h +++ b/SmartDeviceLink/private/SDLCarWindow.h @@ -9,6 +9,7 @@ @class SDLStreamingMediaConfiguration; @class SDLStreamingVideoLifecycleManager; +@class SDLVideoStreamingCapability; NS_ASSUME_NONNULL_BEGIN @@ -35,6 +36,12 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)syncFrame; +/** + Apply the new video streaming capability to the underlying view controller + @param videoStreamingCapability - The video streaming capability to apply +*/ +- (void)updateVideoStreamingCapability:(SDLVideoStreamingCapability *)videoStreamingCapability; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/private/SDLCarWindow.m b/SmartDeviceLink/private/SDLCarWindow.m index ffeb7e301..ce5bb704f 100644 --- a/SmartDeviceLink/private/SDLCarWindow.m +++ b/SmartDeviceLink/private/SDLCarWindow.m @@ -108,6 +108,10 @@ - (void)syncFrame { } } +- (void)updateVideoStreamingCapability:(SDLVideoStreamingCapability *)videoStreamingCapability { + [self sdl_applyDisplayDimensionsToRootViewController:self.rootViewController]; +} + #pragma mark - SDLNavigationLockScreenManager Notifications - (void)sdl_willPresentLockScreenViewController:(NSNotification *)notification { self.lockScreenPresenting = YES; From b68e69d44cf8617e7fe4ec1eb9ffce19a2f198d3 Mon Sep 17 00:00:00 2001 From: Nicole Yarroch Date: Tue, 23 Mar 2021 13:07:56 -0400 Subject: [PATCH 5/6] Apply suggestions from code review Co-authored-by: Joel Fischer --- SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m index 76332a6e1..d6c6bbbed 100644 --- a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m +++ b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m @@ -748,7 +748,7 @@ - (void)sdl_videoStreamingCapabilityDidUpdate:(SDLSystemCapability *)systemCapab } SDLLogD(@"Using generic video capabilites, preferred formats: %@, resolutions: %@, haptics disabled", self.preferredFormats, self.preferredResolutions); - // HAX to support legacy head units (SYNC 3.0) as a slight delay is needed between getting the SDLOnHMIStatus notification and starting the video service. Otherwise, video will stream but the screen will be black. Add the delay here as legacy head units doe not support `videoStreamingCapability`. + // HAX: to support legacy head units (SYNC 3.0) as a slight delay is needed between getting the `OnHMIStatus` notification and sending the video `StartService`. Otherwise, video will stream but the screen will be black. Add the delay here as legacy head units do not support `videoStreamingCapability`. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 250 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{ [self sdl_useVideoCapability:nil]; }); From 520dcf1dc802b6d2bae66f2918f5129319e9ee7a Mon Sep 17 00:00:00 2001 From: NicoleYarroch Date: Tue, 23 Mar 2021 13:19:11 -0400 Subject: [PATCH 6/6] Added some clarifying docs Signed-off-by: NicoleYarroch --- SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m | 1 + 1 file changed, 1 insertion(+) diff --git a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m index d6c6bbbed..8bc274523 100644 --- a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m +++ b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m @@ -575,6 +575,7 @@ - (void)protocol:(SDLProtocol *)protocol didReceiveStartServiceACK:(SDLProtocolM // Figure out the definitive format that will be used. If the protocol / codec weren't passed in the payload, it's probably a system that doesn't support those properties, which also means it's a system that requires H.264 RAW encoding self.videoFormat = [[SDLVideoStreamingFormat alloc] initWithCodec:videoAckPayload.videoCodec ?: SDLVideoStreamingCodecH264 protocol:videoAckPayload.videoProtocol ?: SDLVideoStreamingProtocolRAW]; + // Video is ready to stream. If the app is inactive and can't stream video, then the Ready state will handle transitioning to the Suspended state [self.videoStreamStateMachine transitionToState:SDLVideoStreamManagerStateReady]; }