Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SDL 0179 - Pixel density and Scale #1360

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions SmartDeviceLink/SDLCarWindow.m 100755 → 100644
Expand Up @@ -21,6 +21,7 @@
#import "SDLStreamingMediaConfiguration.h"
#import "SDLStreamingVideoLifecycleManager.h"
#import "SDLStreamingMediaManagerConstants.h"
#import "SDLVideoStreamingCapability.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -71,7 +72,7 @@ - (void)syncFrame {
return;
}

CGRect bounds = self.rootViewController.view.bounds;
CGRect bounds = self.sdl_getScaledScreenSizeFrame;

UIGraphicsBeginImageContextWithOptions(bounds.size, YES, 1.0f);
switch (self.renderingType) {
Expand Down Expand Up @@ -120,13 +121,18 @@ - (void)sdl_didReceiveVideoStreamStarted:(NSNotification *)notification {

dispatch_async(dispatch_get_main_queue(), ^{
// If the video stream has started, we want to resize the streamingViewController to the size from the RegisterAppInterface
self.rootViewController.view.frame = CGRectMake(0, 0, self.streamManager.screenSize.width, self.streamManager.screenSize.height);
self.rootViewController.view.frame = self.sdl_getScaledScreenSizeFrame;
self.rootViewController.view.bounds = self.rootViewController.view.frame;

SDLLogD(@"Video stream started, setting CarWindow frame to: %@", NSStringFromCGRect(self.rootViewController.view.bounds));
});
}

- (CGRect)sdl_getScaledScreenSizeFrame {
Copy link
Contributor

@yLeonid yLeonid Sep 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misleading method name:

  1. We can use a property name without the prefix get
    - (CGRect)sdl_scaledScreenSizeFrame {}
  2. If we really want to use the prefix get then the method must look like this:
- (void)sdl_getScaledScreenSizeFrame:(CGRect * outRect) {
    if (outRect) {
       *outRect = <the rect value>;
    }
}

(See Apple Objective-C guideline)

float scale = self.streamManager.videoStreamingCapability.scale.floatValue;
lnafarrateluxoft marked this conversation as resolved.
Show resolved Hide resolved
return CGRectMake(0, 0, self.streamManager.screenSize.width / scale, self.streamManager.screenSize.height / scale);
}

- (void)sdl_didReceiveVideoStreamStopped:(NSNotification *)notification {
self.videoStreamStarted = false;

Expand Down
3 changes: 3 additions & 0 deletions SmartDeviceLink/SDLRPCParameterNames.h
Expand Up @@ -139,6 +139,7 @@ extern SDLRPCParameterName const SDLRPCParameterNameDestinationETA;
extern SDLRPCParameterName const SDLRPCParameterNameDetails;
extern SDLRPCParameterName const SDLRPCParameterNameDeviceInfo;
extern SDLRPCParameterName const SDLRPCParameterNameDeviceStatus;
extern SDLRPCParameterName const SDLRPCParameterNameDiagonalScreenSize;
extern SDLRPCParameterName const SDLRPCParameterNameDialNumberEnabled;
extern SDLRPCParameterName const SDLRPCParameterNameDIDLocation;
extern SDLRPCParameterName const SDLRPCParameterNameDIDResult;
Expand Down Expand Up @@ -443,6 +444,7 @@ extern SDLRPCParameterName const SDLRPCParameterNamePhoneCall;
extern SDLRPCParameterName const SDLRPCParameterNamePhoneCapability;
extern SDLRPCParameterName const SDLRPCParameterNamePhoneNumber;
extern SDLRPCParameterName const SDLRPCParameterNamePhoneRoaming;
extern SDLRPCParameterName const SDLRPCParameterNamePixelPerInch;
extern SDLRPCParameterName const SDLRPCParameterNamePlaylistName;
extern SDLRPCParameterName const SDLRPCParameterNamePlayTone;
extern SDLRPCParameterName const SDLRPCParameterNamePosition;
Expand Down Expand Up @@ -514,6 +516,7 @@ extern SDLRPCParameterName const SDLRPCParameterNameRPM;
extern SDLRPCParameterName const SDLRPCParameterNameRadioText;
extern SDLRPCParameterName const SDLRPCParameterNameSamplingRate;
extern SDLRPCParameterName const SDLRPCParameterNameSatellites;
extern SDLRPCParameterName const SDLRPCParameterNameScale;
extern SDLRPCParameterName const SDLRPCParameterNameScreenParams;
extern SDLRPCParameterName const SDLRPCParameterNameScrollableMessageBody;
extern SDLRPCParameterName const SDLRPCParameterNameSDLVersion;
Expand Down
3 changes: 3 additions & 0 deletions SmartDeviceLink/SDLRPCParameterNames.m
Expand Up @@ -137,6 +137,7 @@
SDLRPCParameterName const SDLRPCParameterNameDeviceInfo = @"deviceInfo";
SDLRPCParameterName const SDLRPCParameterNameDeviceStatus = @"deviceStatus";
SDLRPCParameterName const SDLRPCParameterNameDetails = @"details";
SDLRPCParameterName const SDLRPCParameterNameDiagonalScreenSize = @"diagonalScreenSize";
SDLRPCParameterName const SDLRPCParameterNameDialNumberEnabled = @"dialNumberEnabled";
SDLRPCParameterName const SDLRPCParameterNameDIDLocation = @"didLocation";
SDLRPCParameterName const SDLRPCParameterNameDIDResult = @"didResult";
Expand Down Expand Up @@ -437,6 +438,7 @@
SDLRPCParameterName const SDLRPCParameterNamePhoneCapability = @"phoneCapability";
SDLRPCParameterName const SDLRPCParameterNamePhoneNumber = @"phoneNumber";
SDLRPCParameterName const SDLRPCParameterNamePhoneRoaming = @"phoneRoaming";
SDLRPCParameterName const SDLRPCParameterNamePixelPerInch = @"pixelPerInch";
SDLRPCParameterName const SDLRPCParameterNamePrimaryColor = @"primaryColor";
SDLRPCParameterName const SDLRPCParameterNamePlaylistName = @"playlistName";
SDLRPCParameterName const SDLRPCParameterNamePlayTone = @"playTone";
Expand Down Expand Up @@ -509,6 +511,7 @@
SDLRPCParameterName const SDLRPCParameterNameRadioText = @"RT";
SDLRPCParameterName const SDLRPCParameterNameSamplingRate = @"samplingRate";
SDLRPCParameterName const SDLRPCParameterNameSatellites = @"satellites";
SDLRPCParameterName const SDLRPCParameterNameScale = @"scale";
SDLRPCParameterName const SDLRPCParameterNameScreenParams = @"screenParams";
SDLRPCParameterName const SDLRPCParameterNameScrollableMessageBody = @"scrollableMessageBody";
SDLRPCParameterName const SDLRPCParameterNameSDLVersion = @"sdlVersion";
Expand Down
2 changes: 2 additions & 0 deletions SmartDeviceLink/SDLStreamingVideoLifecycleManager.h
Expand Up @@ -22,6 +22,7 @@
@class SDLStateMachine;
@class SDLStreamingMediaConfiguration;
@class SDLTouchManager;
@class SDLVideoStreamingCapability;

@protocol SDLConnectionManagerType;
@protocol SDLFocusableItemLocatorType;
Expand All @@ -35,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN

@property (strong, nonatomic, readonly) SDLStateMachine *videoStreamStateMachine;
@property (strong, nonatomic, readonly) SDLVideoStreamManagerState *currentVideoStreamState;
@property (nullable, strong, nonatomic, readonly) SDLVideoStreamingCapability *videoStreamingCapability;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you want to makevideoStreamingCapability public? Iit doesn't appear to be used by another class. If developers want to get the videoStreamingCapability they can use the SDLSystemCapabilityManager.


@property (strong, nonatomic, readonly) SDLStateMachine *appStateMachine;
@property (strong, nonatomic, readonly) SDLAppState *currentAppState;
Expand Down
8 changes: 7 additions & 1 deletion SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
Expand Up @@ -58,6 +58,8 @@ @interface SDLStreamingVideoLifecycleManager() <SDLVideoEncoderDelegate>
@property (assign, nonatomic, readonly, getter=isAppStateVideoStreamCapable) BOOL appStateVideoStreamCapable;
@property (assign, nonatomic, readonly, getter=isHmiStateVideoStreamCapable) BOOL hmiStateVideoStreamCapable;

@property (nullable, strong, nonatomic, readwrite) SDLVideoStreamingCapability *videoStreamingCapability;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This my idea of how to best prevent duplicate code for the scale value.

  1. In the SDLStreamingVideoLifecycleManager create a custom sdl_scale getter to return videoStreamingCapability.scale or 1 if the scale value does not exists.
  2. Add another init to SDLTouchManger that takes a scale value in addition to the hitTester. In the SDLStreamingVideoLifecycleManager class set sdl_scale for the scale value in the touch manager init. Then later, when we get the videoStreamingCapability from core, the actual scale value can be set in the touch manager class.
  3. Do the same thing for SDLCarWindow. Add another init to SDLCarWindow that takes a scale value in addition to the streamManager and configuration. In the SDLStreamingVideoLifecycleManager class set sdl_scale for the scale value in the car window init. Then later, when we get the videoStreamingCapability from core, the actual scale value can be set in the car window class.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented here:
yLeonid@91b30ce


@property (strong, nonatomic, readwrite) SDLStateMachine *videoStreamStateMachine;
@property (strong, nonatomic, readwrite) SDLStateMachine *appStateMachine;

Expand Down Expand Up @@ -393,7 +395,9 @@ - (void)didEnterStateVideoStreamReady {
NSAssert(self.videoFormat != nil, @"No video format is known, but it must be if we got a protocol start service response");

SDLLogD(@"Attempting to create video encoder");
self.videoEncoder = [[SDLH264VideoEncoder alloc] initWithProtocol:self.videoFormat.protocol dimensions:self.screenSize ssrc:self.ssrc properties:self.videoEncoderSettings delegate:self error:&error];
float scale = self.videoStreamingCapability.scale.floatValue;
lnafarrateluxoft marked this conversation as resolved.
Show resolved Hide resolved
CGSize scaledScreenSize = CGSizeMake(self.screenSize.width / scale, self.screenSize.height / scale);
self.videoEncoder = [[SDLH264VideoEncoder alloc] initWithProtocol:self.videoFormat.protocol dimensions:scaledScreenSize ssrc:self.ssrc properties:self.videoEncoderSettings delegate:self error:&error];

if (error || self.videoEncoder == nil) {
SDLLogE(@"Could not create a video encoder: %@", error);
Expand Down Expand Up @@ -710,6 +714,8 @@ - (void)sdl_requestVideoCapabilities:(SDLVideoCapabilityResponseHandler)response
}

SDLVideoStreamingCapability *videoCapability = ((SDLGetSystemCapabilityResponse *)response).systemCapability.videoStreamingCapability;
self.videoStreamingCapability = videoCapability;
self.touchManager.videoStreamingCapability = videoCapability;
SDLLogD(@"Video capabilities response received: %@", videoCapability);
responseHandler(videoCapability);
}];
Expand Down
6 changes: 6 additions & 0 deletions SmartDeviceLink/SDLTouchManager.h
Expand Up @@ -14,6 +14,7 @@
@protocol SDLTouchManagerDelegate;

@class SDLTouch;
@class SDLVideoStreamingCapability;

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -78,6 +79,11 @@ typedef void(^SDLTouchEventHandler)(SDLTouch *touch, SDLTouchType type);
*/
@property (nonatomic, assign, getter=isTouchEnabled) BOOL touchEnabled;

/**
Provides all video streaming capabilities defined in the HMI.
*/
@property (nullable, strong, nonatomic) SDLVideoStreamingCapability *videoStreamingCapability;

/**
* @abstract
* Cancels pending touch event timers that may be in progress.
Expand Down
24 changes: 23 additions & 1 deletion SmartDeviceLink/SDLTouchManager.m
Expand Up @@ -22,6 +22,7 @@
#import "SDLTouchCoord.h"
#import "SDLTouchEvent.h"
#import "SDLTouchManagerDelegate.h"
#import "SDLVideoStreamingCapability.h"


NS_ASSUME_NONNULL_BEGIN
Expand Down Expand Up @@ -184,7 +185,8 @@ - (void)sdl_onTouchEvent:(SDLRPCNotificationNotification *)notification {
return;
}

SDLOnTouchEvent* onTouchEvent = (SDLOnTouchEvent*)notification.notification;
SDLOnTouchEvent *onTouchEvent = (SDLOnTouchEvent *)notification.notification;
onTouchEvent = [self sdl_applyScaleToEventCoordinates:onTouchEvent.copy];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think copy is working as expected here which is why the TouchManager test cases are breaking when I run all the tests. Maybe copyWithZone: has a bug?


SDLTouchType touchType = onTouchEvent.type;
[onTouchEvent.event enumerateObjectsUsingBlock:^(SDLTouchEvent *touchEvent, NSUInteger idx, BOOL *stop) {
Expand Down Expand Up @@ -212,6 +214,26 @@ - (void)sdl_onTouchEvent:(SDLRPCNotificationNotification *)notification {
}];
}

/**
* Modifies the existing coordinates of the SDLOnTouchEvent, based on the received 'scale' value.

* This will match the coordinates to the scaled resolution of the video.

* @param onTouchEvent A SDLOnTouchEvent with coordinates.
*/
- (SDLOnTouchEvent *)sdl_applyScaleToEventCoordinates:(SDLOnTouchEvent *)onTouchEvent {
float scale = self.videoStreamingCapability.scale.floatValue;
if (scale > 1) {
for (SDLTouchEvent *touchEvent in onTouchEvent.event) {
for (SDLTouchCoord *coord in touchEvent.coord) {
coord.x = @(coord.x.floatValue / scale);
coord.y = @(coord.y.floatValue / scale);
}
}
}
return onTouchEvent;
}

lnafarrateluxoft marked this conversation as resolved.
Show resolved Hide resolved
#pragma mark - Private
/**
* Handles a BEGIN touch event sent by Core
Expand Down
28 changes: 27 additions & 1 deletion SmartDeviceLink/SDLVideoStreamingCapability.h
Expand Up @@ -18,7 +18,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface SDLVideoStreamingCapability : SDLRPCStruct

- (instancetype)initWithPreferredResolution:(nullable SDLImageResolution *)preferredResolution maxBitrate:(int32_t)maxBitrate supportedFormats:(nullable NSArray<SDLVideoStreamingFormat *> *)supportedFormats hapticDataSupported:(BOOL)hapticDataSupported;
- (instancetype)initWithPreferredResolution:(nullable SDLImageResolution *)preferredResolution maxBitrate:(int32_t)maxBitrate supportedFormats:(nullable NSArray<SDLVideoStreamingFormat *> *)supportedFormats hapticDataSupported:(BOOL)hapticDataSupported __deprecated_msg("Use initWithPreferredResolution:maxBitrate:supportedFormats:hapticDataSupported:diagonalScreenSize:pixelPerInch:scale: instead");;

/**
Contains information about this system's video streaming capabilities
*/
- (instancetype)initWithPreferredResolution:(nullable SDLImageResolution *)preferredResolution maxBitrate:(int32_t)maxBitrate supportedFormats:(nullable NSArray<SDLVideoStreamingFormat *> *)supportedFormats hapticDataSupported:(BOOL)hapticDataSupported diagonalScreenSize:(float)diagonalScreenSize pixelPerInch:(float)pixelPerInch scale:(float)scale;

/**
The preferred resolution of a video stream for decoding and rendering on HMI
Expand Down Expand Up @@ -48,6 +53,27 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nullable, strong, nonatomic) NSNumber<SDLBool> *hapticSpatialDataSupported;

/**
The diagonal screen size in inches.

Optional
*/
@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *diagonalScreenSize;

/**
PPI is the diagonal resolution in pixels divided by the diagonal screen size in inches.

Optional
*/
@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *pixelPerInch;

/**
The scaling factor the app should use to change the size of the projecting view.

Optional
*/
@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *scale;

@end

NS_ASSUME_NONNULL_END
39 changes: 39 additions & 0 deletions SmartDeviceLink/SDLVideoStreamingCapability.m
Expand Up @@ -18,6 +18,10 @@
@implementation SDLVideoStreamingCapability

- (instancetype)initWithPreferredResolution:(nullable SDLImageResolution *)preferredResolution maxBitrate:(int32_t)maxBitrate supportedFormats:(nullable NSArray<SDLVideoStreamingFormat *> *)supportedFormats hapticDataSupported:(BOOL)hapticDataSupported {
return [self initWithPreferredResolution:preferredResolution maxBitrate:maxBitrate supportedFormats:supportedFormats hapticDataSupported:hapticDataSupported diagonalScreenSize:0 pixelPerInch:0 scale:SDLVideoStreamingCapability.sdl_DefaultScale.floatValue];
}

- (instancetype)initWithPreferredResolution:(nullable SDLImageResolution *)preferredResolution maxBitrate:(int32_t)maxBitrate supportedFormats:(nullable NSArray<SDLVideoStreamingFormat *> *)supportedFormats hapticDataSupported:(BOOL)hapticDataSupported diagonalScreenSize:(float)diagonalScreenSize pixelPerInch:(float)pixelPerInch scale:(float)scale {
self = [self init];
if (!self) {
return self;
Expand All @@ -27,6 +31,9 @@ - (instancetype)initWithPreferredResolution:(nullable SDLImageResolution *)prefe
self.preferredResolution = preferredResolution;
self.supportedFormats = supportedFormats;
self.hapticSpatialDataSupported = @(hapticDataSupported);
self.diagonalScreenSize = @(diagonalScreenSize);
self.pixelPerInch = @(pixelPerInch);
self.scale = @(scale);

return self;
}
Expand Down Expand Up @@ -63,6 +70,38 @@ - (void)setHapticSpatialDataSupported:(nullable NSNumber<SDLBool> *)hapticSpatia
return [self.store sdl_objectForName:SDLRPCParameterNameHapticSpatialDataSupported ofClass:NSNumber.class error:nil];
}

- (void)setDiagonalScreenSize:(nullable NSNumber<SDLFloat> *)diagonalScreenSize {
[self.store sdl_setObject:diagonalScreenSize forName:SDLRPCParameterNameDiagonalScreenSize];
}

- (nullable NSNumber<SDLFloat> *)diagonalScreenSize {
return [self.store sdl_objectForName:SDLRPCParameterNameDiagonalScreenSize ofClass:NSNumber.class error:nil];
}

- (void)setPixelPerInch:(nullable NSNumber<SDLFloat> *)pixelPerInch {
[self.store sdl_setObject:pixelPerInch forName:SDLRPCParameterNamePixelPerInch];
}

- (nullable NSNumber<SDLFloat> *)pixelPerInch {
return [self.store sdl_objectForName:SDLRPCParameterNamePixelPerInch ofClass:NSNumber.class error:nil];
}

- (void)setScale:(nullable NSNumber<SDLFloat> *)scale {
[self.store sdl_setObject:scale forName:SDLRPCParameterNameScale];
}

- (nullable NSNumber<SDLFloat> *)scale {
NSNumber<SDLFloat> *scale = [self.store sdl_objectForName:SDLRPCParameterNameScale ofClass:NSNumber.class error:nil];
if (scale != nil) {
return scale;
}
return SDLVideoStreamingCapability.sdl_DefaultScale;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you are trying to do here, but a custom getter should not be created in this class. The SDL convention is for this to return the value set by Core. In the future we might need to know if scale is null or if it has been set by Core and we wouldn't be able to get this information with the current setup. I added another comment to the SDLStreamingVideoLifecycleManager with an idea of how to best reuse the code.

}

+ (NSNumber<SDLFloat> *)sdl_DefaultScale {
return @1.0;
}

@end

NS_ASSUME_NONNULL_END
Expand Up @@ -40,6 +40,7 @@
@interface SDLStreamingVideoLifecycleManager ()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests in this class are crashing due to the videoStreamingCapability not yet being set in the SDLCarWindow class. In the sdl_getScaledScreenSizeFrame of the SDLCarWindow class it is dividing by a scale of 0. This would be solved by setting a default scale value in the init of SDLCarWindow

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@property (copy, nonatomic, readonly) NSString *appName;
@property (copy, nonatomic, readonly) NSString *videoStreamBackgroundString;
@property (strong, nonatomic, readwrite) SDLVideoStreamingCapability *videoStreamingCapability;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should match what is in the class being tested (missing the nullable)

@property (nullable, strong, nonatomic, readwrite) SDLVideoStreamingCapability *videoStreamingCapability;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in (line 43):
lnafarrateluxoft@c8a9e5e

@end

QuickSpecBegin(SDLStreamingVideoLifecycleManagerSpec)
Expand Down Expand Up @@ -411,6 +412,14 @@ __block void (^sendNotificationForHMILevel)(SDLHMILevel hmiLevel, SDLVideoStream
});

describe(@"sending a video capabilities request", ^{
__block SDLImageResolution *resolution = [[SDLImageResolution alloc] initWithWidth:42 height:69];
__block int32_t maxBitrate = 12345;
__block NSArray<SDLVideoStreamingFormat *> *testFormats = @[[[SDLVideoStreamingFormat alloc] initWithCodec:SDLVideoStreamingCodecH265 protocol:SDLVideoStreamingProtocolRTMP], [[SDLVideoStreamingFormat alloc] initWithCodec:SDLVideoStreamingCodecH264 protocol:SDLVideoStreamingProtocolRTP]];
__block BOOL testHapticsSupported = YES;
__block float diagonalScreenSize = 22.0;
__block float pixelPerInch = 96.0;
__block float scale = 1.0;

beforeEach(^{
[streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamManagerStateStarting fromOldState:nil callEnterTransition:YES];
});
Expand Down Expand Up @@ -443,22 +452,13 @@ __block void (^sendNotificationForHMILevel)(SDLHMILevel hmiLevel, SDLVideoStream
});

context(@"and receiving a response", ^{
__block SDLImageResolution *resolution = nil;
__block int32_t maxBitrate = 0;
__block NSArray<SDLVideoStreamingFormat *> *testFormats = nil;
__block BOOL testHapticsSupported = NO;

beforeEach(^{
SDLGetSystemCapabilityResponse *response = [[SDLGetSystemCapabilityResponse alloc] init];
response.success = @YES;
response.systemCapability = [[SDLSystemCapability alloc] init];
response.systemCapability.systemCapabilityType = SDLSystemCapabilityTypeVideoStreaming;

resolution = [[SDLImageResolution alloc] initWithWidth:42 height:69];
maxBitrate = 12345;
testFormats = @[[[SDLVideoStreamingFormat alloc] initWithCodec:SDLVideoStreamingCodecH265 protocol:SDLVideoStreamingProtocolRTMP], [[SDLVideoStreamingFormat alloc] initWithCodec:SDLVideoStreamingCodecH264 protocol:SDLVideoStreamingProtocolRTP]];
testHapticsSupported = YES;
response.systemCapability.videoStreamingCapability = [[SDLVideoStreamingCapability alloc] initWithPreferredResolution:resolution maxBitrate:maxBitrate supportedFormats:testFormats hapticDataSupported:testHapticsSupported];

response.systemCapability.videoStreamingCapability = [[SDLVideoStreamingCapability alloc] initWithPreferredResolution:resolution maxBitrate:maxBitrate supportedFormats:testFormats hapticDataSupported:testHapticsSupported diagonalScreenSize:diagonalScreenSize pixelPerInch:pixelPerInch scale:scale];
[testConnectionManager respondToLastRequestWithResponse:response];
});

Expand All @@ -485,6 +485,12 @@ __block void (^sendNotificationForHMILevel)(SDLHMILevel hmiLevel, SDLVideoStream
expect(preferredResolution.resolutionHeight).to(equal(@69));
expect(preferredResolution.resolutionWidth).to(equal(@42));
});

it(@"should have correct video streaming capability values", ^{
expect(streamingLifecycleManager.videoStreamingCapability.diagonalScreenSize).to(equal(22.0));
expect(streamingLifecycleManager.videoStreamingCapability.pixelPerInch).to(equal(96.0));
expect(streamingLifecycleManager.videoStreamingCapability.scale).to(equal(1.0));
});
});
});
});
Expand All @@ -507,6 +513,8 @@ __block void (^sendNotificationForHMILevel)(SDLHMILevel hmiLevel, SDLVideoStream
testVideoHeader.frameData = SDLFrameInfoStartServiceACK;
testVideoHeader.encrypted = YES;
testVideoHeader.serviceType = SDLServiceTypeVideo;

streamingLifecycleManager.videoStreamingCapability = [[SDLVideoStreamingCapability alloc] initWithPreferredResolution:resolution maxBitrate:maxBitrate supportedFormats:testFormats hapticDataSupported:testHapticsSupported diagonalScreenSize:diagonalScreenSize pixelPerInch:pixelPerInch scale:scale];
});

context(@"with data", ^{
Expand Down