tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

rtp_packet_pacer.h (2614B)


      1 /*
      2 *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #ifndef MODULES_PACING_RTP_PACKET_PACER_H_
     12 #define MODULES_PACING_RTP_PACKET_PACER_H_
     13 
     14 #include <optional>
     15 #include <vector>
     16 
     17 #include "api/transport/network_types.h"
     18 #include "api/units/data_rate.h"
     19 #include "api/units/data_size.h"
     20 #include "api/units/time_delta.h"
     21 #include "api/units/timestamp.h"
     22 
     23 namespace webrtc {
     24 
     25 class RtpPacketPacer {
     26 public:
     27  virtual ~RtpPacketPacer() = default;
     28 
     29  virtual void CreateProbeClusters(
     30      std::vector<ProbeClusterConfig> probe_cluster_configs) = 0;
     31 
     32  // Temporarily pause all sending.
     33  virtual void Pause() = 0;
     34 
     35  // Resume sending packets.
     36  virtual void Resume() = 0;
     37 
     38  virtual void SetCongested(bool congested) = 0;
     39 
     40  // Sets the pacing rates. Must be called once before packets can be sent.
     41  virtual void SetPacingRates(DataRate pacing_rate, DataRate padding_rate) = 0;
     42 
     43  // Time since the oldest packet currently in the queue was added.
     44  virtual TimeDelta OldestPacketWaitTime() const = 0;
     45 
     46  // Sum of payload + padding bytes of all packets currently in the pacer queue.
     47  virtual DataSize QueueSizeData() const = 0;
     48 
     49  // Returns the time when the first packet was sent.
     50  virtual std::optional<Timestamp> FirstSentPacketTime() const = 0;
     51 
     52  // Returns the expected number of milliseconds it will take to send the
     53  // current packets in the queue, given the current size and bitrate, ignoring
     54  // priority.
     55  virtual TimeDelta ExpectedQueueTime() const = 0;
     56 
     57  // Set the average upper bound on pacer queuing delay. The pacer may send at
     58  // a higher rate than what was configured via SetPacingRates() in order to
     59  // keep ExpectedQueueTimeMs() below `limit_ms` on average.
     60  virtual void SetQueueTimeLimit(TimeDelta limit) = 0;
     61 
     62  // Currently audio traffic is not accounted by pacer and passed through.
     63  // With the introduction of audio BWE audio traffic will be accounted for
     64  // the pacer budget calculation. The audio traffic still will be injected
     65  // at high priority.
     66  virtual void SetAccountForAudioPackets(bool account_for_audio) = 0;
     67  virtual void SetIncludeOverhead() = 0;
     68  virtual void SetTransportOverhead(DataSize overhead_per_packet) = 0;
     69 };
     70 
     71 }  // namespace webrtc
     72 #endif  // MODULES_PACING_RTP_PACKET_PACER_H_