Mediasoup source code analysis (5) Congestion Control congestion control

mediasoup supports two types of bwe (Bandwidth estimation) bandwidth estimation feedback mechanisms: TRANSPORT-CC and REMB. The specific processing categories are:

TransportCongestionControlServer receives the data from the client, generates the transport-cc package according to certain rules, and then sends it to the client.

The client adjusts the sending code rate according to the transport-cc packet.

1. Create a congestion control class TransportCongestionControlServer

void Transport::HandleRequest(Channel::Request* request)
{
  case Channel::Request::MethodId::TRANSPORT_PRODUCE:
  {
     //根据bwe的类型,判断是tranport-cc 还是remb
   // Set TransportCongestionControlServer.
	 if (!this->tccServer)
	 {
	   bool createTccServer{ false };
		 RTC::BweType bweType;
		 // Use transport-cc if:
		 // - there is transport-wide-cc-01 RTP header extension, and
		 // - there is "transport-cc" in codecs RTCP feedback.
		 //
		 // clang-format off
		 if (//判断rtp扩展头中的transport wide 序列号字段不为0
			 rtpHeaderExtensionIds.transportWideCc01 != 0u &&
			 std::any_of(
			 codecs.begin(), codecs.end(), [](const RTC::RtpCodecParameters& 

Guess you like

Origin blog.csdn.net/lcalqf/article/details/107913613