[Live-devel] Converting H.264 RTP Video to MPEG-2 Transport Stream

JeffChen timercrack at gmail.com
Thu Apr 12 00:28:34 PDT 2012


I add this code in doGetNextFrame():

if (fMaxSize > fInputBufferSize) {
fInputBufferSize = fMaxSize;
delete[] fInputBuffer; fInputBuffer = new unsigned char[fInputBufferSize];
*( reinterpret_cast<u_int32_t*>(fInputBuffer) ) = htonl(0x01);
}
    // Arrange to read data directly into the client's buffer:
    fInputSource->getNextFrame ( fInputBuffer + 4, fMaxSize -
4,afterGettingFrame, this,FramedSource::handleClosure, this );

and this in afterGettingFrame1():

fFrameSize = frameSize + 4;
memmove(fTo, fInputBuffer, fFrameSize);

(...omitted code...)


Although it works fine, but noticed that there is a memory copy which I
think is redundant. I have tried to let fTo point directly to fInputBuffer,
but that caused  the generated data full of garbage. I don't known why. who
will use fTo later and where is fTo's initialization?

Thanks again for your help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120412/ea4736a6/attachment.html>


More information about the live-devel mailing list