[Live-devel] about h.264 streaming

chenjun zjuchenjun at hotmail.com
Thu Jan 4 00:41:09 PST 2007





Hi all,
I want to stream h.264 video from a live source using live555, and I have read the FAQ but still I feel it is difficulty to fill the member function.  I list some codes I wrote myself below and I have not validate it. I should appreciate if you can give me some suggestions.
 
   void H264VideoStreamDiscreteFramer::doGetNextFrame()
 {
//**************************non-blocking fashion**************************//
while(1){
                 watchVariableforH264=0;
 
                   env->tashScheduler().doEventLoop(&watchVariableforH264);
 
                   deliverFrame();
 
           }       
           
 
 if (fFramsize==0 /* the source stops being readable */) {
   handleClosure(this);
   return;
  }
 
}
 
 
void  H264VideoStreamDiscreteFramer::deliverFrame()
{
  if (!isCurrentlyAwaitingData()) return; // we're not ready for the data yet
 
 fFrameSize=LenOfEncode;                       //LENOFENCODE is defined in another thread
        
 if (fFrameSize > fMaxSize) {
                            fNumTruncatedBytes = fFrameSize - fMaxSize;
                            fFrameSize = fMaxSize;
                   }
 
 memcpy(fTo,Encode_data,fFrameSize);     //Encode_data is defined in another thread
//?????????  I am not sure how to copy encoded data to the address point by fTo, especially how to deal with 
//         data which be truncated (fNumTruncatedBytes).
          
 // Set the 'presentation time':
    if (fPresentationTime.tv_sec == 0 && fPresentationTime.tv_usec == 0) {
      // This is the first frame, so use the current time:
      gettimeofday(&fPresentationTime, NULL);
    } else {
      // Increment by the play time of the previous frame (64ms), my encoder’s frame rate is 15.6fps
    unsigned uSeconds         = fPresentationTime.tv_usec + 64000;
    fPresentationTime.tv_sec += uSeconds/1000000;
    fPresentationTime.tv_usec = uSeconds%1000000;
  }
 
 fDurationInMicroseconds = 64000; // each frame is 64 ms
 
  // Deliver the data here:
  // ?????????   what does this mean?  How to Deliver?
  
 
  // After delivering the data, inform the reader that it is now available:
  FramedSource::afterGetting(this);
  
}
 
 
 
Boolean  H264VideoStreamDiscreteFramer::currentNALUnitEndsAccessUnit()
  {
// How to know whether the NAL unit that you're currently delivering is the last NAL unit in an access unit (video frame).
 
  }
 
_________________________________________________________________
Windows Live Safety Center 为您的计算机提供免费的安全扫描服务。
http://safety.live.com/site/ZH-CN/default.htm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20070104/76e941af/attachment-0001.html 


More information about the live-devel mailing list