wav_player.c calls EOF callback twice

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

 



I'm using a local build sipek sdk and pjsip trunks. I noticed in the log the
wav player calls the EOF callback twice. In the second call, the free(args)
fails. Any thoughts?

Log:

 01:13:36.849 pjsipDll_playW  Wav Play, status 0
 01:13:36.922   strm06B1F80C  Start talksprut..
 01:13:45.029   strm06B1F80C  Starting silence
 01:13:45.429   strm06B1F80C  Start talksprut..
 01:13:45.433   strm06B1F80C  Starting silence
 01:13:45.629   wav_player.c  File port
D:\Projects\WindowsFormsApplication1\bin\Debug\0.wav EOF
 01:13:45.632 pjsipDll_playW  on_wavplayerEof_callback, media_port:
112313596
 01:13:45.633 pjsipDll_playW  End of Wav File, media_port: 112313596
 01:13:45.671   wav_player.c  File port
D:\Projects\WindowsFormsApplication1\bin\Debug\0.wav EOF
 01:13:45.672 pjsipDll_playW  on_wavplayerEof_callback, media_port:
112313596


EOF Code:

static PJ_DEF(pj_status_t) on_wavplayerEof_callback(pjmedia_port*
media_port, void* args)
{
       PJ_LOG(3,(THIS_FILE, "on_wavplayerEof_callback, media_port: %d",
media_port));
       pj_status_t status;
       wavplayerEof_Data* WavePlayerData = ((wavplayerEof_Data*) args);

       // Read info from args
       pjsua_call_id call_id = WavePlayerData->callId;
       pjsua_player_id player_id = WavePlayerData->playerId;

       //Destroy the Wav Player
       //status = pjsua_player_destroy(player_id);   // ! Problem if
Destroying Here : cash at the end of callback, for most of wavs files

       // Free the memory allocated for the args
       free(args);
       PJ_LOG(3,(THIS_FILE, "End of Wav File, media_port: %d", media_port));

       // Invoke the Callback for C# managed code
       if (cb_wavplayerEnded != 0)
               (*cb_wavplayerEnded)(call_id, player_id);

       if (status == PJ_SUCCESS)    // Player correctly Destroyed
               return -1;                      // Don't return PJ_SUCCESS,
to prevent crash when returning from callback after Player Destruction

       return PJ_SUCCESS;             // Else, return PJ_SUCCESS

}      //// -> goes back to the function wich has invoke the callback :
fill_buffer() in pjmedia\src\pjmedia\wav_player.c
       /////   CRASH HERE WITH MOST OF WAV FILES, if player has been
destroyed above ////
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20100308/ae1ec612/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