mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 06:40:43 +01:00

This cl adds an implementation of the RTCP feedback packet as specified in https://www.rfc-editor.org/rfc/rfc8888.html Bug: webrtc:15368 Change-Id: I0b9a7fb15512ff9f9e721efd8e03ebe981a8d9bd Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347901 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Per Kjellander <perkj@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42140}
68 lines
2.2 KiB
C++
68 lines
2.2 KiB
C++
/*
|
|
* Copyright (c) 2024 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
#ifndef MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_CONGESTION_CONTROL_FEEDBACK_H_
|
|
#define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_CONGESTION_CONTROL_FEEDBACK_H_
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
#include "api/array_view.h"
|
|
#include "api/units/time_delta.h"
|
|
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
|
|
#include "modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
|
|
#include "rtc_base/network/ecn_marking.h"
|
|
|
|
namespace webrtc {
|
|
namespace rtcp {
|
|
|
|
// Congestion control feedback message as specified in
|
|
// https://www.rfc-editor.org/rfc/rfc8888.html
|
|
class CongestionControlFeedback : public Rtpfb {
|
|
public:
|
|
struct PacketInfo {
|
|
uint32_t ssrc = 0;
|
|
uint16_t sequence_number = 0;
|
|
// Time offset from report timestamp.
|
|
TimeDelta arrival_time_offset = TimeDelta::Zero();
|
|
rtc::EcnMarking ecn = rtc::EcnMarking::kNotEct;
|
|
};
|
|
|
|
static constexpr uint8_t kFeedbackMessageType = 11;
|
|
|
|
// `Packets` MUST be sorted in sequence_number order per SSRC.
|
|
// `Packets` MUST not include duplicate sequence numbers.
|
|
CongestionControlFeedback(std::vector<PacketInfo> packets,
|
|
uint32_t report_timestamp_compact_ntp);
|
|
CongestionControlFeedback() = default;
|
|
|
|
bool Parse(const CommonHeader& packet);
|
|
|
|
rtc::ArrayView<const PacketInfo> packets() const { return packets_; }
|
|
|
|
uint32_t report_timestamp_compact_ntp() const {
|
|
return report_timestamp_compact_ntp_;
|
|
}
|
|
|
|
// Serialize the packet.
|
|
bool Create(uint8_t* packet,
|
|
size_t* position,
|
|
size_t max_length,
|
|
PacketReadyCallback callback) const override;
|
|
size_t BlockLength() const override;
|
|
|
|
private:
|
|
std::vector<PacketInfo> packets_;
|
|
uint32_t report_timestamp_compact_ntp_ = 0;
|
|
};
|
|
|
|
} // namespace rtcp
|
|
} // namespace webrtc
|
|
|
|
#endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_CONGESTION_CONTROL_FEEDBACK_H_
|