[prev in list] [next in list] [prev in thread] [next in thread] 

List:       semsdev
Subject:    [Semsdev] conference and iLBC
From:       sayer () cs ! tu-berlin ! de (Stefan Sayer)
Date:       2005-01-08 16:05:20
Message-ID: 41DFF66C.5070203 () cs ! tu-berlin ! de
[Download RAW message or body]

Hello,

so far conference has not been working with 30 ms packet size, wich is
the default setting for iLBC codec. Attached is a patch which enables
conference with 30ms (and mixed 20/30 ms) packet size participants.

Unclear to me is whether, due to the granularity of the timer in linux
(10 ms), this will introduce jitter in the outgoing streams from a
conference. If someone of you has the possibility to test this with the
patch and without that would be appreciated:
-capture streams of a conference call with ethereal
-select a packet of an outgoing stream
-do statistics->rtp->stream analysis
-save as cvs file

and send me this output?
Thank you

Stefan Sayer

-------------- next part --------------
Index: AmRtpStream.h
===================================================================
RCS file: /cvsroot/sems/answer_machine/AmRtpStream.h,v
retrieving revision 1.24
diff -c -r1.24 AmRtpStream.h
*** AmRtpStream.h	10 Jun 2004 08:48:04 -0000	1.24
--- AmRtpStream.h	8 Jan 2005 14:36:33 -0000
***************
*** 59,64 ****
--- 59,65 ----
  
      void begin(unsigned int ts,AmRtpScheduler* sched);
      void sync(AmRtpScheduler* sched);
+     void sync_cond(AmRtpScheduler* sched); // only wait for timer when we have to wait
      unsigned int computeTimestamp(AmRtpScheduler* sched);
  };
  
Index: AmRtpStream.cpp
===================================================================
RCS file: /cvsroot/sems/answer_machine/AmRtpStream.cpp,v
retrieving revision 1.57
diff -c -r1.57 AmRtpStream.cpp
*** AmRtpStream.cpp	28 Sep 2004 10:56:26 -0000	1.57
--- AmRtpStream.cpp	8 Jan 2005 14:36:34 -0000
***************
*** 89,94 ****
--- 89,118 ----
      }
  }
  
+ void RtpSync::sync_cond(AmRtpScheduler* sched)
+ {
+     if(!init){
+ 	init = true;
+     }
+     else {
+ 	AmCondition<bool> fired(false);
+ 	AmRtpTimer timer(&fired);
+ 	struct timeval curr = sched->getCurrentTime(); // check if media thread got blocked
+ 	if (timercmp(&last_time, &curr, <)) { // we are behind real time
+ 	    struct timeval tv_diff;
+ 	    timersub(&curr, &last_time, &tv_diff);
+ 	    double msec_late = tv_diff.tv_sec * 1000.0 + tv_diff.tv_usec / 1000.0;
+ 	    if (msec_late>20) {
+ 	      DBG("sending late for %.3f msec\n", msec_late);
+ 	    }
+ 	} else {
+ 	  timer.time = last_time;
+ 	  sched->addTimer(timer);
+ 	  fired.wait_for();
+ 	}
+     }
+ }
+ 
  unsigned int RtpSync::computeTimestamp(AmRtpScheduler* sched)
  {
      struct timeval tv;
***************
*** 690,700 ****
--- 714,730 ----
  	  
  	     rtp_str->blocking = false;
  
+ 	     int audio_rec_frame_size = 160;         // frame size of conference/... audio  
+ 	     if (str_info.audio_rec)                 // connector, should be 160
+ 	       str_info.audio_rec->out->frame_size;  // if not
+ 
  	     if(str_info.audio_rec){
+ 	       if (!(ts_set % audio_rec_frame_size))  // only receive every 20 ms 
  	         rtp_str->receive(ts_set+str_info.ts_offset,
  				  str_info.audio_rec,true,tracer.get());
  	     }
  	     else {
+ 	       if (!(ts_set % audio_rec_frame_size))
  		 rtp_str->receive(ts_set+str_info.ts_offset,
  				  NULL,false);
  	     }
***************
*** 706,721 ****
  	     AmRtpStreamInfo&  str_info = it->second;
  
  	     if(str_info.audio_play){
  	         if(rtp_str->send(ts_set,
! 				  str_info.audio_play, 160) < 0) 
  		     throw string("while sending...");
  	     }
  	 }
  
  	 sync.begin(ts_set,sched);
! 	 sync.sync(sched);
  
! 	 ts_set += 160;
  	 nb_packet++;
       }
       catch(const string& err){
--- 736,752 ----
  	     AmRtpStreamInfo&  str_info = it->second;
  
  	     if(str_info.audio_play){
+ 	       if (!(ts_set % str_info.audio_play->out->frame_size))
  	         if(rtp_str->send(ts_set,
! 				  str_info.audio_play, str_info.audio_play->out->frame_size) < 0) 
  		     throw string("while sending...");
  	     }
  	 }
  
  	 sync.begin(ts_set,sched);
! 	 sync.sync_cond(sched);
  
! 	 ts_set += 80;
  	 nb_packet++;
       }
       catch(const string& err){

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic