版本:
webrtc M59
收包流程:
AsyncUDPSocket::OnReadEvent
AllocationSequence::OnReadPacket
HandleIncomingPacket
UDPPort::OnReadPacket
Connection::OnReadPacket
P2PTransportChannel::OnReadPacke
SignalReadPacket
BaseChannel::OnPacketRead
BaseChannel::HandlePacket(该接口内的WantsPacket会判断rtp包的payload type是否在std::set<int> payload_types_集合内,不在的话不会处理)
BaseChannel::OnPacketReceived
WebRtcVoiceMediaChannel::OnPacketReceived
PacketReceiver::DeliveryStatus Call::DeliverRtp
AudioReceiveStream::OnRtpPacket(video通话为VideoReceiveStream::OnRtpPacket)
Channel::OnRtpPacket
Channel::ReceivePacket
RtpReceiverImpl::IncomingRtpPacket
NetEqImpl::InsertPacket
NetEqImpl::InsertPacketInternal
语音流程:
WebRtcVoiceMediaChannel::OnPacketReceived
AudioReceiveStream::OnRtpPacket
ChannelProxy::OnRtpPacket
Channel::OnRtpPacket
Channel::ReceivePacket
RtpReceiverImpl::IncomingRtpPacket
RTPReceiverAudio::ParseAudioCodecSpecific
Channel::OnReceivedPayloadData
AudioCodingModuleImpl::IncomingPacket
AcmReceiver::InsertPacket
ps:可参考http://www.it610.com/article/5250159.htm
视频收包流程:
WebRtcVideoChannel2::OnPacketReceived
PacketReceiver::DeliveryStatus Call::DeliverRtp
RtpStreamReceiver::ReceivePacket
RtpReceiverImpl::IncomingRtpPacket
RTPReceiverVideo::ParseRtpPacket
RtpStreamReceiver::OnReceivedPayloadData
PacketBuffer::InsertPacket(组帧)
RtpStreamReceiver::OnReceivedFrame(检查是否需要请求关键帧、再查找帧的参考关系是否满足)
void RtpFrameReferenceFinder::ManageFrame
void RtpFrameReferenceFinder::ManageFrameGeneric
VideoReceiveStream::OnCompleteFrame
FrameBuffer::InsertFrame (将帧插入到jitter buffter至此数据包的接收和处理已经完成)
视频解码流程:
VideoReceiveStream::VideoReceiveStream(创建解码线程在该构造函数里面,调用VideoReceiveStream::DecodeThreadFunction)
VideoReceiveStream::Decode( 如果有帧才会去解码,最长等待3秒,在VideoReceiveStream::Decode中有设置等待时间)
FrameBuffer::ReturnReason FrameBuffer::NextFrame (获取帧)
VideoReceiver::Decode
VCMGenericDecoder* VCMCodecDataBase::GetDecoder(获取解码,如果没有创建则调用)
CreateAndInitDecoder(硬解的话走的是External codec流程也就是new VCMGenericDecoder(external_dec_item->external_decoder_instance, true))
VCMGenericDecoder::InitDecode
MediaCodecVideoDecoder::InitDecode
MediaCodecVideoDecoder::InitDecodeOnCodecThread()
VCMDecodedFrameCallback::Decoded(解码完成)
VideoStreamDecoder::FrameToRender(收到解码后的数据)
IncomingVideoStream::OnFrame (将帧放入队列VideoRenderFrames(incoming_video_stream_接收解码对象通过VideoStreamDecoder::VideoStreamDecoder ->VideoReceiver::RegisterReceiveCallback(this)–>VCMDecodedFrameCallback::SetUserReceiveCallback)
IncomingVideoStream::Dequeue
ps: 这个只是一部分,其余的后续补充