webrtc_m130/modules/congestion_controller/transport_feedback_adapter.h
Sebastian Jansson aa01f27667 Removes all const Clock*.
This prepares for making the Clock interface fully mutable.

Calls to the time functions in Clock can have side effects in some
circumstances. It's also questionable if it's a good idea to allow
repeated calls to a const method return different values without
any changed to the class instance.

Bug: webrtc:9883
Change-Id: I96fb9230705f7c80a4c0702132fd9dc73899fc5e
Reviewed-on: https://webrtc-review.googlesource.com/c/120347
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26467}
2019-01-30 13:03:37 +00:00

84 lines
2.9 KiB
C++

/*
* 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.
*/
#ifndef MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_
#define MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_
#include <deque>
#include <vector>
#include "api/transport/network_types.h"
#include "modules/congestion_controller/rtp/send_time_history.h"
#include "rtc_base/critical_section.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/thread_checker.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
class PacketFeedbackObserver;
namespace rtcp {
class TransportFeedback;
} // namespace rtcp
// Deprecated, use version in
// modules/congeestion_controller/rtp/transport_feedback_adapter.h
class LegacyTransportFeedbackAdapter {
public:
explicit LegacyTransportFeedbackAdapter(Clock* clock);
virtual ~LegacyTransportFeedbackAdapter();
void RegisterPacketFeedbackObserver(PacketFeedbackObserver* observer);
void DeRegisterPacketFeedbackObserver(PacketFeedbackObserver* observer);
void AddPacket(uint32_t ssrc,
uint16_t sequence_number,
size_t length,
const PacedPacketInfo& pacing_info);
void OnSentPacket(uint16_t sequence_number, int64_t send_time_ms);
// 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.
void OnTransportFeedback(const rtcp::TransportFeedback& feedback);
std::vector<PacketFeedback> GetTransportFeedbackVector() const;
absl::optional<int64_t> GetMinFeedbackLoopRtt() const;
void SetTransportOverhead(size_t transport_overhead_bytes_per_packet);
void SetNetworkIds(uint16_t local_id, uint16_t remote_id);
size_t GetOutstandingBytes() const;
private:
std::vector<PacketFeedback> GetPacketFeedbackVector(
const rtcp::TransportFeedback& feedback);
rtc::CriticalSection lock_;
SendTimeHistory send_time_history_ RTC_GUARDED_BY(&lock_);
Clock* const clock_;
int64_t current_offset_ms_;
int64_t last_timestamp_us_;
std::vector<PacketFeedback> last_packet_feedback_vector_;
uint16_t local_net_id_ RTC_GUARDED_BY(&lock_);
uint16_t remote_net_id_ RTC_GUARDED_BY(&lock_);
std::deque<int64_t> feedback_rtts_ RTC_GUARDED_BY(&lock_);
absl::optional<int64_t> min_feedback_rtt_ RTC_GUARDED_BY(&lock_);
rtc::CriticalSection observers_lock_;
std::vector<PacketFeedbackObserver*> observers_
RTC_GUARDED_BY(&observers_lock_);
};
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_