Add an additional check on the number of audio channels.
This commit is contained in:
1 parent
5ed79ebe39
commit
bb12555844
3 files changed
+12
-7
No files matched your search
@@ -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;
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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])
|
||||
|
||||
Reference in new issue
Block a user