From 4d9cea0a3199f834da44931717a1830a06346a83 Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Wed, 20 Aug 2014 15:49:36 +0100 Subject: [PATCH] Fixed HE-AAC format being stripped --- ExampleApp/ExampleApp/AppDelegate.m | 3 ++- StreamingKit.podspec | 2 +- StreamingKit/StreamingKit/STKAudioPlayer.m | 13 ++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ExampleApp/ExampleApp/AppDelegate.m b/ExampleApp/ExampleApp/AppDelegate.m index 660dc46..c5c5d52 100644 --- a/ExampleApp/ExampleApp/AppDelegate.m +++ b/ExampleApp/ExampleApp/AppDelegate.m @@ -38,6 +38,7 @@ audioPlayer = [[STKAudioPlayer alloc] initWithOptions:(STKAudioPlayerOptions){ .flushQueueOnSeek = YES, .enableVolumeMixer = NO, .equalizerBandFrequencies = {50, 100, 200, 400, 800, 1600, 2600, 16000} }]; audioPlayer.meteringEnabled = YES; audioPlayer.volume = 1; + AudioPlayerView* audioPlayerView = [[AudioPlayerView alloc] initWithFrame:self.window.bounds andAudioPlayer:audioPlayer]; @@ -60,7 +61,7 @@ -(void) audioPlayerViewPlayFromHTTPSelected:(AudioPlayerView*)audioPlayerView { - NSURL* url = [NSURL URLWithString:@"http://www.abstractpath.com/files/audiosamples/sample.mp3"]; + NSURL* url = [NSURL URLWithString:@"file:///Users/tum/Temp/airplane-cut.aac"]; STKDataSource* dataSource = [STKAudioPlayer dataSourceFromURL:url]; diff --git a/StreamingKit.podspec b/StreamingKit.podspec index 577d4aa..510fd21 100644 --- a/StreamingKit.podspec +++ b/StreamingKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "StreamingKit" - s.version = "0.1.19" + s.version = "0.1.23" s.summary = "A fast and extensible audio streamer for iOS and OSX with support for gapless playback and custom (non-HTTP) sources." s.homepage = "https://github.com/tumtumtum/StreamingKit/" s.license = 'MIT' diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index 30ded81..6c39dc5 100644 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -805,7 +805,11 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn pthread_mutex_lock(&playerMutex); - entryToUpdate->audioStreamBasicDescription = newBasicDescription; + if (entryToUpdate->audioStreamBasicDescription.mFormatID == 0) + { + entryToUpdate->audioStreamBasicDescription = newBasicDescription; + } + entryToUpdate->sampleRate = entryToUpdate->audioStreamBasicDescription.mSampleRate; entryToUpdate->packetDuration = entryToUpdate->audioStreamBasicDescription.mFramesPerPacket / entryToUpdate->sampleRate; @@ -886,13 +890,8 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn if (pasbd.mFormatID == kAudioFormatMPEG4AAC_HE || pasbd.mFormatID == kAudioFormatMPEG4AAC_HE_V2) { - // - // We've found HE-AAC, remember this to tell the audio queue - // when we construct it. - // -#if !TARGET_IPHONE_SIMULATOR currentlyReadingEntry->audioStreamBasicDescription = pasbd; -#endif + break; } }