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];
|
inputChannelsCount = [track sourceChannels];
|
||||||
outputChannelCount = [track channels];
|
outputChannelCount = [track channels];
|
||||||
|
|
||||||
|
if (inputChannelsCount == 0 || outputChannelCount == 0 || sampleRate == 0) {
|
||||||
|
[self release];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
if (outputChannelCount > inputChannelsCount)
|
if (outputChannelCount > inputChannelsCount)
|
||||||
outputChannelCount = inputChannelsCount;
|
outputChannelCount = inputChannelsCount;
|
||||||
|
|
||||||
@@ -629,8 +634,8 @@ OSStatus DecoderDataProc(AudioConverterRef inAudioConverter,
|
|||||||
_inputSamplesBuffer = [[MP42Fifo alloc] init];
|
_inputSamplesBuffer = [[MP42Fifo alloc] init];
|
||||||
|
|
||||||
// Decoder initialization
|
// Decoder initialization
|
||||||
CFDataRef magicCookie = NULL;
|
CFDataRef magicCookie = NULL;
|
||||||
NSData * srcMagicCookie = [track.muxer_helper->importer magicCookieForTrack:track];
|
NSData *srcMagicCookie = [track.muxer_helper->importer magicCookieForTrack:track];
|
||||||
AudioStreamBasicDescription inputFormat, outputFormat;
|
AudioStreamBasicDescription inputFormat, outputFormat;
|
||||||
|
|
||||||
bzero( &inputFormat, sizeof( AudioStreamBasicDescription ) );
|
bzero( &inputFormat, sizeof( AudioStreamBasicDescription ) );
|
||||||
@@ -750,14 +755,14 @@ OSStatus DecoderDataProc(AudioConverterRef inAudioConverter,
|
|||||||
UInt32 size = sizeof(inputFormat);
|
UInt32 size = sizeof(inputFormat);
|
||||||
err = AudioConverterGetProperty( decoderData.converter, kAudioConverterCurrentInputStreamDescription,
|
err = AudioConverterGetProperty( decoderData.converter, kAudioConverterCurrentInputStreamDescription,
|
||||||
&size, &inputFormat);
|
&size, &inputFormat);
|
||||||
if( err != noErr)
|
if (err != noErr)
|
||||||
NSLog(@"Boom kAudioConverterCurrentInputStreamDescription %ld",(long)err);
|
NSLog(@"Boom kAudioConverterCurrentInputStreamDescription %ld",(long)err);
|
||||||
|
|
||||||
// Read the complete outputStreamDescription from the audio converter.
|
// Read the complete outputStreamDescription from the audio converter.
|
||||||
size = sizeof(outputFormat);
|
size = sizeof(outputFormat);
|
||||||
err = AudioConverterGetProperty(decoderData.converter, kAudioConverterCurrentOutputStreamDescription,
|
err = AudioConverterGetProperty(decoderData.converter, kAudioConverterCurrentOutputStreamDescription,
|
||||||
&size, &outputFormat);
|
&size, &outputFormat);
|
||||||
if( err != noErr)
|
if (err != noErr)
|
||||||
NSLog(@"Boom kAudioConverterCurrentOutputStreamDescription %ld",(long)err);
|
NSLog(@"Boom kAudioConverterCurrentOutputStreamDescription %ld",(long)err);
|
||||||
|
|
||||||
decoderData.inputFormat = inputFormat;
|
decoderData.inputFormat = inputFormat;
|
||||||
|
|||||||
+2
-2
@@ -50,8 +50,8 @@
|
|||||||
|
|
||||||
for (MP42Track *track in _workingTracks) {
|
for (MP42Track *track in _workingTracks) {
|
||||||
MP4TrackId dstTrackId = 0;
|
MP4TrackId dstTrackId = 0;
|
||||||
NSData *magicCookie;
|
NSData *magicCookie = nil;;
|
||||||
NSInteger timeScale;
|
NSInteger timeScale = 0;
|
||||||
muxer_helper *helper = track.muxer_helper;
|
muxer_helper *helper = track.muxer_helper;
|
||||||
|
|
||||||
if (helper) {
|
if (helper) {
|
||||||
|
|||||||
+1
-1
@@ -346,7 +346,7 @@
|
|||||||
|
|
||||||
- (MP42SampleBuffer *)copyNextSample {
|
- (MP42SampleBuffer *)copyNextSample {
|
||||||
MP42SampleBuffer *sample = nil;
|
MP42SampleBuffer *sample = nil;
|
||||||
muxer_helper * helper = (muxer_helper *)_helper;
|
muxer_helper *helper = (muxer_helper *)_helper;
|
||||||
|
|
||||||
if (helper->converter) {
|
if (helper->converter) {
|
||||||
if ([helper->importer done])
|
if ([helper->importer done])
|
||||||
|
|||||||
Reference in new issue
Block a user