Adding SendSideCongestionControllerInterface.

This prepares for a later CL providing two implementations of
SendSideCongestionController.

Bug: webrtc:8415
Change-Id: I890dbe4b88bf609921558e03aac66b42629857c8
Reviewed-on: https://webrtc-review.googlesource.com/56700
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22151}
This commit is contained in:
Sebastian Jansson
2018-02-22 12:32:27 +01:00
committed by Commit Bot
parent 0404225d15
commit dfde334be0
3 changed files with 101 additions and 24 deletions

View File

@ -17,6 +17,7 @@
#include "common_types.h" // NOLINT(build/include)
#include "modules/congestion_controller/delay_based_bwe.h"
#include "modules/congestion_controller/include/network_changed_observer.h"
#include "modules/congestion_controller/include/send_side_congestion_controller_interface.h"
#include "modules/congestion_controller/transport_feedback_adapter.h"
#include "modules/include/module.h"
#include "modules/include/module_common_types.h"
@ -39,9 +40,8 @@ class ProbeController;
class RateLimiter;
class RtcEventLog;
class SendSideCongestionController : public CallStatsObserver,
public Module,
public TransportFeedbackObserver {
class SendSideCongestionController
: public SendSideCongestionControllerInterface {
public:
using Observer = NetworkChangedObserver;
SendSideCongestionController(const Clock* clock,
@ -50,8 +50,10 @@ class SendSideCongestionController : public CallStatsObserver,
PacedSender* pacer);
~SendSideCongestionController() override;
void RegisterPacketFeedbackObserver(PacketFeedbackObserver* observer);
void DeRegisterPacketFeedbackObserver(PacketFeedbackObserver* observer);
void RegisterPacketFeedbackObserver(
PacketFeedbackObserver* observer) override;
void DeRegisterPacketFeedbackObserver(
PacketFeedbackObserver* observer) override;
// Currently, there can be at most one observer.
// TODO(nisse): The RegisterNetworkObserver method is needed because we first
@ -59,35 +61,36 @@ class SendSideCongestionController : public CallStatsObserver,
// reference to Call, which then registers itself as the observer. We should
// try to break this circular chain of references, and make the observer a
// construction time constant.
void RegisterNetworkObserver(Observer* observer);
void DeRegisterNetworkObserver(Observer* observer);
void RegisterNetworkObserver(Observer* observer) override;
void DeRegisterNetworkObserver(Observer* observer) override;
virtual void SetBweBitrates(int min_bitrate_bps,
int start_bitrate_bps,
int max_bitrate_bps);
void SetBweBitrates(int min_bitrate_bps,
int start_bitrate_bps,
int max_bitrate_bps) override;
// Resets the BWE state. Note the first argument is the bitrate_bps.
virtual void OnNetworkRouteChanged(const rtc::NetworkRoute& network_route,
int bitrate_bps,
int min_bitrate_bps,
int max_bitrate_bps);
virtual void SignalNetworkState(NetworkState state);
virtual void SetTransportOverhead(size_t transport_overhead_bytes_per_packet);
void OnNetworkRouteChanged(const rtc::NetworkRoute& network_route,
int bitrate_bps,
int min_bitrate_bps,
int max_bitrate_bps) override;
void SignalNetworkState(NetworkState state) override;
void SetTransportOverhead(
size_t transport_overhead_bytes_per_packet) override;
// Deprecated: Use GetBandwidthObserver instead.
RTC_DEPRECATED virtual BitrateController* GetBitrateController() const;
virtual RtcpBandwidthObserver* GetBandwidthObserver() const;
RtcpBandwidthObserver* GetBandwidthObserver() const override;
virtual bool AvailableBandwidth(uint32_t* bandwidth) const;
virtual int64_t GetPacerQueuingDelayMs() const;
virtual int64_t GetFirstPacketTimeMs() const;
bool AvailableBandwidth(uint32_t* bandwidth) const override;
int64_t GetPacerQueuingDelayMs() const override;
int64_t GetFirstPacketTimeMs() const override;
virtual TransportFeedbackObserver* GetTransportFeedbackObserver();
TransportFeedbackObserver* GetTransportFeedbackObserver() override;
RateLimiter* GetRetransmissionRateLimiter();
void EnablePeriodicAlrProbing(bool enable);
RateLimiter* GetRetransmissionRateLimiter() override;
void EnablePeriodicAlrProbing(bool enable) override;
virtual void OnSentPacket(const rtc::SentPacket& sent_packet);
void OnSentPacket(const rtc::SentPacket& sent_packet) override;
// Implements CallStatsObserver.
void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2018 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_CONGESTION_CONTROLLER_INCLUDE_SEND_SIDE_CONGESTION_CONTROLLER_INTERFACE_H_
#define MODULES_CONGESTION_CONTROLLER_INCLUDE_SEND_SIDE_CONGESTION_CONTROLLER_INTERFACE_H_
#include <memory>
#include <vector>
#include "modules/congestion_controller/include/network_changed_observer.h"
#include "modules/congestion_controller/transport_feedback_adapter.h"
#include "modules/include/module.h"
#include "modules/include/module_common_types.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/networkroute.h"
namespace rtc {
struct SentPacket;
}
namespace webrtc {
class BitrateController;
class Clock;
class AcknowledgedBitrateEstimator;
class ProbeController;
class RateLimiter;
class RtcEventLog;
class SendSideCongestionControllerInterface : public CallStatsObserver,
public Module,
public TransportFeedbackObserver {
public:
SendSideCongestionControllerInterface() = default;
~SendSideCongestionControllerInterface() override = default;
virtual void RegisterPacketFeedbackObserver(
PacketFeedbackObserver* observer) = 0;
virtual void DeRegisterPacketFeedbackObserver(
PacketFeedbackObserver* observer) = 0;
virtual void RegisterNetworkObserver(NetworkChangedObserver* observer) = 0;
virtual void DeRegisterNetworkObserver(NetworkChangedObserver* observer) = 0;
virtual void SetBweBitrates(int min_bitrate_bps,
int start_bitrate_bps,
int max_bitrate_bps) = 0;
virtual void OnNetworkRouteChanged(const rtc::NetworkRoute& network_route,
int bitrate_bps,
int min_bitrate_bps,
int max_bitrate_bps) = 0;
virtual void SignalNetworkState(NetworkState state) = 0;
virtual void SetTransportOverhead(
size_t transport_overhead_bytes_per_packet) = 0;
virtual RtcpBandwidthObserver* GetBandwidthObserver() const = 0;
virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0;
virtual int64_t GetPacerQueuingDelayMs() const = 0;
virtual int64_t GetFirstPacketTimeMs() const = 0;
virtual TransportFeedbackObserver* GetTransportFeedbackObserver() = 0;
virtual RateLimiter* GetRetransmissionRateLimiter() = 0;
virtual void EnablePeriodicAlrProbing(bool enable) = 0;
virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
RTC_DISALLOW_COPY_AND_ASSIGN(SendSideCongestionControllerInterface);
};
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_INCLUDE_SEND_SIDE_CONGESTION_CONTROLLER_INTERFACE_H_