linphone-users
[Top][All Lists]
Advanced

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

[Linphone-users] HELP: Both send session and recev session in one thread


From: jimmywei
Subject: [Linphone-users] HELP: Both send session and recev session in one thread, but send packet is not worked!
Date: Fri, 2 Mar 2012 12:32:56 +0000

Hi:
These days I used ortp to create a server that can receive rtp packets from source terminate and send these packets to destination terminated. Project enviroment is Visual studio 2010!
I created one thread, init 2 sessions in this thread. one is receive session using RTP_SESSION_RECONLY, the other is send session using RTP_ SESSION_SENDONLY. 2 sessions have a same port.
It seems rtp scheduler only wakeup receive session, but send session is never be waked up. In the normal station, when send session be waked up, __ortp_scheduler 's w_session bits will be set to (1<<1%32). but when I debuging, it's always clear to 0, after initializtion in first time. so 'tset' in session_set_select(rset,tset,NULL) is always be zero.
now i have no idea, please give me some advise, Thanks a lot.
The main select function is like below:
*******************************************
int RtpDataProcess(int port, char* dest_ip, int user_ts)
{
RtpSession *session[2];
SessionSet *rset;
SessionSet *tset;
int i=0;
//receive session
session[0]=rtp_session_new(RTP_SESSION_RECVONLY); 
rtp_session_set_scheduling_mode(session[0],1);
rtp_session_set_blocking_mode(session[0],0);
rtp_session_set_local_addr(session[0],"0.0.0.0",port);
rtp_session_set_payload_type(session[0],0);
rtp_session_enable_adaptive_jitter_compensation(session[0], TRUE);
//send session
session[1]=rtp_session_new(RTP_SESSION_SENDONLY); 
rtp_session_set_scheduling_mode(session[1],1);
rtp_session_set_blocking_mode(session[1],0);
rtp_session_set_remote_addr(session[1],"10.121.36.11",port);
rtp_session_set_payload_type(session[1],0);
rtp_session_enable_adaptive_jitter_compensation(session[1], TRUE);
rset = session_set_new();//receive set
tset = session_set_new();//send set
while(cond)
{
for(i=0;i<2;i++)
{
if(i==0)
{
session_set_set(rset,session[i]);
}
else
{
session_set_set(tset,session[i])
}
}
session_set_select(rset,tset,NULL);
for(i=0;i<2;i++)
{
if(i==0)
{
if(session_set_is_set(rset,session[i]))
{
//recv_rtp_data call funtion rtp_session_recv_with_ts ,and save the data into buffer queue rec_q
recv_rtp_data(session[i],user_ts,rec_q);
}
}
else
{
if(session_set_is_set(tset,session[i]))
{
//send_rtp_data call funtion rtp_session_send_with_ts ,and get the buffer from queue rec_q 
send_rtp_data(session[i],user_ts,rec_q);
}
}
}
user_ts+=160;
}
//other free action
return 0;
}

when I set breakpoint in function rtp_session_process , I found 'if (wait_point_check(&session->snd.wp,time))' always false.
void rtp_session_process (RtpSession * session, uint32_t time, RtpScheduler *sched)
{
wait_point_lock(&session->snd.wp);
if (wait_point_check(&session->snd.wp,time)){
session_set_set(&sched->w_sessions,session); ===„Äč never runned in
wait_point_wakeup(&session->snd.wp);
}
wait_point_unlock(&session->snd.wp);

wait_point_lock(&session->rcv.wp);
if (wait_point_check(&session->rcv.wp,time)){
session_set_set(&sched->r_sessions,session);
wait_point_wakeup(&session->rcv.wp);
}
wait_point_unlock(&session->rcv.wp);
}
Best regard!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]