How to destroy the pjsua player?

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

 



Hello,
   Guys, in recent days,I was plagued with a problem about pjsua player.
 Details is like this: When Client ? make a call to Client ?.
 ? will call function pjsua_call_answer() in on_incoming_call() 
 (NOTICE: At this time, Client ?'s CPU usage is 5%-10% by taskmgr.exe in WinXP). 
 Then, ? sends a request to ? with pjsua_call_send_im(). 
 At the same time, ? receives the request from ? in on_pager() and plays the wavefile.wav to ?.
 Related source codes as following:
  
 typedef struct
 {
     pjsua_conf_port_id call_port;
     pjsua_conf_port_id player_port;
     pjsua_player_id player_id;
 }ClientInfo;
 ClientInfo g_ClientInfo;    //global variable
  
 //-----------source code in on_pager()
 pjsua_player_id  player_id;
pjsua_conf_port_id  player_port;
pjmedia_port  *port;
  
 pjsua_player_create(&pj_str("wavefile.wav"), PJMEDIA_FILE_NO_LOOP, &player_id);
 player_port = pjsua_player_get_conf_port(player_id);
 pjsua_player_get_port(player_id, &port);
  
 g_ClientInfo.call_port = incoming_call_port;
 g_ClientInfo.player_port = player_port;
 g_ClientInfo.player_id = player_id;
  
 pjmedia_wav_player_set_eof_cb(port, NULL, &on_playfile_done);
 pjsua_player_set_pos(player_id, 0);
 pjsua_conf_connect(player_port, incoming_call_port);
 //source code on_ pager() end
  
 //-----------source code in on_playfile_done()
 pj_status_t on_playfile_done(pjmedia_port *port, void *usr_data)
{
     PJ_UNUSED_ARG(port);
     PJ_UNUSED_ARG(usr_data);
  
     pj_status_t status;
     status = pjsua_conf_disconnect(g_ClientInfo.player_port, g_ClientInfo.call_port);
     status = pjsua_player_destroy(g_Clientinfo.player_id);
     return status;
}
 //source code in on_playfile_done() end
  
 I can hear the wavefile.wav in Client ?, but when destroy the player with pjsua_player_destroy(),
 the Client ?'s CPU usage is up to 20%-30%, unless you hangup the call.
 So, my problem is: How to destroy the player to release all resource?
 How to make the CPU usage returns to the normal rate, that is 5%-10%?
 By the way, we need the call works normally during the communication.
 PS, my working environment is Windows XP, Visual Studio 2008 and PJSIP 1.8.5
  
 I am looking forward to your reply and thanks.
  
 ---------------------------------------------------- 
 Regards, Tonio 
 E-mail?eastern.silence at foxmail.com</:SIGN>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20101229/d9958b7e/attachment-0001.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