ios9 - m4a audio files not playing on iOS 9 -
i have audio related app has multichannel mixer play m4a files @ time. i'm using audiotoolbox framework stream audio, on ios9 framework throws me exception in mixer rendering callback streaming audio files.
interestingly apps compiled ios9 sdk continue stream same file on ios7/8 devices, not ios9. can't figure out if apple broke in ios9, or have files encoded wrong on our end, play fine on both ios 7/8 not 9.
exception:
malloc: *** error object 0x7fac74056e08: incorrect checksum freed object - object modified after being freed. *** set breakpoint in malloc_error_break debug
it works other formats not give exception or kind of memory errors not work m4a format surprising.
here code load files works wav,aif etc formats not m4a:
- (void)loadfiles{ avaudioformat *clientformat = [[avaudioformat alloc] initwithcommonformat:avaudiopcmformatfloat32 samplerate:kgraphsamplerate channels:1 interleaved:no]; (int = 0; < numfiles && < maxbufs; i++) { extaudiofileref xafref = 0; // open 1 of 2 source files osstatus result = extaudiofileopenurl(sourceurl[i], &xafref); if (result || !xafref) {break; } // file data format, represents file's actual data format audiostreambasicdescription fileformat; uint32 propsize = sizeof(fileformat); result = extaudiofilegetproperty(xafref, kextaudiofileproperty_filedataformat, &propsize, &fileformat); if (result) { break; } // set client format - format want extaudiofile , corresponds format // providing input callback of mixer, therefore data type must same double rateratio = kgraphsamplerate / fileformat.msamplerate; propsize = sizeof(audiostreambasicdescription); result = extaudiofilesetproperty(xafref, kextaudiofileproperty_clientdataformat, propsize, clientformat.streamdescription); if (result) { break; } // file's length in sample frames uint64 numframes = 0; propsize = sizeof(numframes); result = extaudiofilegetproperty(xafref, kextaudiofileproperty_filelengthframes, &propsize, &numframes); if (result) { break; } if(i==metronomebusindex) numframes = (numframes+6484)*4; //numframes = (numframes * rateratio); // account sample rate conversion numframes *= rateratio; // set our buffer msoundbuffer[i].numframes = (uint32)numframes; msoundbuffer[i].asbd = *(clientformat.streamdescription); uint32 samples = (uint32)numframes * msoundbuffer[i].asbd.mchannelsperframe; msoundbuffer[i].data = (float32 *)calloc(samples, sizeof(float32)); msoundbuffer[i].samplenum = 0; // set audiobufferlist read data audiobufferlist buflist; buflist.mnumberbuffers = 1; buflist.mbuffers[0].mnumberchannels = 1; buflist.mbuffers[0].mdata = msoundbuffer[i].data; buflist.mbuffers[0].mdatabytesize = samples * sizeof(float32); // perform synchronous sequential read of audio data out of file our allocated data buffer uint32 numpackets = (uint32)numframes; result = extaudiofileread(xafref, &numpackets, &buflist); if (result) { free(msoundbuffer[i].data); msoundbuffer[i].data = 0; } // close file , dispose extaudiofileref extaudiofiledispose(xafref); } // [clientformat release]; }
if point me in right direction, how go debugging issue? need re-encode our files in specific way?
i tried on ios 9.1.beta3 yesterday , things seem normal.
try out. let know if works out too.
Comments
Post a Comment