diff options
author | NicoleYarroch <nicole@livio.io> | 2020-02-04 12:17:24 -0500 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2020-02-04 12:17:24 -0500 |
commit | e5b1543fec593f30b4c30fb8316fc578d55280a7 (patch) | |
tree | 7fb5cb11f73c06ea0b9111b4df2195b3aa8deb0e | |
parent | 484f19313ea907936c0cc83abbd0ec160d260ba5 (diff) | |
download | sdl_ios-bugfix/issue_1527_video_stream_resuming_fails.tar.gz |
connectedVehicleMake now reset on disconnectbugfix/issue_1527_video_stream_resuming_fails
-rw-r--r-- | SmartDeviceLink/SDLStreamingVideoLifecycleManager.m | 4 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m | 33 |
2 files changed, 35 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m index 542c9591e..4ba4d3712 100644 --- a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m +++ b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m @@ -71,7 +71,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N @property (strong, nonatomic) NSMutableDictionary *videoEncoderSettings; @property (copy, nonatomic) NSDictionary<NSString *, id> *customEncoderSettings; @property (copy, nonatomic) NSArray<NSString *> *secureMakes; -@property (copy, nonatomic) NSString *connectedVehicleMake; +@property (copy, nonatomic, nullable) NSString *connectedVehicleMake; @property (copy, nonatomic, readonly) NSString *appName; @property (assign, nonatomic) CV_NULLABLE CVPixelBufferRef backgroundingPixelBuffer; @@ -127,6 +127,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N _touchManager = [[SDLTouchManager alloc] initWithHitTester:(id)_focusableItemManager videoScaleManager:_videoScaleManager]; _requestedEncryptionType = configuration.streamingMediaConfig.maximumDesiredEncryption; + _connectedVehicleMake = nil; _dataSource = configuration.streamingMediaConfig.dataSource; _useDisplayLink = configuration.streamingMediaConfig.enableForcedFramerateSync; _backgroundingPixelBuffer = NULL; @@ -201,6 +202,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N _hmiLevel = SDLHMILevelNone; _videoStreamingState = SDLVideoStreamingStateNotStreamable; _lastPresentationTimestamp = kCMTimeInvalid; + _connectedVehicleMake = nil; [self.videoScaleManager stop]; [self.videoStreamStateMachine transitionToState:SDLVideoStreamManagerStateStopped]; diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m index 58a429f26..152db9339 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m @@ -17,6 +17,7 @@ #import "SDLGetSystemCapabilityResponse.h" #import "SDLGenericResponse.h" #import "SDLGlobals.h" +#import "SDLHMICapabilities.h" #import "SDLHMILevel.h" #import "SDLImageResolution.h" #import "SDLLifecycleConfiguration.h" @@ -35,11 +36,12 @@ #import "SDLSystemCapability.h" #import "SDLV2ProtocolHeader.h" #import "SDLV2ProtocolMessage.h" +#import "SDLVehicleType.h" #import "SDLVideoStreamingCapability.h" #import "SDLVideoStreamingState.h" #import "TestConnectionManager.h" #import "SDLVersion.h" -#import "SDLHMICapabilities.h" + @interface SDLStreamingVideoLifecycleManager () @property (weak, nonatomic) SDLProtocol *protocol; @@ -139,6 +141,7 @@ describe(@"the streaming video manager", ^{ __block SDLScreenParams *someScreenParams = nil; __block SDLImageResolution *someImageResolution = nil; __block SDLHMICapabilities *someHMICapabilities = nil; + __block SDLVehicleType *testVehicleType = nil; beforeEach(^{ someImageResolution = [[SDLImageResolution alloc] init]; @@ -147,6 +150,12 @@ describe(@"the streaming video manager", ^{ someScreenParams = [[SDLScreenParams alloc] init]; someScreenParams.resolution = someImageResolution; + + testVehicleType = [[SDLVehicleType alloc] init]; + testVehicleType.make = @"OEM_make"; + testVehicleType.model = @"OEM_model"; + testVehicleType.modelYear = @"OEM_year"; + testVehicleType.trim = @"OEM_trim"; }); context(@"that does not support video streaming", ^{ @@ -160,6 +169,7 @@ describe(@"the streaming video manager", ^{ someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init]; someRegisterAppInterfaceResponse.hmiCapabilities = someHMICapabilities; + someRegisterAppInterfaceResponse.vehicleType = testVehicleType; SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse]; @@ -170,6 +180,10 @@ describe(@"the streaming video manager", ^{ it(@"should not support streaming", ^{ expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@NO)); }); + + it(@"should not save the vehicle make", ^{ + expect(streamingLifecycleManager.connectedVehicleMake).to(beNil()); + }); }); context(@"that supports video streaming", ^{ @@ -191,6 +205,8 @@ describe(@"the streaming video manager", ^{ someRegisterAppInterfaceResponse.displayCapabilities = someDisplayCapabilities; #pragma clang diagnostic pop + someRegisterAppInterfaceResponse.vehicleType = testVehicleType; + SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse]; [[NSNotificationCenter defaultCenter] postNotification:notification]; @@ -201,6 +217,10 @@ describe(@"the streaming video manager", ^{ expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@YES)); expect(@(CGSizeEqualToSize(streamingLifecycleManager.videoScaleManager.displayViewportResolution, CGSizeMake(600, 100)))).to(equal(@YES)); }); + + it(@"should save the vehicle make", ^{ + expect(streamingLifecycleManager.connectedVehicleMake).to(equal(testVehicleType.make)); + }); }); context(@"version is less then 4.5.0", ^{ @@ -217,6 +237,9 @@ describe(@"the streaming video manager", ^{ #pragma clang diagnostic ignored "-Wdeprecated" someRegisterAppInterfaceResponse.displayCapabilities = someDisplayCapabilities; #pragma clang diagnostic pop + + someRegisterAppInterfaceResponse.vehicleType = testVehicleType; + SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse]; [[NSNotificationCenter defaultCenter] postNotification:notification]; @@ -227,6 +250,10 @@ describe(@"the streaming video manager", ^{ expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@YES)); expect(@(CGSizeEqualToSize(streamingLifecycleManager.videoScaleManager.displayViewportResolution, CGSizeMake(600, 100)))).to(equal(@YES)); }); + + it(@"should save the vehicle make", ^{ + expect(streamingLifecycleManager.connectedVehicleMake).to(equal(testVehicleType.make)); + }); }); }); @@ -716,6 +743,10 @@ describe(@"the streaming video manager", ^{ }); describe(@"when stopped", ^{ + beforeEach(^{ + streamingLifecycleManager.connectedVehicleMake = @"OEM_make"; + }); + context(@"if video is not stopped", ^{ beforeEach(^{ [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamManagerStateReady fromOldState:nil callEnterTransition:NO]; |