summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/modules/remote_bitrate_estimator/include
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libwebrtc/modules/remote_bitrate_estimator/include')
-rw-r--r--third_party/libwebrtc/modules/remote_bitrate_estimator/include/bwe_defines.h47
-rw-r--r--third_party/libwebrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h64
2 files changed, 111 insertions, 0 deletions
diff --git a/third_party/libwebrtc/modules/remote_bitrate_estimator/include/bwe_defines.h b/third_party/libwebrtc/modules/remote_bitrate_estimator/include/bwe_defines.h
new file mode 100644
index 0000000000..4596b13863
--- /dev/null
+++ b/third_party/libwebrtc/modules/remote_bitrate_estimator/include/bwe_defines.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012 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_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_
+#define MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_
+
+#include <stdint.h>
+
+#include "absl/types/optional.h"
+#include "api/network_state_predictor.h"
+#include "api/units/data_rate.h"
+#include "api/units/time_delta.h"
+
+namespace webrtc {
+
+inline constexpr DataRate kCongestionControllerMinBitrate =
+ DataRate::BitsPerSec(5'000);
+inline constexpr TimeDelta kBitrateWindow = TimeDelta::Seconds(1);
+
+extern const char kBweTypeHistogram[];
+
+enum BweNames {
+ kReceiverNoExtension = 0,
+ kReceiverTOffset = 1,
+ kReceiverAbsSendTime = 2,
+ kSendSideTransportSeqNum = 3,
+ kBweNamesMax = 4
+};
+
+struct RateControlInput {
+ RateControlInput(BandwidthUsage bw_state,
+ const absl::optional<DataRate>& estimated_throughput);
+ ~RateControlInput();
+
+ BandwidthUsage bw_state;
+ absl::optional<DataRate> estimated_throughput;
+};
+} // namespace webrtc
+
+#endif // MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_
diff --git a/third_party/libwebrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h b/third_party/libwebrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h
new file mode 100644
index 0000000000..14a80111ed
--- /dev/null
+++ b/third_party/libwebrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2012 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.
+ */
+
+// This class estimates the incoming available bandwidth.
+
+#ifndef MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR_H_
+#define MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR_H_
+
+#include <cstdint>
+#include <vector>
+
+#include "api/units/data_rate.h"
+#include "api/units/time_delta.h"
+#include "modules/include/module_common_types.h"
+#include "modules/rtp_rtcp/source/rtp_packet_received.h"
+
+namespace webrtc {
+
+class Clock;
+
+// RemoteBitrateObserver is used to signal changes in bitrate estimates for
+// the incoming streams.
+class RemoteBitrateObserver {
+ public:
+ // Called when a receive channel group has a new bitrate estimate for the
+ // incoming streams.
+ virtual void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs,
+ uint32_t bitrate) = 0;
+
+ virtual ~RemoteBitrateObserver() {}
+};
+
+class RemoteBitrateEstimator : public CallStatsObserver {
+ public:
+ ~RemoteBitrateEstimator() override {}
+
+ // Called for each incoming packet. Updates the incoming payload bitrate
+ // estimate and the over-use detector. If an over-use is detected the
+ // remote bitrate estimate will be updated.
+ virtual void IncomingPacket(const RtpPacketReceived& rtp_packet) = 0;
+
+ // Removes all data for `ssrc`.
+ virtual void RemoveStream(uint32_t ssrc) = 0;
+
+ // Returns latest estimate or DataRate::Zero() if estimation is unavailable.
+ virtual DataRate LatestEstimate() const = 0;
+
+ virtual TimeDelta Process() = 0;
+
+ protected:
+ static constexpr TimeDelta kProcessInterval = TimeDelta::Millis(500);
+ static constexpr TimeDelta kStreamTimeOut = TimeDelta::Seconds(2);
+};
+
+} // namespace webrtc
+
+#endif // MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR_H_