summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-08-10 10:21:24 -0400
committerJoel Fischer <joeljfischer@gmail.com>2017-08-10 10:23:34 -0400
commit36f4db82a593b93d95854051af5475d32f360d70 (patch)
tree79cebe59a85b2da7093fc0071dd6d698e901f591
parentf0a1ef16e20b4dce4c906e499eafa45e515fbb00 (diff)
downloadsdl_ios-36f4db82a593b93d95854051af5475d32f360d70.tar.gz
Block devs from sending anything other than H264 RAW through the SMM
-rw-r--r--SmartDeviceLink/SDLStreamingMediaManager.h6
-rw-r--r--SmartDeviceLink/SDLStreamingMediaManager.m7
2 files changed, 7 insertions, 6 deletions
diff --git a/SmartDeviceLink/SDLStreamingMediaManager.h b/SmartDeviceLink/SDLStreamingMediaManager.h
index 8bbde367a..214c32c55 100644
--- a/SmartDeviceLink/SDLStreamingMediaManager.h
+++ b/SmartDeviceLink/SDLStreamingMediaManager.h
@@ -110,17 +110,15 @@ typedef void (^SDLStreamingEncryptionStartBlock)(BOOL success, BOOL encryption,
- (void)startVideoSessionWithStartBlock:(SDLStreamingStartBlock)startBlock;
/**
- This method will attempt to start a streaming video session. It will set up iOS's video encoder, and call out to the head unit asking if it will start a video session. This will not use encryption. To get proper values for height, width, protocol, and codec, call GetSystemCapabilities. If the remote system does not support GetSystemCapabilities, then call `startVideoSessionWithStartBlock:` instead.
+ This method will attempt to start a streaming video session. It will set up iOS's video encoder, and call out to the head unit asking if it will start a video session. This will not use encryption. To get proper values for height and width. If the remote system does not support GetSystemCapabilities, then call `startVideoSessionWithStartBlock:` instead.
@warning If this method is called on an 8.0 device, it will assert (in debug), or return a failure immediately to your block (in release).
@param height The height requested to be used
@param width The width requested to be used
- @param protocol The protocol requested to be used
- @param codec The codec requested to be used
@param startBlock A block that will be called with the result of attempting to start a video session
*/
-- (void)startVideoSessionWithHeight:(int32_t)height width:(int32_t)width protocol:(nullable SDLVideoStreamingProtocol *)protocol codec:(nullable SDLVideoStreamingCodec *)codec startBlock:(SDLStreamingStartBlock)startBlock;
+- (void)startVideoSessionWithHeight:(int32_t)height width:(int32_t)width startBlock:(SDLStreamingStartBlock)startBlock;
/**
* Start a video session either with with no encryption (the default), with authentication but no encryption (this will attempt a TLS authentication with the other side, but will not physically encrypt the data after that), or authentication and encryption, which will encrypt all video data being sent.
diff --git a/SmartDeviceLink/SDLStreamingMediaManager.m b/SmartDeviceLink/SDLStreamingMediaManager.m
index 3831b036d..b53621801 100644
--- a/SmartDeviceLink/SDLStreamingMediaManager.m
+++ b/SmartDeviceLink/SDLStreamingMediaManager.m
@@ -22,6 +22,8 @@
#import "SDLProtocolMessage.h"
#import "SDLScreenParams.h"
#import "SDLTouchManager.h"
+#import "SDLVideoStreamingCodec.h"
+#import "SDLVideoStreamingProtocol.h"
NSString *const SDLErrorDomainStreamingMediaVideo = @"com.sdl.streamingmediamanager.video";
@@ -132,7 +134,7 @@ NS_ASSUME_NONNULL_BEGIN
[self startVideoSessionWithTLS:encryptionFlag height:SDLControlFrameInt32NotFound width:SDLControlFrameInt32NotFound protocol:nil codec:nil startBlock:startBlock];
}
-- (void)startVideoSessionWithTLS:(SDLEncryptionFlag)encryptionFlag height:(int32_t)height width:(int32_t)width protocol:(nullable SDLVideoStreamingProtocol *)protocol codec:(nullable SDLVideoStreamingCodec *)codec startBlock:(SDLStreamingEncryptionStartBlock)startBlock {
+- (void)startVideoSessionWithTLS:(SDLEncryptionFlag)encryptionFlag height:(int32_t)height width:(int32_t)width startBlock:(SDLStreamingEncryptionStartBlock)startBlock {
if (SDL_SYSTEM_VERSION_LESS_THAN(@"8.0")) {
NSAssert(NO, @"SDL Video Sessions can only be run on iOS 8+ devices");
startBlock(NO, NO, [NSError errorWithDomain:SDLErrorDomainStreamingMediaVideo code:SDLStreamingVideoErrorInvalidOperatingSystemVersion userInfo:nil]);
@@ -143,7 +145,8 @@ NS_ASSUME_NONNULL_BEGIN
self.videoStartBlock = [startBlock copy];
self.videoSessionEncrypted = (encryptionFlag == SDLEncryptionFlagAuthenticateAndEncrypt ? YES : NO);
- SDLControlFramePayloadVideoStartService *payload = [[SDLControlFramePayloadVideoStartService alloc] initWithVideoHeight:height width:width protocol:protocol codec:codec];
+ // H264 RAW is the only currently supported SMM format, so we will use hardcode that in to make sure that future Core's that may have different defaults still use our default.
+ SDLControlFramePayloadVideoStartService *payload = [[SDLControlFramePayloadVideoStartService alloc] initWithVideoHeight:height width:width protocol:[SDLVideoStreamingProtocol RAW] codec:[SDLVideoStreamingCodec H264]];
if (encryptionFlag != SDLEncryptionFlagNone) {
__weak typeof(self) weakSelf = self;
[self.protocol startSecureServiceWithType:SDLServiceType_Video payload:payload.data completionHandler:^(BOOL success, NSError *error) {