rtsp客户端发送播放请求后,rtsp服务器调用流程如下
h264 video rtsp
1.ServerMediaSubsession::startStream ->OnDemandServerMediaSubse
ssion::startStream
2.startStream -> StreamState::startPlaying
3.MediaSink::startPlaying
4.MediaSink::continuePlaying->MultiFramedRTPSink::continuePlaying
5.MultiFramedRTPSink::buildAndSendPacket
6.MultiFramedRTPSink::packFrame()
fSource->getNextFrame fSource type isH264FUAFragmenter
7.FramedSource::getNextFrame
8.FramedSource::doGetNextFrame->H264FUAFragmenter::doGetNextFrame
->
fInputSource->getNextFrame fInputSource typeis H264VideoStreamFramer
9.H264VideoStreamFramer::getNextFrame ->MPEGVideoStreamFramer::doGetNextFrame
10.MPEGVideoStreamFramer::continueReadProcessing ->fParser->parse()
fParser type isH264VideoStreamParser
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当thisNALUnitEndsAccessUni
t=TRUE后,根据帧率计算帧duration,然后计算下一帧的时间戳