WebRTC Pacer

Abstract

WebRTC Pacer

Authors

Walter Fan

Status

WIP

Updated

2024-08-21

Overview

将要发的包追加到一个队列中,由 Pacer 这个模块按照设定的速率将媒体包发送出去

主要类

PacingController

This class implements a leaky-bucket packet pacing algorithm.

It handles the logic of determining which packets to send when, but the actual timing of the processing is done externally (e.g. RtpPacketPacer).

RtpPacketPacer

主要方法:

  • PacketRouter::SendPacket(…)

  • ModuleRtpRtcpImpl::TrySendPacket(…)

  • std::vector<std::unique_ptr<RtpPacketToSend>> RTPSender::GeneratePadding(…)

Types

  • RtpPacketMediaType 表示 RTP 包的类型,共有 5 种

  1. 音频包

  2. 视频包

  3. 重传包

  4. 纠错包

  5. 填充包

static constexpr size_t kNumMediaTypes = 5;
enum class RtpPacketMediaType : size_t {
    kAudio,                         // Audio media packets.
    kVideo,                         // Video media packets.
    kRetransmission,                // Retransmisions, sent as response to NACK.
    kForwardErrorCorrection,        // FEC packets.
    kPadding = kNumMediaTypes - 1,  // RTX or plain padding sent to maintain BWE.
    // Again, don't forget to udate `kNumMediaTypes` if you add another value!
};