live555 h264 videostream 数据流和时间戳的分析

rtsp客户端发送播放请求后,rtsp服务器调用流程如下
h264 video rtsp
1.ServerMediaSubsession::startStream -> OnDemandServerMediaSubsession::startStream
2.startStream -> StreamState::startPlaying
3.MediaSink::startPlaying
4.MediaSink::continuePlaying->MultiFramedRTPSink::continuePlaying
5.MultiFramedRTPSink::buildAndSendPacket
6.MultiFramedRTPSink::packFrame()  fSource->getNextFrame fSource type is H264FUAFragmenter
7.FramedSource::getNextFrame
8.FramedSource::doGetNextFrame ->H264FUAFragmenter::doGetNextFrame  ->  fInputSource->getNextFrame fInputSource type is H264VideoStreamFramer
9.H264VideoStreamFramer::getNextFrame -> MPEGVideoStreamFramer::doGetNextFrame
10.MPEGVideoStreamFramer::continueReadProcessing -> fParser->parse()   fParser type is H264VideoStreamParser
11.H264VideoStreamParser::parse()   -> ByteStreamFileSource::doGetNextFrame -> ByteStreamFileSource::doReadFromFile


时间戳生成流程
1.MultiFramedRTPSink::buildAndSendPacket 中组建rtp包头时,获取时间戳的位置fTimestampPosition,然后等待获取数据与时间戳后写入
2.MultiFramedRTPSink::afterGettingFrame1 ->H264VideoRTPSink::doSpecialFrameHandling->MultiFramedRTPSink::setTimestamp 将时间戳写入到rtp包中

3.H264VideoStreamParser::parse 中调用H264VideoStreamFramer::setPresentationTime { fPresentationTime = fNextPresentationTime; } 此fPresentationTime最终将传到步骤2中
4.fNextPresentationTime 初始化由构造函数获取当前时间戳 ,后续在H264VideoStreamParser::parse 当thisNALUnitEndsAccessUnit=TRUE后,根据帧率计算帧duration,然后计算下一帧的时间戳

你可能感兴趣的:(嵌入式开发,流媒体开发,Linux,C/C++)