Segfault when calling play_cb

CB
Christian Beer
Wed, Nov 7, 2007 1:18 AM

Hi List,

thanks a lot for the advices you gave regarding the pa_mac_core_old.
But I left that one and am now trying to use AudioQueue which is new
on Leopard. That one seems to be a very nice API.

Now I sadly have got an error as play_cb gets called when trying to
get playsine running with my new "device driver" für AudioQueue. I am
sure it is when calling play_cb but I don't have any debugger or
something.

So my question (as quite a newbie to C) is: What could that be? I
checked all parameters and all should be right (such as buffer size,
channel-count, etc.)

I got this code in the callback for the AudioQueue:

stream->timestamp += stream->frameCount;

    /* Get frame from application. */
    printf("size:%d\n", size);
    status = (*stream->play_cb)(stream->user_data,
                                stream->timestamp,
                                coreAudioBuffer,
                                size);
    printf("OK\n");
    if (status != PJ_SUCCESS) {
        return;
    }

and this output:

...
pjmedia_snd_stream_start(stream)
START ------>
start thread...
** RUN LOOP **
AFTER RUN LOOP!!
-- a
-- a
02:08:37.050      aqsound.c Recorder thread started
-- fc:882
-- b
size:1764
Playing sine wave..

Press <ENTER> to stop playing and quit
zsh: segmentation fault  ./playsine-arm-apple-darwin

As you can see the printf("size... is the last output.

Any help would be greatly appreciated!

Thanks in advance,
Christian

Hi List, thanks a lot for the advices you gave regarding the pa_mac_core_old. But I left that one and am now trying to use AudioQueue which is new on Leopard. That one seems to be a very nice API. Now I sadly have got an error as play_cb gets called when trying to get playsine running with my new "device driver" für AudioQueue. I am sure it is when calling play_cb but I don't have any debugger or something. So my question (as quite a newbie to C) is: What could that be? I checked all parameters and all should be right (such as buffer size, channel-count, etc.) I got this code in the callback for the AudioQueue: stream->timestamp += stream->frameCount; /* Get frame from application. */ printf("size:%d\n", size); status = (*stream->play_cb)(stream->user_data, stream->timestamp, coreAudioBuffer, size); printf("OK\n"); if (status != PJ_SUCCESS) { return; } and this output: ... pjmedia_snd_stream_start(stream) START ------> start thread... ** RUN LOOP ** AFTER RUN LOOP!! -- a -- a 02:08:37.050 aqsound.c Recorder thread started -- fc:882 -- b size:1764 Playing sine wave.. Press <ENTER> to stop playing and quit zsh: segmentation fault ./playsine-arm-apple-darwin As you can see the printf("size... is the last output. Any help would be greatly appreciated! Thanks in advance, Christian