| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 // This class estimates the incoming available bandwidth. | 11 // This class estimates the incoming available bandwidth. |
| 12 | 12 |
| 13 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR
_H_ | 13 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR
_H_ |
| 14 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR
_H_ | 14 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR
_H_ |
| 15 | 15 |
| 16 #include <map> | 16 #include <map> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/common_types.h" | 19 #include "webrtc/common_types.h" |
| 20 #include "webrtc/modules/interface/module.h" | 20 #include "webrtc/modules/interface/module.h" |
| 21 #include "webrtc/modules/interface/module_common_types.h" | 21 #include "webrtc/modules/interface/module_common_types.h" |
| 22 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
| 22 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
| 23 | 24 |
| 24 namespace webrtc { | 25 namespace webrtc { |
| 25 | 26 |
| 26 class Clock; | 27 class Clock; |
| 27 | 28 |
| 28 // RemoteBitrateObserver is used to signal changes in bitrate estimates for | 29 // RemoteBitrateObserver is used to signal changes in bitrate estimates for |
| 29 // the incoming streams. | 30 // the incoming streams. |
| 30 class RemoteBitrateObserver { | 31 class RemoteBitrateObserver { |
| 31 public: | 32 public: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 51 int total_propagation_time_delta_ms; | 52 int total_propagation_time_delta_ms; |
| 52 // The propagation_time_deltas for the frames arrived in the last | 53 // The propagation_time_deltas for the frames arrived in the last |
| 53 // kProcessIntervalMs using the clock passed to | 54 // kProcessIntervalMs using the clock passed to |
| 54 // RemoteBitrateEstimatorFactory::Create. | 55 // RemoteBitrateEstimatorFactory::Create. |
| 55 std::vector<int> recent_propagation_time_delta_ms; | 56 std::vector<int> recent_propagation_time_delta_ms; |
| 56 // The arrival times for the frames arrived in the last kProcessIntervalMs | 57 // The arrival times for the frames arrived in the last kProcessIntervalMs |
| 57 // using the clock passed to RemoteBitrateEstimatorFactory::Create. | 58 // using the clock passed to RemoteBitrateEstimatorFactory::Create. |
| 58 std::vector<int64_t> recent_arrival_time_ms; | 59 std::vector<int64_t> recent_arrival_time_ms; |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 struct PacketInfo { | |
| 62 PacketInfo(int64_t arrival_time_ms, | |
| 63 int64_t send_time_ms, | |
| 64 uint16_t sequence_number, | |
| 65 size_t payload_size, | |
| 66 bool was_paced) | |
| 67 : arrival_time_ms(arrival_time_ms), | |
| 68 send_time_ms(send_time_ms), | |
| 69 sequence_number(sequence_number), | |
| 70 payload_size(payload_size), | |
| 71 was_paced(was_paced) {} | |
| 72 // Time corresponding to when the packet was received. Timestamped with the | |
| 73 // receiver's clock. | |
| 74 int64_t arrival_time_ms; | |
| 75 // Time corresponding to when the packet was sent, timestamped with the | |
| 76 // sender's clock. | |
| 77 int64_t send_time_ms; | |
| 78 // Packet identifier, incremented with 1 for every packet generated by the | |
| 79 // sender. | |
| 80 uint16_t sequence_number; | |
| 81 // Size of the packet excluding RTP headers. | |
| 82 size_t payload_size; | |
| 83 // True if the packet was paced out by the pacer. | |
| 84 bool was_paced; | |
| 85 }; | |
| 86 | |
| 87 class RemoteBitrateEstimator : public CallStatsObserver, public Module { | 62 class RemoteBitrateEstimator : public CallStatsObserver, public Module { |
| 88 public: | 63 public: |
| 64 static const int kDefaultMinBitrateBps = 30000; |
| 89 virtual ~RemoteBitrateEstimator() {} | 65 virtual ~RemoteBitrateEstimator() {} |
| 90 | 66 |
| 91 virtual void IncomingPacketFeedbackVector( | 67 virtual void IncomingPacketFeedbackVector( |
| 92 const std::vector<PacketInfo>& packet_feedback_vector) { | 68 const std::vector<PacketInfo>& packet_feedback_vector) { |
| 93 assert(false); | 69 assert(false); |
| 94 } | 70 } |
| 95 | 71 |
| 96 // Called for each incoming packet. Updates the incoming payload bitrate | 72 // Called for each incoming packet. Updates the incoming payload bitrate |
| 97 // estimate and the over-use detector. If an over-use is detected the | 73 // estimate and the over-use detector. If an over-use is detected the |
| 98 // remote bitrate estimate will be updated. Note that |payload_size| is the | 74 // remote bitrate estimate will be updated. Note that |payload_size| is the |
| (...skipping 17 matching lines...) Expand all Loading... |
| 116 virtual bool GetStats(ReceiveBandwidthEstimatorStats* output) const = 0; | 92 virtual bool GetStats(ReceiveBandwidthEstimatorStats* output) const = 0; |
| 117 | 93 |
| 118 protected: | 94 protected: |
| 119 static const int64_t kProcessIntervalMs = 500; | 95 static const int64_t kProcessIntervalMs = 500; |
| 120 static const int64_t kStreamTimeOutMs = 2000; | 96 static const int64_t kStreamTimeOutMs = 2000; |
| 121 }; | 97 }; |
| 122 | 98 |
| 123 } // namespace webrtc | 99 } // namespace webrtc |
| 124 | 100 |
| 125 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMA
TOR_H_ | 101 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMA
TOR_H_ |
| OLD | NEW |