Skip to content

Commit

Permalink
Issue durfu#3: Audio does not play
Browse files Browse the repository at this point in the history
Update with SEB-Appstore settings to have sound in application
  • Loading branch information
David Drugeon-Hamon committed Mar 25, 2015
1 parent 5259b2b commit 10377c2
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions DFURTSPPlayer/DFURTSPPlayer/FFMpegDecoder/AudioStreamer.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ void audioQueueIsRunningCallback(void *inClientData, AudioQueueRef inAQ,
void audioQueueOutputCallback(void *inClientData, AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer) {

AudioStreamer *audioController = (AudioStreamer*)inClientData;
AudioStreamer *audioController = (__bridge AudioStreamer*)inClientData;
[audioController audioQueueOutputCallback:inAQ inBuffer:inBuffer];
}

void audioQueueIsRunningCallback(void *inClientData, AudioQueueRef inAQ,
AudioQueuePropertyID inID) {

AudioStreamer *audioController = (AudioStreamer*)inClientData;
AudioStreamer *audioController = (__bridge AudioStreamer*)inClientData;
[audioController audioQueueIsRunningCallback];
}

Expand All @@ -41,11 +41,6 @@ - (id)initWithStreamer:(RTSPPlayer*)streamer {
return self;
}

- (void)dealloc
{
[self removeAudioQueue];
[super dealloc];
}

- (IBAction)playAudio:(UIButton*)sender
{
Expand Down Expand Up @@ -96,7 +91,6 @@ - (BOOL)createAudioQueue

if (decodeLock_) {
[decodeLock_ unlock];
[decodeLock_ release];
decodeLock_ = nil;
}

Expand All @@ -121,11 +115,13 @@ - (BOOL)createAudioQueue
{
audioStreamBasicDesc_.mFormatID = kAudioFormatMPEG4AAC;
audioStreamBasicDesc_.mFormatFlags = kMPEG4Object_AAC_LC;
audioStreamBasicDesc_.mSampleRate = 44100;
audioStreamBasicDesc_.mChannelsPerFrame = 2;
audioStreamBasicDesc_.mSampleRate = _audioCodecContext->sample_rate;
audioStreamBasicDesc_.mChannelsPerFrame = _audioCodecContext->channels;
audioStreamBasicDesc_.mBitsPerChannel = 0;
audioStreamBasicDesc_.mFramesPerPacket = 1024;
audioStreamBasicDesc_.mFramesPerPacket =_audioCodecContext->frame_size;
audioStreamBasicDesc_.mBytesPerPacket = 0;
audioStreamBasicDesc_.mBytesPerFrame = _audioCodecContext->frame_bits;
audioStreamBasicDesc_.mReserved = 0;
NSLog(@"audio format %s (%d) is supported", _audioCodecContext->codec_descriptor->name, _audioCodecContext->codec_id);

break;
Expand Down Expand Up @@ -164,13 +160,13 @@ - (BOOL)createAudioQueue
// audioStreamBasicDesc_.mBitsPerChannel = 0;
// }

OSStatus status = AudioQueueNewOutput(&audioStreamBasicDesc_, audioQueueOutputCallback, (void*)self, NULL, NULL, 0, &audioQueue_);
OSStatus status = AudioQueueNewOutput(&audioStreamBasicDesc_, audioQueueOutputCallback, (__bridge void*)self, NULL, NULL, 0, &audioQueue_);
if (status != noErr) {
NSLog(@"Could not create new output.");
return NO;
}

status = AudioQueueAddPropertyListener(audioQueue_, kAudioQueueProperty_IsRunning, audioQueueIsRunningCallback, (void*)self);
status = AudioQueueAddPropertyListener(audioQueue_, kAudioQueueProperty_IsRunning, audioQueueIsRunningCallback, (__bridge void*)self);
if (status != noErr) {
NSLog(@"Could not add propery listener. (kAudioQueueProperty_IsRunning)");
return NO;
Expand Down Expand Up @@ -203,7 +199,6 @@ - (void)removeAudioQueue

if (decodeLock_) {
[decodeLock_ unlock];
[decodeLock_ release];
decodeLock_ = nil;
}
}
Expand Down

0 comments on commit 10377c2

Please sign in to comment.