Allow REMB messages to be sent immediately in RtcpTransceiver

This cl add a configuration flag to allow REMB messages to be sent immediately when the bitrate value have changed.
The remb message is still included in all following compound packets.

Bug: None
Change-Id: I9f71d30cddbccd095e1d2971247c731bd1727d32
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169221
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30627}
This commit is contained in:
Per Kjellander
2020-02-27 13:20:55 +01:00
committed by Commit Bot
parent eed48b86ed
commit c93595b4b9
8 changed files with 72 additions and 11 deletions

View File

@ -71,7 +71,8 @@ bool Remb::Parse(const CommonHeader& packet) {
uint64_t mantissa = (static_cast<uint32_t>(payload[13] & 0x03) << 16) |
ByteReader<uint16_t>::ReadBigEndian(&payload[14]);
bitrate_bps_ = (mantissa << exponenta);
bool shift_overflow = (bitrate_bps_ >> exponenta) != mantissa;
bool shift_overflow =
(static_cast<uint64_t>(bitrate_bps_) >> exponenta) != mantissa;
if (shift_overflow) {
RTC_LOG(LS_ERROR) << "Invalid remb bitrate value : " << mantissa << "*2^"
<< static_cast<int>(exponenta);

View File

@ -32,9 +32,9 @@ class Remb : public Psfb {
bool Parse(const CommonHeader& packet);
bool SetSsrcs(std::vector<uint32_t> ssrcs);
void SetBitrateBps(uint64_t bitrate_bps) { bitrate_bps_ = bitrate_bps; }
void SetBitrateBps(int64_t bitrate_bps) { bitrate_bps_ = bitrate_bps; }
uint64_t bitrate_bps() const { return bitrate_bps_; }
int64_t bitrate_bps() const { return bitrate_bps_; }
const std::vector<uint32_t>& ssrcs() const { return ssrcs_; }
size_t BlockLength() const override;
@ -51,7 +51,7 @@ class Remb : public Psfb {
void SetMediaSsrc(uint32_t);
uint32_t media_ssrc() const;
uint64_t bitrate_bps_;
int64_t bitrate_bps_;
std::vector<uint32_t> ssrcs_;
};
} // namespace rtcp

View File

@ -24,7 +24,7 @@ namespace {
const uint32_t kSenderSsrc = 0x12345678;
const uint32_t kRemoteSsrcs[] = {0x23456789, 0x2345678a, 0x2345678b};
const uint32_t kBitrateBps = 0x3fb93 * 2; // 522022;
const uint64_t kBitrateBps64bit = 0x3fb93ULL << 30;
const int64_t kBitrateBps64bit = int64_t{0x3fb93} << 30;
const uint8_t kPacket[] = {0x8f, 206, 0x00, 0x07, 0x12, 0x34, 0x56, 0x78,
0x00, 0x00, 0x00, 0x00, 'R', 'E', 'M', 'B',
0x03, 0x07, 0xfb, 0x93, 0x23, 0x45, 0x67, 0x89,