/* * Copyright (c) 2016 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. */ #include "modules/rtp_rtcp/source/rtcp_packet/target_bitrate.h" #include "modules/rtp_rtcp/source/byte_io.h" #include "rtc_base/checks.h" #include "rtc_base/numerics/safe_conversions.h" namespace webrtc { namespace rtcp { constexpr size_t kTargetBitrateHeaderSizeBytes = …; constexpr uint8_t TargetBitrate::kBlockType; const size_t TargetBitrate::kBitrateItemSizeBytes = …; TargetBitrate::BitrateItem::BitrateItem() : … { … } TargetBitrate::BitrateItem::BitrateItem(uint8_t spatial_layer, uint8_t temporal_layer, uint32_t target_bitrate_kbps) : … { … } // RFC 4585: Feedback format. // // Common packet format: // // 0 1 2 3 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // | BT=42 | reserved | block length | // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ // // Target bitrate item (repeat as many times as necessary). // // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // | S | T | Target Bitrate | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // : ... : // // Spatial Layer (S): 4 bits // Indicates which temporal layer this bitrate concerns. // // Temporal Layer (T): 4 bits // Indicates which temporal layer this bitrate concerns. // // Target Bitrate: 24 bits // The encoder target bitrate for this layer, in kbps. // // As an example of how S and T are intended to be used, VP8 simulcast will // use a separate TargetBitrate message per stream, since they are transmitted // on separate SSRCs, with temporal layers grouped by stream. // If VP9 SVC is used, there will be only one SSRC, so each spatial and // temporal layer combo used shall be specified in the TargetBitrate packet. TargetBitrate::TargetBitrate() = default; TargetBitrate::TargetBitrate(const TargetBitrate&) = default; TargetBitrate& TargetBitrate::operator=(const TargetBitrate&) = default; TargetBitrate::~TargetBitrate() = default; void TargetBitrate::Parse(const uint8_t* block, uint16_t block_length) { … } void TargetBitrate::AddTargetBitrate(uint8_t spatial_layer, uint8_t temporal_layer, uint32_t target_bitrate_kbps) { … } const std::vector<TargetBitrate::BitrateItem>& TargetBitrate::GetTargetBitrates() const { … } size_t TargetBitrate::BlockLength() const { … } void TargetBitrate::Create(uint8_t* buffer) const { … } } // namespace rtcp } // namespace webrtc