[Live-devel] bit rate whether i am correct, it is bit rate or byte rate

Tarun Batra tbatra18 at gmail.com
Mon Jul 16 04:53:57 PDT 2012


Hello sir

I did the following method to find the Kilo bits per second

RTPSink* videoSink;
 int64_t uSecsToDelay=2000000;
 int64_t uSecsToDelay2=1000000;
void play(); // forward

void periodicQOSMeasurement1(void* clientData);//actually bit rate
mesaurement
void periodicQOSMeasurement2(void* clientData);
int CreateINI();
char *sstreamip;
int SSport;
int s21;
int o21;
int s1,o1,s2,o2;
int main()
{
        .....
        .......
}
void play() {
  unsigned const inputDataChunkSize
    = TRANSPORT_PACKETS_PER_NETWORK_PACKET*TRANSPORT_PACKET_SIZE;

  // Open the input file as a 'byte-stream file source':
  ByteStreamFileSource* fileSource
    = ByteStreamFileSource::createNew(*env, inputFileName,
inputDataChunkSize);
  if (fileSource == NULL) {
    *env << "Unable to open file \"" << inputFileName
 << "\" as a byte-stream file source\n";
    exit(1);
  }

  // Create a 'framer' for the input source (to give us proper inter-packet
gaps):
  videoSource = MPEG2TransportStreamFramer::createNew(*env, fileSource);

  // Finally, start playing:
  *env << "Beginning to read from file...\n";
  videoSink->startPlaying(*videoSource, afterPlaying, videoSink);
   env->taskScheduler().scheduleDelayedTask(uSecsToDelay,
(TaskFunc*)periodicQOSMeasurement1, videoSink);
}
void periodicQOSMeasurement1(void* clientData)
{struct timeval timeNow;
int64_t uSecsToDelay1=1000000;

RTPSink* sink = (RTPSink*)clientData;



gettimeofday(&timeNow, NULL);

s1=timeNow.tv_sec;
printf("value of s1 %d\n",s1);
o1= videoSink->octetCount();
printf("value of o1 %d\n",o1);



env->taskScheduler().scheduleDelayedTask(uSecsToDelay1,
(TaskFunc*)periodicQOSMeasurement2,sink);


}


void periodicQOSMeasurement2(void* clientData)
{
struct timeval timeNow;
RTPSink* sink = (RTPSink*)clientData;
gettimeofday(&timeNow, NULL);
s2=timeNow.tv_sec;
printf("value of s2 %d\n",s2);
o2= videoSink->octetCount();
printf("value of o2 %d\n",o2);
float mbits_sent = (o2 - o1) / 1024.0/ (s2 - s1);
printf("mbits_sent is %f\n",mbits_sent);
env->taskScheduler().scheduleDelayedTask(uSecsToDelay2,
(TaskFunc*)periodicQOSMeasurement1,sink);

}



*Ross i am having 2 ques now*
*1>whether it will be kilo bits per second or kilo bytes per second?*
*2>for the same file i am getting streaming bit/byte rate of 24.565 and
25.365 and if i stream the same file using vlc i am getting stream bit rate
always above 100Kb/s, i am streaming the file given by you
"bipbop-gear1-all.ts". *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120716/ee3b9f58/attachment.html>


More information about the live-devel mailing list