added support for different resolutions and frame rates

This commit is contained in:
Diego Waxemberg
2014-10-20 20:54:03 -04:00
parent 85ee4f6518
commit 4c646e36c7
9 changed files with 75 additions and 39 deletions
+10 -15
View File
@@ -11,44 +11,39 @@
#import "HttpManager.h"
#import "Utils.h"
#import "Connection.h"
#import "StreamConfiguration.h"
@implementation StreamManager {
NSString* _host;
StreamConfiguration* _config;
UIView* _renderView;
}
- (id) initWithHost:(NSString*)host renderView:(UIView*)view {
- (id) initWithConfig:(StreamConfiguration*)config renderView:(UIView*)view {
self = [super init];
_host = host;
_config = config;
_renderView = view;
return self;
}
- (void)main {
[CryptoManager generateKeyPairUsingSSl];
NSString* uniqueId = [CryptoManager getUniqueID];
NSData* cert = [CryptoManager readCertFromFile];
HttpManager* hMan = [[HttpManager alloc] initWithHost:_host uniqueId:uniqueId deviceName:@"roth" cert:cert];
HttpManager* hMan = [[HttpManager alloc] initWithHost:_config.host uniqueId:uniqueId deviceName:@"roth" cert:cert];
NSData* riKey = [Utils randomBytes:16];
int riKeyId = arc4random();
NSData* launchResp = [hMan executeRequestSynchronously:[hMan newLaunchRequest:@"67339056" width:1920 height:1080 refreshRate:30 rikey:[Utils bytesToHex:riKey] rikeyid:riKeyId]];
NSData* launchResp = [hMan executeRequestSynchronously:[hMan newLaunchRequest:@"67339056" width:_config.width height:_config.height refreshRate:_config.frameRate rikey:[Utils bytesToHex:riKey] rikeyid:riKeyId]];
[HttpManager getStringFromXML:launchResp tag:@"gamesession"];
VideoDecoderRenderer* renderer = [[VideoDecoderRenderer alloc]initWithView:_renderView];
StreamConfiguration* config = [[StreamConfiguration alloc] init];
config.host = [Utils resolveHost:_host];
config.width = 1920;
config.height = 1080;
config.frameRate = 30;
config.bitRate = 10000;
config.riKey = riKey;
config.riKeyId = riKeyId;
_config.bitRate = 10000;
_config.riKey = riKey;
_config.riKeyId = riKeyId;
Connection* conn = [[Connection alloc] initWithConfig:config renderer:renderer];
Connection* conn = [[Connection alloc] initWithConfig:_config renderer:renderer];
NSOperationQueue* opQueue = [[NSOperationQueue alloc] init];
[opQueue addOperation:conn];