WebRTC源码分析 - receiver and decoder

参考:WebRTC 接收到 offer 指令后流程分析与 jitterbuffer 数据到解码器的流程分析 | 码农家园

rtp_video_stream_receiver2.cc : OnReceivedPayloadData   video_header.is_last_packet_in_frame |= rtp_packet.Marker();

video_rtp_depacketizer_h264.cc:

absl::optional<VideoRtpDepacketizer::ParsedRtpPayload>

VideoRtpDepacketizerH264::Parse(rtc::CopyOnWriteBuffer rtp_payload)

packet_buffer_.InsertPacket

OnInsertedPacket --- 组帧的结果到这里

rtp_video_stream_receiver2.cc : OnAssembledFrame

buffered_frame_decryptor.cc: ManageEncryptedFrame ->DecryptFrame 

rtp_video_stream_receiver2.cc : OnDecryptedFrame

OnCompleteFrames

OnCompleteFrame

 http://receive_statistics_proxy.cc 的 ReceiveStatisticsProxy::OnCompleteFrame

 VideoStreamBufferController::InsertFrame  ->  stats_proxy_->OnCompleteFrame(metadata.is_keyframe, metadata.size,metadata.contentType); receiv:key+delta

void VideoStreamBufferController::MaybeScheduleFrameForRelease

这中间少了frame

VideoStreamBufferController::ForceKeyFrameReleaseImmediately()

VideoStreamBufferController::OnFrameReady

VideoReceiveStream2::OnEncodedFrame

VideoReceiveStream2::DecodeAndMaybeDispatchEncodedFrame

VCMGenericDecoder::Decode  (真正的decode-- 这里的decoder_ 就是 VideoDecoderSoftwareFallbackWrapper

VideoDecoderSoftwareFallbackWrapper::Decode

     硬解: RTCVideoDecoderAdapter::Decode

     软解 H264DecoderImpl::Decode     (FFmpeg解码)

   (video_codec_factory.cc 中会create hardware_decoder和software_decoder,并通过webrtc::CreateVideoDecoderSoftwareFallbackWrapper传入到webrtc fallback模块)

VideoReceiveStream2::OnCompleteFrame(std::unique_ptr<EncodedFrame> frame)

VideoStreamBufferController::InsertFrame

FrameBuffer::InsertFrame

硬件解码失败:

NotifyError就会进入error状态,一旦进入error状态,直接一直返回std::move(decode_cb).Run(DecoderStatus::Codes::kInterrupted);

media/gpu/windows/d3d11_video_decoder.cc

log关键字:

deocde失败:Failed to decode frame

Decoded frame is not a CVPixelBuffer 

解密失败:Failed to unprotect

Error code:

avcodec_send_packet error: -1094995529  FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input

avcodec_receive_packet -35: AVERROR(EAGAIN) output is not available in the current state - user must try to send input

猜你喜欢

转载自blog.csdn.net/luyumiao1990/article/details/131751381