diff --git a/MP42/MP42AudioConverter.m b/MP42/MP42AudioConverter.m index fb7ed0d..80bdee0 100644 --- a/MP42/MP42AudioConverter.m +++ b/MP42/MP42AudioConverter.m @@ -597,6 +597,11 @@ OSStatus DecoderDataProc(AudioConverterRef inAudioConverter, inputChannelsCount = [track sourceChannels]; outputChannelCount = [track channels]; + if (inputChannelsCount == 0 || outputChannelCount == 0 || sampleRate == 0) { + [self release]; + return nil; + } + if (outputChannelCount > inputChannelsCount) outputChannelCount = inputChannelsCount; @@ -629,8 +634,8 @@ OSStatus DecoderDataProc(AudioConverterRef inAudioConverter, _inputSamplesBuffer = [[MP42Fifo alloc] init]; // Decoder initialization - CFDataRef magicCookie = NULL; - NSData * srcMagicCookie = [track.muxer_helper->importer magicCookieForTrack:track]; + CFDataRef magicCookie = NULL; + NSData *srcMagicCookie = [track.muxer_helper->importer magicCookieForTrack:track]; AudioStreamBasicDescription inputFormat, outputFormat; bzero( &inputFormat, sizeof( AudioStreamBasicDescription ) ); @@ -750,14 +755,14 @@ OSStatus DecoderDataProc(AudioConverterRef inAudioConverter, UInt32 size = sizeof(inputFormat); err = AudioConverterGetProperty( decoderData.converter, kAudioConverterCurrentInputStreamDescription, &size, &inputFormat); - if( err != noErr) + if (err != noErr) NSLog(@"Boom kAudioConverterCurrentInputStreamDescription %ld",(long)err); // Read the complete outputStreamDescription from the audio converter. size = sizeof(outputFormat); err = AudioConverterGetProperty(decoderData.converter, kAudioConverterCurrentOutputStreamDescription, &size, &outputFormat); - if( err != noErr) + if (err != noErr) NSLog(@"Boom kAudioConverterCurrentOutputStreamDescription %ld",(long)err); decoderData.inputFormat = inputFormat; diff --git a/MP42/MP42Muxer.m b/MP42/MP42Muxer.m index e0b55d5..e426a26 100644 --- a/MP42/MP42Muxer.m +++ b/MP42/MP42Muxer.m @@ -50,8 +50,8 @@ for (MP42Track *track in _workingTracks) { MP4TrackId dstTrackId = 0; - NSData *magicCookie; - NSInteger timeScale; + NSData *magicCookie = nil;; + NSInteger timeScale = 0; muxer_helper *helper = track.muxer_helper; if (helper) { diff --git a/MP42/MP42Track.m b/MP42/MP42Track.m index bee0462..7106bff 100644 --- a/MP42/MP42Track.m +++ b/MP42/MP42Track.m @@ -346,7 +346,7 @@ - (MP42SampleBuffer *)copyNextSample { MP42SampleBuffer *sample = nil; - muxer_helper * helper = (muxer_helper *)_helper; + muxer_helper *helper = (muxer_helper *)_helper; if (helper->converter) { if ([helper->importer done])