Trying to answer myself.

 

I have put into comments 

 

" if (session->pending){ 
            mp=session->pending;
             session->pending=NULL;
   }else {
}

"
and left  

" mp=rtp_session_recvm_with_ts(session,ts);"

 

Althought this makes the invalid number to disappear now it does not sound any 
good. Is there any way to make sure that session->pending has a value before 
making an If?

 

Thanks


 


From: [email protected]
To: [email protected]
Date: Fri, 20 Aug 2010 17:35:53 +0000
Subject: [Linphone-users] catching the sequence number, inv




Hi all,
 
I am trying to catch the sequence number of the received packet. Since calling 
to "void rtp_session_get_seq_number(Rtpsession * session)" is not acurate 
enough i did my own receive function that looks like below. Bascially is a copy 
of rtp_session_recv_with_ts but added a sequence variable. When i run with 
Valgrind i have got the next error:
 
"Use of uninitialised value of size 4" in this function.
 
/*variables initialised before calling the function*/
RtpSession *session;
uint16_t cseq_tmp =0;
int have_more=1;
int len=160;
uint32_t ts=0;
if (!(buffer=malloc((payloadsize)*sizeof(short))))printf("malloc error for 
buffer\n");
....
 
/*the function where the error occurs*/
int my_rtp_session_recv_with_ts_v2 (uint16_t * cseq_tmp,RtpSession * session, 
uint8_t * buffer, int len, uint32_t ts, int * have_more){
mblk_t *mp=NULL;
int plen,blen=0;
*have_more=0;
rtp_header_t *hdr;
 
while(1){
   if (session->pending){ 
            mp=session->pending;
             session->pending=NULL;
   }else {
            mp=rtp_session_recvm_with_ts(session,ts);

    if (mp!=NULL) {
             hdr=(rtp_header_t*)mp->b_rptr;
             rtp_get_payload(mp,&mp->b_rptr);
      }
 }
if (mp){
           //hdr=(rtp_header_t*)mp->b_rptr;
           *cseq_tmp=hdr->seq_number;
          //if (DEBUG)printf("csq%d",*cseq_tmp);
           plen=mp->b_wptr-mp->b_rptr;
 if (plen<=len){
        memcpy(buffer,mp->b_rptr,plen);
        buffer+=plen;
        blen+=plen;
        len-=plen;
        freemsg(mp);
        mp=NULL;
}else{
        memcpy(buffer,mp->b_rptr,len);
        mp->b_rptr+=len;
        buffer+=len;
        blen+=len;
        len=0;
        session->pending=mp;
        *have_more=1;
 break;
}
}else break;
}
return blen;
}
 
Any clues where this error can come from? I think it could be the use of "mp" 
but not sure about that.
 
Thanks

_______________________________________________ Linphone-users mailing list 
[email protected] 
http://lists.nongnu.org/mailman/listinfo/linphone-users                         
            
_______________________________________________
Linphone-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/linphone-users

Reply via email to