diff --git a/Limelight/Stream/Connection.m b/Limelight/Stream/Connection.m index 88b64ba..1e7d4d8 100644 --- a/Limelight/Stream/Connection.m +++ b/Limelight/Stream/Connection.m @@ -15,7 +15,7 @@ #include "opus.h" @implementation Connection { - IP_ADDRESS _host; + char* _host; STREAM_CONFIGURATION _streamConfig; CONNECTION_LISTENER_CALLBACKS _clCallbacks; DECODER_RENDERER_CALLBACKS _drCallbacks; @@ -137,16 +137,26 @@ void ArInit(void) if (status) { Log(LOG_E, @"Unable to initialize audioUnit: %d", (int32_t)status); } + + status = AudioOutputUnitStart(audioUnit); + if (status) { + Log(LOG_E, @"Unable to start audioUnit: %d", (int32_t)status); + } } -void ArRelease(void) +void ArCleanup(void) { if (opusDecoder != NULL) { opus_decoder_destroy(opusDecoder); opusDecoder = NULL; } - OSStatus status = AudioUnitUninitialize(audioUnit); + OSStatus status = AudioOutputUnitStop(audioUnit); + if (status) { + Log(LOG_E, @"Unable to stop audioUnit: %d", (int32_t)status); + } + + status = AudioUnitUninitialize(audioUnit); if (status) { Log(LOG_E, @"Unable to uninitialize audioUnit: %d", (int32_t)status); } @@ -166,22 +176,6 @@ void ArRelease(void) } } -void ArStart(void) -{ - OSStatus status = AudioOutputUnitStart(audioUnit); - if (status) { - Log(LOG_E, @"Unable to start audioUnit: %d", (int32_t)status); - } -} - -void ArStop(void) -{ - OSStatus status = AudioOutputUnitStop(audioUnit); - if (status) { - Log(LOG_E, @"Unable to stop audioUnit: %d", (int32_t)status); - } -} - void ArDecodeAndPlaySample(char* sampleData, int sampleLength) { int decodedLength = opus_decode(opusDecoder, (unsigned char*)sampleData, sampleLength, decodedPcmBuffer, PCM_BUFFER_SIZE / 2, 0); @@ -282,7 +276,7 @@ void ClDisplayTransientMessage(char* message) -(id) initWithConfig:(StreamConfiguration*)config renderer:(VideoDecoderRenderer*)myRenderer connectionCallbacks:(id)callbacks serverMajorVersion:(int)serverMajorVersion { self = [super init]; - _host = config.hostAddr; + _host = [config.host cStringUsingEncoding:NSUTF8StringEncoding]; renderer = myRenderer; _callbacks = callbacks; _serverMajorVersion = serverMajorVersion; @@ -299,16 +293,11 @@ void ClDisplayTransientMessage(char* message) int riKeyId = htonl(config.riKeyId); memcpy(_streamConfig.remoteInputAesIv, &riKeyId, sizeof(riKeyId)); - _drCallbacks.setup = NULL; - _drCallbacks.start = NULL; - _drCallbacks.stop = NULL; - _drCallbacks.release = NULL; + memset(&_drCallbacks, 0, sizeof(_drCallbacks)); _drCallbacks.submitDecodeUnit = DrSubmitDecodeUnit; _arCallbacks.init = ArInit; - _arCallbacks.start = ArStart; - _arCallbacks.stop = ArStop; - _arCallbacks.release = ArRelease; + _arCallbacks.cleanup = ArCleanup; _arCallbacks.decodeAndPlaySample = ArDecodeAndPlaySample; _clCallbacks.stageStarting = ClStageStarting; diff --git a/Limelight/Stream/StreamConfiguration.h b/Limelight/Stream/StreamConfiguration.h index 2244a3c..91d2326 100644 --- a/Limelight/Stream/StreamConfiguration.h +++ b/Limelight/Stream/StreamConfiguration.h @@ -12,7 +12,6 @@ @property NSString* host; @property NSString* appID; -@property int hostAddr; @property int width; @property int height; @property int frameRate; diff --git a/Limelight/Stream/StreamConfiguration.m b/Limelight/Stream/StreamConfiguration.m index 4ebacf1..e463739 100644 --- a/Limelight/Stream/StreamConfiguration.m +++ b/Limelight/Stream/StreamConfiguration.m @@ -9,5 +9,5 @@ #import "StreamConfiguration.h" @implementation StreamConfiguration -@synthesize host, appID, hostAddr, width, height, frameRate, bitRate, riKeyId, riKey; +@synthesize host, appID, width, height, frameRate, bitRate, riKeyId, riKey; @end diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m index 85324c0..102ec03 100644 --- a/Limelight/ViewControllers/MainFrameViewController.m +++ b/Limelight/ViewControllers/MainFrameViewController.m @@ -226,12 +226,7 @@ static NSArray* appList; Log(LOG_D, @"Clicked app: %@", app.appName); _streamConfig = [[StreamConfiguration alloc] init]; _streamConfig.host = _selectedHost.address; - _streamConfig.hostAddr = [Utils resolveHost:_selectedHost.address]; _streamConfig.appID = app.appId; - if (_streamConfig.hostAddr == 0) { - [self displayDnsFailedDialog]; - return; - } DataManager* dataMan = [[DataManager alloc] init]; Settings* streamSettings = [dataMan retrieveSettings]; diff --git a/limelight-common-c b/limelight-common-c index 43e6d35..789eac8 160000 --- a/limelight-common-c +++ b/limelight-common-c @@ -1 +1 @@ -Subproject commit 43e6d35b8f36c9915ad5b5779d9850e03f113393 +Subproject commit 789eac8e6ab2358d8e92046036ab03a47d3cb287