Commit 39a80758 authored by jehan's avatar jehan

add t_process_on_schedule to modifiers

parent a88b60fa
......@@ -95,6 +95,7 @@ typedef struct _RtpTransportModifier
struct _RtpSession *session;//<back pointer to the owning session, set by oRTP
int (*t_process_on_send)(struct _RtpTransportModifier *t, mblk_t *msg);
int (*t_process_on_receive)(struct _RtpTransportModifier *t, mblk_t *msg);
void (*t_process_on_schedule)(struct _RtpTransportModifier *t); /*invoked each time rtp_session_recvm even is no message are available*/
/**
* Mandatory callback responsible of freeing the #RtpTransportModifierAND the pointer.
* @param[in] transport #RtpTransportModifier object to free.
......
......@@ -2114,31 +2114,36 @@ int meta_rtp_transport_recvfrom(RtpTransport *t, mblk_t *msg, int flags, struct
int ret,prev_ret;
MetaRtpTransportImpl *m = (MetaRtpTransportImpl*)t->data;
OList *elem=m->modifiers;
OList *last_elem=NULL;
if (!m->has_set_session){
meta_rtp_set_session(t->session,m);
}
if (elem!=NULL){
/*received packet must be treated in reversed order: first in last out*/
while (elem->next!=NULL) elem=elem->next;
}
if (m->endpoint!=NULL){
ret=m->endpoint->t_recvfrom(m->endpoint,msg,flags,from,fromlen);
}else{
ret=rtp_session_rtp_recv_abstract(m->is_rtp?t->session->rtp.gs.socket:t->session->rtcp.gs.socket,msg,flags,from,fromlen);
}
/*received packet must be treated in reversed order: first in last out
* ,take the opportunity of the schedule to go to the end of the list*/
for (;elem!=NULL;elem=o_list_next(elem)){
RtpTransportModifier *rtm=(RtpTransportModifier*)elem->data;
/*invoke on schedule on every modifier*/
if (rtm->t_process_on_schedule) rtm->t_process_on_schedule(rtm);
last_elem=elem;
}
if (ret < 0){
return ret;
}
prev_ret=ret;
msg->b_wptr+=ret;
for (;elem!=NULL;elem=o_list_prev(elem)){
RtpTransportModifier *rtm=(RtpTransportModifier*)elem->data;
for (;last_elem!=NULL;last_elem=o_list_prev(last_elem)){
RtpTransportModifier *rtm=(RtpTransportModifier*)last_elem->data;
ret = rtm->t_process_on_receive(rtm,msg);
if (ret<0){
// something went wrong in the modifier (failed to decrypt for instance)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment