Add RemoteEstimatorProxy for capturing receive times
For use when send-side bandwidth estimation is enabled. Receive times need to be captured, buffered and then sent using TransportFeedback RTCP messaged back to the send side. BUG=webrtc:4173 Review URL: https://codereview.webrtc.org/1290813008 Cr-Commit-Position: refs/heads/master@{#9898}
This commit is contained in:
@ -25,6 +25,9 @@ class ReceiveStatistics;
|
||||
class RemoteBitrateEstimator;
|
||||
class RtpReceiver;
|
||||
class Transport;
|
||||
namespace rtcp {
|
||||
class TransportFeedback;
|
||||
}
|
||||
|
||||
class RtpRtcp : public Module {
|
||||
public:
|
||||
@ -542,6 +545,8 @@ class RtpRtcp : public Module {
|
||||
RtcpStatisticsCallback* callback) = 0;
|
||||
virtual RtcpStatisticsCallback*
|
||||
GetRtcpStatisticsCallback() = 0;
|
||||
// BWE feedback packets.
|
||||
virtual bool SendFeedbackPacket(const rtcp::TransportFeedback& packet) = 0;
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "webrtc/modules/interface/module.h"
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -205,6 +206,7 @@ class MockRtpRtcp : public RtpRtcp {
|
||||
MOCK_CONST_METHOD0(StorePackets, bool());
|
||||
MOCK_METHOD1(RegisterRtcpStatisticsCallback, void(RtcpStatisticsCallback*));
|
||||
MOCK_METHOD0(GetRtcpStatisticsCallback, RtcpStatisticsCallback*());
|
||||
MOCK_METHOD1(SendFeedbackPacket, bool(const rtcp::TransportFeedback& packet));
|
||||
MOCK_METHOD1(RegisterAudioCallback,
|
||||
int32_t(RtpAudioFeedback* messagesCallback));
|
||||
MOCK_METHOD1(SetAudioPacketSize,
|
||||
|
||||
@ -304,6 +304,13 @@ void TransportFeedback::WithMediaSourceSsrc(uint32_t ssrc) {
|
||||
media_source_ssrc_ = ssrc;
|
||||
}
|
||||
|
||||
uint32_t TransportFeedback::GetPacketSenderSsrc() const {
|
||||
return packet_sender_ssrc_;
|
||||
}
|
||||
|
||||
uint32_t TransportFeedback::GetMediaSourceSsrc() const {
|
||||
return media_source_ssrc_;
|
||||
}
|
||||
void TransportFeedback::WithBase(uint16_t base_sequence,
|
||||
int64_t ref_timestamp_us) {
|
||||
DCHECK_EQ(-1, base_seq_);
|
||||
|
||||
@ -52,6 +52,8 @@ class TransportFeedback : public RtcpPacket {
|
||||
// is relative the base time.
|
||||
std::vector<int64_t> GetReceiveDeltasUs() const;
|
||||
|
||||
uint32_t GetPacketSenderSsrc() const;
|
||||
uint32_t GetMediaSourceSsrc() const;
|
||||
static const int kDeltaScaleFactor = 250; // Convert to multiples of 0.25ms.
|
||||
static const uint8_t kFeedbackMessageType = 15; // TODO(sprang): IANA reg?
|
||||
static const uint8_t kPayloadType = 205; // RTPFB, see RFC4585.
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||
@ -1210,4 +1211,29 @@ bool RTCPSender::AllVolatileFlagsConsumed() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) {
|
||||
CriticalSectionScoped lock(critical_section_transport_.get());
|
||||
if (!cbTransport_)
|
||||
return false;
|
||||
|
||||
class Sender : public rtcp::RtcpPacket::PacketReadyCallback {
|
||||
public:
|
||||
Sender(Transport* transport, int32_t id)
|
||||
: transport_(transport), id_(id), send_failure_(false) {}
|
||||
|
||||
void OnPacketReady(uint8_t* data, size_t length) override {
|
||||
if (transport_->SendRTCPPacket(id_, data, length) <= 0)
|
||||
send_failure_ = true;
|
||||
}
|
||||
|
||||
Transport* const transport_;
|
||||
int32_t id_;
|
||||
bool send_failure_;
|
||||
} sender(cbTransport_, id_);
|
||||
|
||||
uint8_t buffer[IP_PACKET_SIZE];
|
||||
return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) &&
|
||||
!sender.send_failure_;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -33,6 +33,9 @@ namespace webrtc {
|
||||
class ModuleRtpRtcpImpl;
|
||||
class RTCPReceiver;
|
||||
|
||||
namespace rtcp {
|
||||
class TransportFeedback;
|
||||
}
|
||||
class NACKStringBuilder {
|
||||
public:
|
||||
NACKStringBuilder();
|
||||
@ -147,6 +150,7 @@ public:
|
||||
void SetCsrcs(const std::vector<uint32_t>& csrcs);
|
||||
|
||||
void SetTargetBitrate(unsigned int target_bitrate);
|
||||
bool SendFeedbackPacket(const rtcp::TransportFeedback& packet);
|
||||
|
||||
private:
|
||||
struct RtcpContext;
|
||||
|
||||
@ -768,6 +768,11 @@ RtcpStatisticsCallback* ModuleRtpRtcpImpl::GetRtcpStatisticsCallback() {
|
||||
return rtcp_receiver_.GetRtcpStatisticsCallback();
|
||||
}
|
||||
|
||||
bool ModuleRtpRtcpImpl::SendFeedbackPacket(
|
||||
const rtcp::TransportFeedback& packet) {
|
||||
return rtcp_sender_.SendFeedbackPacket(packet);
|
||||
}
|
||||
|
||||
// Send a TelephoneEvent tone using RFC 2833 (4733).
|
||||
int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband(
|
||||
const uint8_t key,
|
||||
|
||||
@ -228,6 +228,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
RtcpStatisticsCallback* callback) override;
|
||||
RtcpStatisticsCallback* GetRtcpStatisticsCallback() override;
|
||||
|
||||
bool SendFeedbackPacket(const rtcp::TransportFeedback& packet) override;
|
||||
// (APP) Application specific data.
|
||||
int32_t SetRTCPApplicationSpecificData(uint8_t sub_type,
|
||||
uint32_t name,
|
||||
|
||||
Reference in New Issue
Block a user