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

Side by Side Diff: webrtc/modules/congestion_controller/include/receive_side_congestion_controller.h

Issue 2752233002: Split CongestionController into send- and receive-side classes. (Closed)
Patch Set: Deleted ReceiveSideCongestionController::OnNetworkRouteChanged. Created 3 years, 9 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
(Empty)
1 /*
2 * Copyright (c) 2017 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 WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_RECEIVE_SIDE_CONGESTION_CON TROLLER_H_
12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_RECEIVE_SIDE_CONGESTION_CON TROLLER_H_
13
14 #include <memory>
15 #include <vector>
16
17 #include "webrtc/base/constructormagic.h"
18 #include "webrtc/base/criticalsection.h"
19 #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h"
20
21 namespace webrtc {
22 class RemoteBitrateEstimator;
23 class RemoteBitrateObserver;
24
25 // This class represents the congestion control state for receive
26 // streams. For send side bandwidth estimation, this is simply
27 // relaying for each received RTP packet back to the sender. While for
28 // receive side bandwidth estimation, we do the estimation locally and
29 // send our results back to the sender.
30 class ReceiveSideCongestionController : public CallStatsObserver,
31 public Module {
32 public:
33 ReceiveSideCongestionController(
34 const Clock* clock,
35 RemoteBitrateObserver* remote_bitrate_observer,
36 PacketRouter* packet_router);
37
38 virtual ~ReceiveSideCongestionController() {}
39
40 virtual void OnReceivedPacket(int64_t arrival_time_ms,
41 size_t payload_size,
42 const RTPHeader& header);
43
44 // TODO(nisse): Delete these methods, design a more specific interface.
45 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator(bool send_side_bwe);
46 virtual const RemoteBitrateEstimator* GetRemoteBitrateEstimator(
47 bool send_side_bwe) const;
48
49 // TODO(nisse): Called by CongestionController, but not otherwise wired up.
50 // Implements CallStatsObserver.
51 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
52
53 // Implements Module.
54 int64_t TimeUntilNextProcess() override;
55 void Process() override;
56
57 private:
58 class WrappingBitrateEstimator : public RemoteBitrateEstimator {
59 public:
60 WrappingBitrateEstimator(RemoteBitrateObserver* observer,
61 const Clock* clock);
62
63 virtual ~WrappingBitrateEstimator() {}
64
65 void IncomingPacket(int64_t arrival_time_ms,
66 size_t payload_size,
67 const RTPHeader& header) override;
68
69 void Process() override;
70
71 int64_t TimeUntilNextProcess() override;
72
73 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
74
75 void RemoveStream(unsigned int ssrc) override;
76
77 bool LatestEstimate(std::vector<unsigned int>* ssrcs,
78 unsigned int* bitrate_bps) const override;
79
80 void SetMinBitrate(int min_bitrate_bps) override;
81
82 private:
83 void PickEstimatorFromHeader(const RTPHeader& header)
84 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
85 void PickEstimator() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
86 RemoteBitrateObserver* observer_;
87 const Clock* const clock_;
88 rtc::CriticalSection crit_sect_;
89 std::unique_ptr<RemoteBitrateEstimator> rbe_;
90 bool using_absolute_send_time_;
91 uint32_t packets_since_absolute_send_time_;
92 int min_bitrate_bps_;
93
94 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WrappingBitrateEstimator);
95 };
96
97 WrappingBitrateEstimator remote_bitrate_estimator_;
98 RemoteEstimatorProxy remote_estimator_proxy_;
99 };
100
101 } // namespace webrtc
102
103 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_RECEIVE_SIDE_CONGESTION_ CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698