[Live-devel] getNextFrame Variables
chenjun
zjuchenjun at hotmail.com
Mon Jan 8 06:22:49 PST 2007
hi Zkunhui,
Thanks for your works and your reply for my questions.I want to get the file you said about NAL units.
Again, I want to ask a question which i refered in previous question: If the size of NAL unit is bigger than fMaxsize(should I set fMaxsize myself?),
then fFrameSize=fMaxsize,fNumTruncatedBytes = fFrameSize - fMaxSize ,as the code below:
/////////////////////////////////////////////////
if (fFrameSize > fMaxSize) { fNumTruncatedBytes = fFrameSize - fMaxSize; fFrameSize = fMaxSize; }
memcpy(fTo,Encode_data,fFrameSize); //Encode_data is defined in another thread
//////////////////////////////////////////////////
but how to deal with the fNumTruncatedBytes data?
in H264VideoRTPSink.cpp , i see the clue below, should i do it like this in deliverFrame()?
// We have NAL unit data in the buffer. There are three cases to consider: // 1. There is a new NAL unit in the buffer, and it's small enough to deliver // to the RTP sink (as is). // 2. There is a new NAL unit in the buffer, but it's too large to deliver to // the RTP sink in its entirety. Deliver the first fragment of this data, // as a FU-A packet, with one extra preceding header byte. // 3. There is a NAL unit in the buffer, and we've already delivered some // fragment(s) of this. Deliver the next fragment of this data, // as a FU-A packet, with two extra preceding header bytes.
Thanks in advance. I am looking forward helps from anyone!
Date: Sat, 6 Jan 2007 07:06:36 +0800From: TAYK0004 at ntu.edu.sgTo: live-devel at ns.live555.comSubject: [Live-devel] getNextFrame Variables
Hi guys,
once again, great thanks to Ross for helping me clear many doubts in RTP.
I have some uncertainties regarding DoGetNextFrame() Variables, which I hope anyone can assist.
fTO : a RTP buffer, we are to copy video data into this buffer for framing
eg. g_video_enc_rbuf->read(fTo, fMaxSize, 0); //the read function will copy the data to fTo
memcpy(fTo,g_video_enc_rbuf,fFrameSize); // using memcpy function
fPresentationTime: give time information to each frame
eg. gettimeofday(&fPresentationTime, NULL); //a simpler form
// a more detailed form
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 (50ms), my encoder’s frame rate is 20fps
unsigned uSeconds = fPresentationTime.tv_usec + 50000;
fPresentationTime.tv_sec += uSeconds/1000000;
fPresentationTime.tv_usec = uSeconds%1000000;
fMaxSize: Setting the maximum size of a rtp frame. Not necessary if you have already set your encoder to limit the size of a frame. For truncation purpose.
eg. Can anyone provide some examples on setting fMaxSize?
fFrameSize: Determine the RTP frame size
eg. Can anyone provide some examples on setting fFrameSize?
That’s all I can think of for the variables for DoGetNextFrame. If I miss out anything, pls kindly add in.
I compiling all the emails which contains information on these information so that anyone in future can refer to them instead of asking again in the mailing list. I can share a file which I have done detailing on NAL units so that people doing h.264 framer can have a better understanding when writing the code.
Many thanks and regards.
Zkunhui
_________________________________________________________________
通过 Windows Live Messenger 表达您自己!
http://get.live.com/messenger/overview
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20070108/4b424a3e/attachment.html
More information about the live-devel
mailing list