2016-01-11 03:31:08 -08:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_
|
|
|
|
|
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
2016-02-08 03:35:10 -08:00
|
|
|
|
2016-01-11 03:31:08 -08:00
|
|
|
#include "webrtc/base/basictypes.h"
|
2016-02-08 03:35:10 -08:00
|
|
|
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
|
2016-01-11 03:31:08 -08:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace rtcp {
|
2016-05-26 05:29:14 -07:00
|
|
|
class CommonHeader;
|
|
|
|
|
|
2016-02-08 03:35:10 -08:00
|
|
|
// Temporary Maximum Media Stream Bit Rate Notification (TMMBN).
|
|
|
|
|
// RFC 5104, Section 4.2.2.
|
|
|
|
|
class Tmmbn : public Rtpfb {
|
2016-01-11 03:31:08 -08:00
|
|
|
public:
|
2016-05-26 05:29:14 -07:00
|
|
|
static constexpr uint8_t kFeedbackMessageType = 4;
|
2016-02-08 03:35:10 -08:00
|
|
|
|
|
|
|
|
Tmmbn() {}
|
|
|
|
|
~Tmmbn() override {}
|
2016-01-11 03:31:08 -08:00
|
|
|
|
2016-02-08 03:35:10 -08:00
|
|
|
// Parse assumes header is already parsed and validated.
|
2016-05-26 05:29:14 -07:00
|
|
|
bool Parse(const CommonHeader& packet);
|
2016-01-11 03:31:08 -08:00
|
|
|
|
2016-09-27 09:27:47 -07:00
|
|
|
void AddTmmbr(const TmmbItem& item);
|
2016-02-08 03:35:10 -08:00
|
|
|
|
|
|
|
|
const std::vector<TmmbItem>& items() const { return items_; }
|
2016-01-11 03:31:08 -08:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
bool Create(uint8_t* packet,
|
|
|
|
|
size_t* index,
|
|
|
|
|
size_t max_length,
|
|
|
|
|
RtcpPacket::PacketReadyCallback* callback) const override;
|
|
|
|
|
|
|
|
|
|
private:
|
2016-02-08 03:35:10 -08:00
|
|
|
size_t BlockLength() const override {
|
|
|
|
|
return kHeaderLength + kCommonFeedbackLength +
|
|
|
|
|
TmmbItem::kLength * items_.size();
|
2016-01-11 03:31:08 -08:00
|
|
|
}
|
|
|
|
|
|
2016-02-08 03:35:10 -08:00
|
|
|
// Media ssrc is unused, shadow base class setter and getter.
|
2016-09-27 09:27:47 -07:00
|
|
|
void SetMediaSsrc(uint32_t ssrc);
|
2016-02-08 03:35:10 -08:00
|
|
|
uint32_t media_ssrc() const;
|
|
|
|
|
|
|
|
|
|
std::vector<TmmbItem> items_;
|
2016-01-11 03:31:08 -08:00
|
|
|
};
|
|
|
|
|
} // namespace rtcp
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_
|