Use API 1.1 common in preparation for IPv6 requirement

This commit is contained in:
Cameron Gutman
2015-06-17 23:32:00 -07:00
parent 1223a9013f
commit a9a00629b1
5 changed files with 18 additions and 35 deletions

View File

@@ -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<ConnectionCallbacks>)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;

View File

@@ -12,7 +12,6 @@
@property NSString* host;
@property NSString* appID;
@property int hostAddr;
@property int width;
@property int height;
@property int frameRate;

View File

@@ -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

View File

@@ -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];