Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / modules / remote_bitrate_estimator / include / remote_bitrate_estimator.h
index 5bf8af9..a68879a 100644 (file)
@@ -37,6 +37,27 @@ class RemoteBitrateObserver {
   virtual ~RemoteBitrateObserver() {}
 };
 
+struct ReceiveBandwidthEstimatorStats {
+  ReceiveBandwidthEstimatorStats() : total_propagation_time_delta_ms(0) {}
+
+  // The "propagation_time_delta" of a frame is defined as (d_arrival - d_sent),
+  // where d_arrival is the delta of the arrival times of the frame and the
+  // previous frame, d_sent is the delta of the sent times of the frame and
+  // the previous frame. The sent time is calculated from the RTP timestamp.
+
+  // |total_propagation_time_delta_ms| is the sum of the propagation_time_deltas
+  // of all received frames, except that it's is adjusted to 0 when it becomes
+  // negative.
+  int total_propagation_time_delta_ms;
+  // The propagation_time_deltas for the frames arrived in the last
+  // kProcessIntervalMs using the clock passed to
+  // RemoteBitrateEstimatorFactory::Create.
+  std::vector<int> recent_propagation_time_delta_ms;
+  // The arrival times for the frames arrived in the last kProcessIntervalMs
+  // using the clock passed to RemoteBitrateEstimatorFactory::Create.
+  std::vector<int64_t> recent_arrival_time_ms;
+};
+
 class RemoteBitrateEstimator : public CallStatsObserver, public Module {
  public:
   virtual ~RemoteBitrateEstimator() {}
@@ -58,6 +79,9 @@ class RemoteBitrateEstimator : public CallStatsObserver, public Module {
   virtual bool LatestEstimate(std::vector<unsigned int>* ssrcs,
                               unsigned int* bitrate_bps) const = 0;
 
+  // Returns true if the statistics are available.
+  virtual bool GetStats(ReceiveBandwidthEstimatorStats* output) const = 0;
+
  protected:
   static const int kProcessIntervalMs = 1000;
   static const int kStreamTimeOutMs = 2000;
@@ -69,7 +93,8 @@ struct RemoteBitrateEstimatorFactory {
 
   virtual RemoteBitrateEstimator* Create(
       RemoteBitrateObserver* observer,
-      Clock* clock) const;
+      Clock* clock,
+      uint32_t min_bitrate_bps) const;
 };
 
 struct AbsoluteSendTimeRemoteBitrateEstimatorFactory
@@ -79,7 +104,8 @@ struct AbsoluteSendTimeRemoteBitrateEstimatorFactory
 
   virtual RemoteBitrateEstimator* Create(
       RemoteBitrateObserver* observer,
-      Clock* clock) const;
+      Clock* clock,
+      uint32_t min_bitrate_bps) const;
 };
 }  // namespace webrtc