Skip to content

Commit

Permalink
Merge pull request #1947 from smartdevicelink/bugfix/issue_1944_video…
Browse files Browse the repository at this point in the history
…_resumption_broken_switching_nav_apps

Fixed video not resuming when switching between navigation apps
  • Loading branch information
joeljfischer authored Mar 23, 2021
2 parents f590b09 + 520dcf1 commit 46fda98
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ - (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];
// 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];
}

- (void)protocol:(SDLProtocol *)protocol didReceiveStartServiceNAK:(SDLProtocolMessage *)startServiceNAK {
Expand Down Expand Up @@ -748,7 +748,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 `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];
});
}
}

Expand Down

0 comments on commit 46fda98

Please sign in to comment.