From 3773e841d1e7b28bc8bf0b1db692818a639ee520 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 25 Oct 2015 13:28:24 -0700 Subject: [PATCH] Update common to support GFE 2.7 --- Limelight/Stream/Connection.m | 17 +++++++++++------ limelight-common-c | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Limelight/Stream/Connection.m b/Limelight/Stream/Connection.m index 5941dcd..3eff486 100644 --- a/Limelight/Stream/Connection.m +++ b/Limelight/Stream/Connection.m @@ -65,11 +65,16 @@ int DrSubmitDecodeUnit(PDECODE_UNIT decodeUnit) return [renderer submitDecodeBuffer:data length:decodeUnit->fullLength]; } -void ArInit(void) +void ArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig) { int err; - opusDecoder = opus_decoder_create(48000, 2, &err); + // We only support stereo for now + assert(audioConfiguration == AUDIO_CONFIGURATION_STEREO); + + opusDecoder = opus_decoder_create(opusConfig->sampleRate, + opusConfig->channelCount, + &err); audioLock = [[NSLock alloc] init]; @@ -77,9 +82,9 @@ void ArInit(void) NSError *audioSessionError = nil; AVAudioSession* audioSession = [AVAudioSession sharedInstance]; - [audioSession setPreferredSampleRate:48000.0 error:&audioSessionError]; + [audioSession setPreferredSampleRate:opusConfig->sampleRate error:&audioSessionError]; [audioSession setCategory: AVAudioSessionCategoryPlayback error: &audioSessionError]; - [audioSession setPreferredOutputNumberOfChannels:2 error:&audioSessionError]; + [audioSession setPreferredOutputNumberOfChannels:opusConfig->channelCount error:&audioSessionError]; [audioSession setPreferredIOBufferDuration:0.005 error:&audioSessionError]; [audioSession setActive: YES error: &audioSessionError]; @@ -99,11 +104,11 @@ void ArInit(void) } AudioStreamBasicDescription audioFormat = {0}; - audioFormat.mSampleRate = 48000; + audioFormat.mSampleRate = opusConfig->sampleRate; audioFormat.mBitsPerChannel = 16; audioFormat.mFormatID = kAudioFormatLinearPCM; audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; - audioFormat.mChannelsPerFrame = 2; + audioFormat.mChannelsPerFrame = opusConfig->channelCount; audioFormat.mBytesPerFrame = audioFormat.mChannelsPerFrame * (audioFormat.mBitsPerChannel / 8); audioFormat.mBytesPerPacket = audioFormat.mBytesPerFrame; audioFormat.mFramesPerPacket = audioFormat.mBytesPerPacket / audioFormat.mBytesPerFrame; diff --git a/limelight-common-c b/limelight-common-c index 1b3b57e..b1f861c 160000 --- a/limelight-common-c +++ b/limelight-common-c @@ -1 +1 @@ -Subproject commit 1b3b57ed2fc0bafd3545d26a9bce9198049e2a1d +Subproject commit b1f861ccfdde1391f18becb67c64836658800a0b