diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2019-09-30 10:46:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-30 10:46:50 -0400 |
commit | 50cd95a53f9aad8c9ac20cb3fe844a12d6f84885 (patch) | |
tree | 1595439d032ee1d4c474d6a50e83298f1f80f6a7 | |
parent | 398952c0d103b06faf5c49f354b56df33cba1c1e (diff) | |
parent | c57ed3e9e9f66b2e3f10cc20fd2e4784690c36dc (diff) | |
download | sdl_ios-50cd95a53f9aad8c9ac20cb3fe844a12d6f84885.tar.gz |
Merge pull request #1412 from smartdevicelink/feature/issue-1411-Streamingvideolifecyclemanagers-isStreamingSupported
Streamingvideolifecyclemanagers is streaming supported
-rw-r--r-- | SmartDeviceLink/SDLStreamingVideoLifecycleManager.m | 8 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m | 54 |
2 files changed, 51 insertions, 11 deletions
diff --git a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m index 96139b93e..202d1f1d9 100644 --- a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m +++ b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m @@ -44,6 +44,7 @@ #import "SDLVehicleType.h" #import "SDLVideoEncoderDelegate.h" #import "SDLVideoStreamingCapability.h" +#import "SDLVersion.h" static NSUInteger const FramesToSendOnBackground = 30; @@ -563,9 +564,12 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N SDLLogV(@"Determining whether streaming is supported"); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated" - _streamingSupported = registerResponse.hmiCapabilities.videoStreaming ? registerResponse.hmiCapabilities.videoStreaming.boolValue : registerResponse.displayCapabilities.graphicSupported.boolValue; + if ([SDLGlobals.sharedGlobals.rpcVersion isGreaterThanOrEqualToVersion:[[SDLVersion alloc] initWithMajor:4 minor:5 patch:0]]) { + _streamingSupported = registerResponse.hmiCapabilities.videoStreaming.boolValue; + } else { + _streamingSupported = YES; + } #pragma clang diagnostic pop - if (!self.isStreamingSupported) { SDLLogE(@"Graphics are not supported on this head unit. We are are assuming screen size is also unavailable and exiting."); return; diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m index d557ce52c..0fb214439 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m @@ -36,6 +36,8 @@ #import "SDLVideoStreamingCapability.h" #import "SDLVideoStreamingState.h" #import "TestConnectionManager.h" +#import "SDLVersion.h" +#import "SDLHMICapabilities.h" @interface SDLStreamingVideoLifecycleManager () @property (copy, nonatomic, readonly) NSString *appName; @@ -132,6 +134,7 @@ describe(@"the streaming video manager", ^{ __block SDLDisplayCapabilities *someDisplayCapabilities = nil; __block SDLScreenParams *someScreenParams = nil; __block SDLImageResolution *someImageResolution = nil; + __block SDLHMICapabilities *someHMICapabilities = nil; beforeEach(^{ someImageResolution = [[SDLImageResolution alloc] init]; @@ -142,34 +145,67 @@ describe(@"the streaming video manager", ^{ someScreenParams.resolution = someImageResolution; }); - context(@"that does not support graphics", ^{ + context(@"that does not support video streaming", ^{ beforeEach(^{ - someDisplayCapabilities = [[SDLDisplayCapabilities alloc] init]; - someDisplayCapabilities.graphicSupported = @NO; + SDLVersion *version = [SDLVersion versionWithMajor:6 minor:0 patch:0]; + id globalMock = OCMPartialMock([SDLGlobals sharedGlobals]); + OCMStub([globalMock rpcVersion]).andReturn(version); + + someHMICapabilities = [[SDLHMICapabilities alloc] init]; + someHMICapabilities.videoStreaming = @NO; + + someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init]; + someRegisterAppInterfaceResponse.hmiCapabilities = someHMICapabilities; + + SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse]; + + [[NSNotificationCenter defaultCenter] postNotification:notification]; + [NSThread sleepForTimeInterval:0.1]; + }); + + it(@"should not support streaming", ^{ + expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@NO)); + }); + }); + + context(@"that supports video streaming", ^{ + beforeEach(^{ + SDLVersion *version = [SDLVersion versionWithMajor:6 minor:0 patch:0]; + id globalMock = OCMPartialMock([SDLGlobals sharedGlobals]); + OCMStub([globalMock rpcVersion]).andReturn(version); + + someHMICapabilities = [[SDLHMICapabilities alloc] init]; + someHMICapabilities.videoStreaming = @YES; + someDisplayCapabilities = [[SDLDisplayCapabilities alloc] init]; someDisplayCapabilities.screenParams = someScreenParams; someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init]; + someRegisterAppInterfaceResponse.hmiCapabilities = someHMICapabilities; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated" someRegisterAppInterfaceResponse.displayCapabilities = someDisplayCapabilities; #pragma clang diagnostic pop + SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse]; [[NSNotificationCenter defaultCenter] postNotification:notification]; [NSThread sleepForTimeInterval:0.1]; }); - it(@"should not support streaming", ^{ - expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@NO)); + it(@"should support streaming", ^{ + expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@YES)); + expect(@(CGSizeEqualToSize(streamingLifecycleManager.screenSize, CGSizeMake(600, 100)))).to(equal(@YES)); }); }); - context(@"that supports graphics", ^{ + context(@"version is less then 4.5.0", ^{ beforeEach(^{ - someDisplayCapabilities = [[SDLDisplayCapabilities alloc] init]; - someDisplayCapabilities.graphicSupported = @YES; + SDLVersion *version = [SDLVersion versionWithMajor:4 minor:0 patch:0]; + id globalMock = OCMPartialMock([SDLGlobals sharedGlobals]); + OCMStub([globalMock rpcVersion]).andReturn(version); + someDisplayCapabilities = [[SDLDisplayCapabilities alloc] init]; someDisplayCapabilities.screenParams = someScreenParams; someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init]; @@ -183,7 +219,7 @@ describe(@"the streaming video manager", ^{ [NSThread sleepForTimeInterval:0.1]; }); - it(@"should support streaming", ^{ + it(@"should support streaming even though hmiCapabilities.videoStreaming is nil", ^{ expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@YES)); expect(@(CGSizeEqualToSize(streamingLifecycleManager.screenSize, CGSizeMake(600, 100)))).to(equal(@YES)); }); |