Updating uport and dport from within wav eof callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
in my app I am connecting a media_port from a sip media_session to a
null_port. When I need to play a file, I create a wav_player_port and set a
callback t be notified when the player reaches the EOF, so that I can
connect the port from the stream back to a null_port. But if I try do so
inside the callback, my app starts to misbehave (as if memory was
corrupted). It seems it is not possible to replace my uport and dport in the
master_port inside the callback.
The callback is this:

static pj_status_t on_wav_eof(pjmedia_port *port, void *usr_data){
        Call *call = (Call*)usr_data;
        pj_assert(pjmedia_master_port_stop(call->master_port) ==
PJ_SUCCESS);
        pj_assert(pjmedia_port_destroy(call->media_port) == PJ_SUCCESS);
        call->media_port = NULL;

        pjmedia_port *stream_port;
        pj_assert(pjmedia_session_get_port(call->med_session, 0,
&stream_port) == PJ_SUCCESS);

        pjmedia_port *media_port;
        pj_assert(pjmedia_null_port_create(call->inv->pool,
                                        stream_port->info.clock_rate,
                                        stream_port->info.channel_count,
                                        stream_port->info.samples_per_frame,
                                        stream_port->info.bits_per_sample,
                                        &media_port) == PJ_SUCCESS);

        pj_assert(pjmedia_master_port_set_uport(call->master_port,
                                                stream_port) == PJ_SUCCESS);

        pj_assert(pjmedia_master_port_set_dport(call->master_port,
                                                media_port) == PJ_SUCCESS);

        pj_assert(pjmedia_master_port_start(call->master_port) ==
PJ_SUCCESS);

        return !PJ_SUCCESS;
}

I can see the app will not misbehave if I move the code that sets the
uport/dport and restarts the master_port out of the callback (called later).
Is this a shortcoming of the implementation or am I doing something wrong?

regards,
mayama
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090110/75710651/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux