Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h

Issue 1699903003: Update bitrate only when we have incoming packet. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix lint Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 20 matching lines...) Expand all
31 class RemoteBitrateObserver { 31 class RemoteBitrateObserver {
32 public: 32 public:
33 // Called when a receive channel group has a new bitrate estimate for the 33 // Called when a receive channel group has a new bitrate estimate for the
34 // incoming streams. 34 // incoming streams.
35 virtual void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, 35 virtual void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs,
36 uint32_t bitrate) = 0; 36 uint32_t bitrate) = 0;
37 37
38 virtual ~RemoteBitrateObserver() {} 38 virtual ~RemoteBitrateObserver() {}
39 }; 39 };
40 40
41 struct ReceiveBandwidthEstimatorStats {
42 ReceiveBandwidthEstimatorStats() : total_propagation_time_delta_ms(0) {}
43
44 // The "propagation_time_delta" of a frame is defined as (d_arrival - d_sent),
45 // where d_arrival is the delta of the arrival times of the frame and the
46 // previous frame, d_sent is the delta of the sent times of the frame and
47 // the previous frame. The sent time is calculated from the RTP timestamp.
48
49 // |total_propagation_time_delta_ms| is the sum of the propagation_time_deltas
50 // of all received frames, except that it's is adjusted to 0 when it becomes
51 // negative.
52 int total_propagation_time_delta_ms;
53 // The propagation_time_deltas for the frames arrived in the last
54 // kProcessIntervalMs using the clock passed to
55 // RemoteBitrateEstimatorFactory::Create.
56 std::vector<int> recent_propagation_time_delta_ms;
57 // The arrival times for the frames arrived in the last kProcessIntervalMs
58 // using the clock passed to RemoteBitrateEstimatorFactory::Create.
59 std::vector<int64_t> recent_arrival_time_ms;
60 };
61
62 class RemoteBitrateEstimator : public CallStatsObserver, public Module { 41 class RemoteBitrateEstimator : public CallStatsObserver, public Module {
63 public: 42 public:
64 static const int kDefaultMinBitrateBps = 30000; 43 static const int kDefaultMinBitrateBps = 30000;
65 virtual ~RemoteBitrateEstimator() {} 44 virtual ~RemoteBitrateEstimator() {}
66 45
67 virtual void IncomingPacketFeedbackVector( 46 virtual void IncomingPacketFeedbackVector(
68 const std::vector<PacketInfo>& packet_feedback_vector) { 47 const std::vector<PacketInfo>& packet_feedback_vector) {
69 assert(false); 48 assert(false);
70 } 49 }
71 50
72 // Called for each incoming packet. Updates the incoming payload bitrate 51 // Called for each incoming packet. Updates the incoming payload bitrate
73 // estimate and the over-use detector. If an over-use is detected the 52 // estimate and the over-use detector. If an over-use is detected the
74 // remote bitrate estimate will be updated. Note that |payload_size| is the 53 // remote bitrate estimate will be updated. Note that |payload_size| is the
75 // packet size excluding headers. 54 // packet size excluding headers.
76 // Note that |arrival_time_ms| can be of an arbitrary time base. 55 // Note that |arrival_time_ms| can be of an arbitrary time base.
77 virtual void IncomingPacket(int64_t arrival_time_ms, 56 virtual void IncomingPacket(int64_t arrival_time_ms,
78 size_t payload_size, 57 size_t payload_size,
79 const RTPHeader& header, 58 const RTPHeader& header,
80 bool was_paced) = 0; 59 bool was_paced) = 0;
81 60
82 // Removes all data for |ssrc|. 61 // Removes all data for |ssrc|.
83 virtual void RemoveStream(uint32_t ssrc) = 0; 62 virtual void RemoveStream(uint32_t ssrc) = 0;
84 63
85 // Returns true if a valid estimate exists and sets |bitrate_bps| to the 64 // Returns true if a valid estimate exists and sets |bitrate_bps| to the
86 // estimated payload bitrate in bits per second. |ssrcs| is the list of ssrcs 65 // estimated payload bitrate in bits per second. |ssrcs| is the list of ssrcs
87 // currently being received and of which the bitrate estimate is based upon. 66 // currently being received and of which the bitrate estimate is based upon.
88 virtual bool LatestEstimate(std::vector<uint32_t>* ssrcs, 67 virtual bool LatestEstimate(std::vector<uint32_t>* ssrcs,
89 uint32_t* bitrate_bps) const = 0; 68 uint32_t* bitrate_bps) const = 0;
90 69
91 // Returns true if the statistics are available.
92 virtual bool GetStats(ReceiveBandwidthEstimatorStats* output) const = 0;
93
94 virtual void SetMinBitrate(int min_bitrate_bps) = 0; 70 virtual void SetMinBitrate(int min_bitrate_bps) = 0;
95 71
96 protected: 72 protected:
97 static const int64_t kProcessIntervalMs = 500; 73 static const int64_t kProcessIntervalMs = 500;
98 static const int64_t kStreamTimeOutMs = 2000; 74 static const int64_t kStreamTimeOutMs = 2000;
99 }; 75 };
100 76
101 } // namespace webrtc 77 } // namespace webrtc
102 78
103 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMA TOR_H_ 79 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMA TOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698