Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 应用程序启动时recordingCallback()间歇性崩溃_Ios_Callback_Core Audio_Openframeworks - Fatal编程技术网

Ios 应用程序启动时recordingCallback()间歇性崩溃

Ios 应用程序启动时recordingCallback()间歇性崩溃,ios,callback,core-audio,openframeworks,Ios,Callback,Core Audio,Openframeworks,我的iOS应用程序(使用openFrameworks)在上线时有30-40%的时间会崩溃: if(soundInputPtr!=NULL) soundInputPtr->audioIn(tempBuffer, ioData->mBuffers[i].mDataByteSize/2, 1); 在xiphonesoundstream.m的中的较大函数中 static OSStatus recordingCallback(void *inRefCon,

我的iOS应用程序(使用openFrameworks)在上线时有30-40%的时间会崩溃:

    if(soundInputPtr!=NULL) soundInputPtr->audioIn(tempBuffer, ioData->mBuffers[i].mDataByteSize/2, 1);
在xiphonesoundstream.m的
中的较大函数中

static OSStatus recordingCallback(void *inRefCon, 
                              AudioUnitRenderActionFlags *ioActionFlags, 
                              const AudioTimeStamp *inTimeStamp, 
                              UInt32 inBusNumber, 
                              UInt32 inNumberFrames, 
                                  AudioBufferList *ioData) {
我正在用SoundStreamSetup(0,1,this,44100256,4)的
进行音频设置
设置()中

在模拟器中,这种碰撞100%都会发生。你知道(a)发生了什么或(b)如何调试它吗

更新:堆栈跟踪:

Thread 11 AURemoteIO::IOThread, Queue : (null)

#0  0x00008ff2 in Gameplay::listen() at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/include/c++/4.2.1/bits/basic_string.h:238
#1  0x003178bc in recordingCallback(void*, unsigned long*, AudioTimeStamp const*, unsigned long, unsigned long, AudioBufferList*) at /Developer/of_007_iphone/libs/openFrameworks/sound/ofxiPhoneSoundStream.mm:143
#2  0x019447e4 in AUIOHelper::NotifyInputAvailable(AudioTimeStamp const&, unsigned long, AudioBufferList const&) ()
#3  0x0192baf1 in AURemoteIO::PerformIO(unsigned int, unsigned int, XAudioTimeStamp const&, XAudioTimeStamp const&, int&) ()
#4  0x0192bbc1 in AURIOCallbackReceiver_PerformIO ()
#5  0x0191b3bf in _XPerformIO ()
#6  0x01861c11 in mshMIGPerform ()
#7  0x018e4180 in MSHMIGDispatchMessage ()
#8  0x019297ba in AURemoteIO::IOThread::Run() ()
#9  0x0192e8e1 in AURemoteIO::IOThread::Entry(void*) ()
#10 0x01836972 in CAPThread::Entry(CAPThread*) ()
#11 0x97bf7259 in _pthread_start ()
#12 0x97bf70de in thread_start ()
然后
线程11 AURemoteIO::IOThread:程序收到信号:“EXC\u BAD\u ACCESS”

根据请求,
recordingCallback()


阅读堆栈跟踪并转到它告诉您的地方

在我的文件副本中,代码如下所示:

void
_M_dispose(常数分配和分配)
{
#ifndef\u GLIBCXX\u完全\u动态\u字符串
if(uuu builtin_uexpect(this!=&us_uempty_rep(),false))
#恩迪夫
如果(\uuuu gnu\u cxx::\uuuu exchange\u和\u add\u dispatch(&this->\u M\u refcount),

-1) 发布崩溃的输出。还请添加
Gameplay::listen
(我假设它是
soundInputPtr->audioIn
指向的函数;您可能需要使用
NSLog
验证这一点).EDIT:实际上,看看你的另一个问题,我看到
audioIn
似乎是其他地方的一种方法,因此
Gameplay::listen
崩溃是不同的(可能相关,可能无关)崩溃。添加了一个
!=NULL
检查指向音频缓冲区开始和结束的指针,然后再对其执行任何操作。这似乎解决了崩溃问题。您能帮助我理解stacktrace为什么将我指向
listen()<函数/代码>当函数未直接与崩溃有关时,@“狗”:是“代码>移动< /COD>一个ObjuleC对象,还是一个重载<代码>的C++对象。< /代码>运算符?如果没有,我不能看到它是如何添加到你的问题中的崩溃的一部分。从崩溃的版本来看?
move
只是一个结构,它包含
col
row
error
的值。发布的代码就是崩溃的代码,尽管据我所知,
EXC\u BAD\u ACCESS
有时会指向不相关的代码,因为指针的增量超出了它在rm,程序内存?@ickydog:
EXC_BAD_ACCESS
表示您试图访问不属于您的内存。有时表示您试图访问不属于您的内存。有时表示您试图跳出某个内存;有时表示该内存过去属于您,但随后您将其释放(例如,过度释放Cocoa对象);有时这意味着你重写了一个指针。从技术上讲,错误的代码可能会被牵连进来,但可能性非常小;你需要以一种方式粉碎堆栈,而不仅仅是留下调试器/崩溃报告程序无法理解的垃圾。
static OSStatus recordingCallback(void *inRefCon, 
                                  AudioUnitRenderActionFlags *ioActionFlags, 
                                  const AudioTimeStamp *inTimeStamp, 
                                  UInt32 inBusNumber, 
                                  UInt32 inNumberFrames, 
                                  AudioBufferList *ioData) {


    AudioBufferList list;

    // redundant
    list.mNumberBuffers = 1;
    list.mBuffers[0].mData = sampleBuffer;
    list.mBuffers[0].mDataByteSize = 2 * inNumberFrames;
    list.mBuffers[0].mNumberChannels = 1;

    ioData = &list;
    //printf("No buffers: %d, buffer length: %d bus number: %d\n", ioData->mNumberBuffers, ioData->mBuffers[0].mDataByteSize, inBusNumber);


    // Then:
    // Obtain recorded samples

    OSStatus status = AudioUnitRender(audioUnit, ioActionFlags, inTimeStamp, 1, inNumberFrames, ioData);
    checkStatus(status);
    if(status!=noErr) return status;
    if(ioData->mNumberBuffers>0) {
        int i = 0;
        short int *buffer = (short int *) list.mBuffers[i].mData;
        for(int j = 0; j < ioData->mBuffers[i].mDataByteSize/2; j++) {
            // go through each sample and turn it into a float
            tempBuffer[j] = (float)buffer[j]/32767.f;

        }
        done = true;


      // THIS LINE IS LINE 143
        if(soundInputPtr!=NULL) soundInputPtr->audioIn(tempBuffer, ioData->mBuffers[i].mDataByteSize/2, 1); 

    }
    return noErr;
}
void Gameplay::listen() {

  // track extremes for XML purpose
  if (pitchAvg > move.highestPitch) move.highestPitch = pitchAvg;
  if ((pitchAvg < move.lowestPitch) && pitchAvg != 0) move.lowestPitch = pitchAvg;
  if (ampAvg > move.loudestVol) move.loudestVol = ampAvg;
  if ((ampAvg < move.softestVol) && ampAvg > 0.15) move.softestVol = ampAvg;
}
#0  0x00008ff2 in Gameplay::listen() at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/include/c++/4.2.1/bits/basic_string.h:238
  void
  _M_dispose(const _Alloc& __a)
  {
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
    if (__builtin_expect(this != &_S_empty_rep(), false))
#endif
      if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
                             -1) <= 0)
        //Line 238:
        _M_destroy(__a);
  }  // XXX MT