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

[ns] Need help with real time scheduling



 
Dear All,

We need help with real time scheduling.

We are working on real time  video streaming (using transcoders) over the Internet. The video
is MPEG1 transcoded with each slice encapsulated into a packet which is then independently sent across the IP network (using UDP).

We would like the time it takes  to transacted, packetise and send the packet constant (e.g. say 5 ms) no more no less.

We would appreciate if someone can help, but please find below how we tried to solve the problem.
 

snippet code

struct timeval  slice_Start;
struct timeval  slice_End;
struct timeval sleep_time;

int target_time = 5000;   //5ms target for slice processing

//this loop is used for transcoding a picture

for(j=0;  j <  num_slices; j++)
    {

      gettimeofday(&slice_Start,(struct timezone *)NULL);    //start time

       transcode_packetise_slice_j();

      send_slice_ j_through_the_network();

      gettimeofday(&slice_End,(struct timezone *)NULL);    //end time

    if(slice_End.tv_usec < slice_Start.tv_usec)
      {
          slice_End.tv_usec += 1000000;
          slice_End.tv_sec--;
      }

    //now get the slice processing time

    slice_time  =  slice_End.tv_usec  -  slice_Start.tv_usec;  //should be less than a sec (1000000 us)

    //now check against the target slice time

    if(slice_time  < target_time)
      {
          sleep_time.tv_usec = target_time - slice_duration;
          sleep_time.tv.sec = 0;
          select(0,NULL,NULL,NULL,&sleep_time);   // spin around to kill time
       }

}

They above was assumed to make the inter packet generation packet constant, but it does not seem
to work. We need to make  the time between packet generation constant to enable us measure
(correctly) the amount of delay (jitter) introduced by the network at the destination.

Any help or ideas will be greatly appreciated.

Thank you.

Emmanuel Jammeh
 
 

begin:vcard 
n:Jammeh;Emmanuel
x-mozilla-html:FALSE
org:University of Essex;ESE
adr:;;;;;;
version:2.1
email;internet:eajamm@essex.ac.uk
title:Mr
x-mozilla-cpt:;0
fn:Emmanuel Jammeh
end:vcard