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

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

Issue 2378103005: Reland: Fix race / crash in OnNetworkRouteChanged(). (Closed)
Patch Set: . Created 4 years, 2 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 * Usage: this class will register multiple RtcpBitrateObserver's one at each 10 * Usage: this class will register multiple RtcpBitrateObserver's one at each
11 * RTCP module. It will aggregate the results and run one bandwidth estimation 11 * RTCP module. It will aggregate the results and run one bandwidth estimation
12 * and push the result to the encoders via BitrateObserver(s). 12 * and push the result to the encoders via BitrateObserver(s).
13 */ 13 */
14 14
15 #ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ 15 #ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_
16 #define WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ 16 #define WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_
17 17
18 #include <map> 18 #include <map>
19 19
20 #include "webrtc/modules/congestion_controller/delay_based_bwe.h"
20 #include "webrtc/modules/include/module.h" 21 #include "webrtc/modules/include/module.h"
21 #include "webrtc/modules/pacing/paced_sender.h" 22 #include "webrtc/modules/pacing/paced_sender.h"
22 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h"
23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
24 24
25 namespace webrtc { 25 namespace webrtc {
26 26
27 class CriticalSectionWrapper; 27 class CriticalSectionWrapper;
28 class RtcEventLog; 28 class RtcEventLog;
29 struct PacketInfo; 29 struct PacketInfo;
30 30
31 // Deprecated 31 // Deprecated
32 // TODO(perkj): Remove BitrateObserver when no implementations use it. 32 // TODO(perkj): Remove BitrateObserver when no implementations use it.
33 class BitrateObserver { 33 class BitrateObserver {
34 // Observer class for bitrate changes announced due to change in bandwidth 34 // Observer class for bitrate changes announced due to change in bandwidth
35 // estimate or due to bitrate allocation changes. Fraction loss and rtt is 35 // estimate or due to bitrate allocation changes. Fraction loss and rtt is
36 // also part of this callback to allow the obsevrer to optimize its settings 36 // also part of this callback to allow the obsevrer to optimize its settings
37 // for different types of network environments. The bitrate does not include 37 // for different types of network environments. The bitrate does not include
38 // packet headers and is measured in bits per second. 38 // packet headers and is measured in bits per second.
39 public: 39 public:
40 virtual void OnNetworkChanged(uint32_t bitrate_bps, 40 virtual void OnNetworkChanged(uint32_t bitrate_bps,
41 uint8_t fraction_loss, // 0 - 255. 41 uint8_t fraction_loss, // 0 - 255.
42 int64_t rtt_ms) = 0; 42 int64_t rtt_ms) = 0;
43 43
44 virtual ~BitrateObserver() {} 44 virtual ~BitrateObserver() {}
45 }; 45 };
46 46
47 class BitrateController : public Module, public RemoteBitrateObserver { 47 class BitrateController : public Module {
48 // This class collects feedback from all streams sent to a peer (via 48 // This class collects feedback from all streams sent to a peer (via
49 // RTCPBandwidthObservers). It does one aggregated send side bandwidth 49 // RTCPBandwidthObservers). It does one aggregated send side bandwidth
50 // estimation and divide the available bitrate between all its registered 50 // estimation and divide the available bitrate between all its registered
51 // BitrateObservers. 51 // BitrateObservers.
52 public: 52 public:
53 static const int kDefaultStartBitratebps = 300000; 53 static const int kDefaultStartBitratebps = 300000;
54 54
55 // Deprecated: 55 // Deprecated:
56 // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC. 56 // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC.
57 // Remove this method once other other projects does not use it. 57 // Remove this method once other other projects does not use it.
(...skipping 13 matching lines...) Expand all
71 // Deprecated 71 // Deprecated
72 virtual void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) = 0; 72 virtual void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) = 0;
73 virtual void SetBitrates(int start_bitrate_bps, 73 virtual void SetBitrates(int start_bitrate_bps,
74 int min_bitrate_bps, 74 int min_bitrate_bps,
75 int max_bitrate_bps) = 0; 75 int max_bitrate_bps) = 0;
76 76
77 virtual void ResetBitrates(int bitrate_bps, 77 virtual void ResetBitrates(int bitrate_bps,
78 int min_bitrate_bps, 78 int min_bitrate_bps,
79 int max_bitrate_bps) = 0; 79 int max_bitrate_bps) = 0;
80 80
81 virtual void OnDelayBasedBweResult(const DelayBasedBwe::Result& result) = 0;
82
81 // Gets the available payload bandwidth in bits per second. Note that 83 // Gets the available payload bandwidth in bits per second. Note that
82 // this bandwidth excludes packet headers. 84 // this bandwidth excludes packet headers.
83 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0; 85 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0;
84 86
85 virtual void SetReservedBitrate(uint32_t reserved_bitrate_bps) = 0; 87 virtual void SetReservedBitrate(uint32_t reserved_bitrate_bps) = 0;
86 88
87 virtual bool GetNetworkParameters(uint32_t* bitrate, 89 virtual bool GetNetworkParameters(uint32_t* bitrate,
88 uint8_t* fraction_loss, 90 uint8_t* fraction_loss,
89 int64_t* rtt) = 0; 91 int64_t* rtt) = 0;
90 }; 92 };
91 } // namespace webrtc 93 } // namespace webrtc
92 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_ 94 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc ('k') | webrtc/modules/congestion_controller/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698