diff options
author | NicoleYarroch <nicole@livio.io> | 2018-04-06 16:07:36 -0400 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2018-04-06 16:07:36 -0400 |
commit | 468c50ea24ed0002bff8ad5e49ca72cbde1b9c1b (patch) | |
tree | 8bd4f8db633c3dcc0cf6bdcd2164903fd8342a09 | |
parent | befd479e1bcbd431d2e9f41286be3aa6eb5c404f (diff) | |
download | sdl_ios-bugfix/issue_908_car_window_screen_resolution.tar.gz |
Consolidated if:else statements for setting final screen sizebugfix/issue_908_car_window_screen_resolution
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaLifecycleManager.m | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m b/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m index dcc4f10a4..a77f87820 100644 --- a/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m +++ b/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m @@ -523,17 +523,15 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N // This is the definitive screen size that will be used if (videoAckPayload.height != SDLControlFrameInt32NotFound && videoAckPayload.width != SDLControlFrameInt32NotFound) { _screenSize = CGSizeMake(videoAckPayload.width, videoAckPayload.height); - } else { + } else if (self.preferredResolutions.count > 0) { // If a preferred resolution was set, use the first option to set the screen size - if (self.preferredResolutions.count > 0) { - SDLImageResolution *preferredResolution = self.preferredResolutions[0]; - CGSize newScreenSize = CGSizeMake(preferredResolution.resolutionWidth.floatValue, preferredResolution.resolutionHeight.floatValue); - if (!CGSizeEqualToSize(self.screenSize, newScreenSize)) { - SDLLogW(@"The preferred resolution does not match the screen dimensions returned by the Register App Interface Response. Video may look distorted or video may not show up on the head unit"); - _screenSize = CGSizeMake(preferredResolution.resolutionWidth.floatValue, preferredResolution.resolutionHeight.floatValue); - } - } // else we are using the screen size we got from the RAIR earlier - } + SDLImageResolution *preferredResolution = self.preferredResolutions.firstObject; + CGSize newScreenSize = CGSizeMake(preferredResolution.resolutionWidth.floatValue, preferredResolution.resolutionHeight.floatValue); + if (!CGSizeEqualToSize(self.screenSize, newScreenSize)) { + SDLLogW(@"The preferred resolution does not match the screen dimensions returned by the Register App Interface Response. Video may look distorted or video may not show up on the head unit"); + _screenSize = CGSizeMake(preferredResolution.resolutionWidth.floatValue, preferredResolution.resolutionHeight.floatValue); + } + } // else we are using the screen size we got from the RAIR earlier // 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] init]; |