2015-09-14 06:42:43 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-09-30 10:06:51 +02:00
|
|
|
#ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_
|
|
|
|
|
#define WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_
|
2015-09-14 06:42:43 -07:00
|
|
|
|
2016-03-01 05:32:29 -08:00
|
|
|
#include <memory>
|
2015-09-14 06:42:43 -07:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "webrtc/base/criticalsection.h"
|
|
|
|
|
#include "webrtc/base/thread_annotations.h"
|
2016-09-30 10:06:51 +02:00
|
|
|
#include "webrtc/base/thread_checker.h"
|
|
|
|
|
#include "webrtc/modules/congestion_controller/delay_based_bwe.h"
|
2015-11-04 08:31:52 +01:00
|
|
|
#include "webrtc/modules/include/module_common_types.h"
|
2015-09-14 06:42:43 -07:00
|
|
|
#include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2016-09-30 10:06:51 +02:00
|
|
|
class BitrateController;
|
2015-09-14 06:42:43 -07:00
|
|
|
class ProcessThread;
|
|
|
|
|
|
|
|
|
|
class TransportFeedbackAdapter : public TransportFeedbackObserver,
|
2016-09-12 12:28:54 -07:00
|
|
|
public CallStatsObserver {
|
2015-09-14 06:42:43 -07:00
|
|
|
public:
|
2016-09-30 10:06:51 +02:00
|
|
|
TransportFeedbackAdapter(Clock* clock, BitrateController* bitrate_controller);
|
2015-09-14 06:42:43 -07:00
|
|
|
virtual ~TransportFeedbackAdapter();
|
|
|
|
|
|
2016-09-30 10:06:51 +02:00
|
|
|
void InitBwe();
|
2016-02-17 15:52:17 +01:00
|
|
|
// Implements TransportFeedbackObserver.
|
2015-10-23 02:05:40 -07:00
|
|
|
void AddPacket(uint16_t sequence_number,
|
|
|
|
|
size_t length,
|
2016-06-01 06:31:17 -07:00
|
|
|
int probe_cluster_id) override;
|
2015-10-23 02:05:40 -07:00
|
|
|
void OnSentPacket(uint16_t sequence_number, int64_t send_time_ms);
|
2016-08-02 07:22:17 -07:00
|
|
|
|
2016-09-30 10:06:51 +02:00
|
|
|
// TODO(holmer): This method should return DelayBasedBwe::Result so that we
|
|
|
|
|
// can get rid of the dependency on BitrateController. Requires changes
|
|
|
|
|
// to the CongestionController interface.
|
2015-09-14 06:42:43 -07:00
|
|
|
void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override;
|
2016-09-07 09:58:20 +02:00
|
|
|
std::vector<PacketInfo> GetTransportFeedbackVector() const override;
|
2015-09-14 06:42:43 -07:00
|
|
|
|
2016-02-17 15:52:17 +01:00
|
|
|
// Implements CallStatsObserver.
|
|
|
|
|
void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
|
2015-09-28 03:57:14 -07:00
|
|
|
|
2016-09-30 10:06:51 +02:00
|
|
|
void SetMinBitrate(int min_bitrate_bps);
|
|
|
|
|
|
2015-09-14 06:42:43 -07:00
|
|
|
private:
|
2016-09-07 09:58:20 +02:00
|
|
|
std::vector<PacketInfo> GetPacketFeedbackVector(
|
|
|
|
|
const rtcp::TransportFeedback& feedback);
|
|
|
|
|
|
2015-09-14 06:42:43 -07:00
|
|
|
rtc::CriticalSection lock_;
|
2016-09-30 10:06:51 +02:00
|
|
|
rtc::CriticalSection bwe_lock_;
|
2015-09-14 06:42:43 -07:00
|
|
|
SendTimeHistory send_time_history_ GUARDED_BY(&lock_);
|
2016-09-30 10:06:51 +02:00
|
|
|
std::unique_ptr<DelayBasedBwe> delay_based_bwe_ GUARDED_BY(&bwe_lock_);
|
2015-09-14 06:42:43 -07:00
|
|
|
Clock* const clock_;
|
|
|
|
|
int64_t current_offset_ms_;
|
|
|
|
|
int64_t last_timestamp_us_;
|
2016-09-30 10:06:51 +02:00
|
|
|
BitrateController* const bitrate_controller_;
|
2016-09-07 09:58:20 +02:00
|
|
|
std::vector<PacketInfo> last_packet_feedback_vector_;
|
2015-09-14 06:42:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2016-09-30 10:06:51 +02:00
|
|
|
#endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_
|