OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 uint16_t AllocateSequenceNumber() override; | 76 uint16_t AllocateSequenceNumber() override; |
77 | 77 |
78 // Called every time there is a new bitrate estimate for a receive channel | 78 // Called every time there is a new bitrate estimate for a receive channel |
79 // group. This call will trigger a new RTCP REMB packet if the bitrate | 79 // group. This call will trigger a new RTCP REMB packet if the bitrate |
80 // estimate has decreased or if no RTCP REMB packet has been sent for | 80 // estimate has decreased or if no RTCP REMB packet has been sent for |
81 // a certain time interval. | 81 // a certain time interval. |
82 // Implements RtpReceiveBitrateUpdate. | 82 // Implements RtpReceiveBitrateUpdate. |
83 void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, | 83 void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, |
84 uint32_t bitrate_bps) override; | 84 uint32_t bitrate_bps) override; |
85 | 85 |
| 86 // Ensures remote party notified of the receive bitrate limit no larger than |
| 87 // |bitrate_bps|. |
| 88 void SetMaxDesiredReceiveBitrate(uint32_t bitrate_bps); |
| 89 |
86 // Send REMB feedback. | 90 // Send REMB feedback. |
87 virtual bool SendRemb(uint32_t bitrate_bps, | 91 virtual bool SendRemb(uint32_t bitrate_bps, |
88 const std::vector<uint32_t>& ssrcs); | 92 const std::vector<uint32_t>& ssrcs); |
89 | 93 |
90 // Send transport feedback packet to send-side. | 94 // Send transport feedback packet to send-side. |
91 virtual bool SendTransportFeedback(rtcp::TransportFeedback* packet); | 95 virtual bool SendTransportFeedback(rtcp::TransportFeedback* packet); |
92 | 96 |
93 private: | 97 private: |
94 void AddRembModuleCandidate(RtpRtcp* candidate_module, bool sender) | 98 void AddRembModuleCandidate(RtpRtcp* candidate_module, bool sender) |
95 EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); | 99 EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); |
96 void MaybeRemoveRembModuleCandidate(RtpRtcp* candidate_module, bool sender) | 100 void MaybeRemoveRembModuleCandidate(RtpRtcp* candidate_module, bool sender) |
97 EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); | 101 EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); |
98 void UnsetActiveRembModule() EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); | 102 void UnsetActiveRembModule() EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); |
99 void DetermineActiveRembModule() EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); | 103 void DetermineActiveRembModule() EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); |
100 | 104 |
101 rtc::RaceChecker pacer_race_; | 105 rtc::RaceChecker pacer_race_; |
102 rtc::CriticalSection modules_crit_; | 106 rtc::CriticalSection modules_crit_; |
103 std::list<RtpRtcp*> rtp_send_modules_ GUARDED_BY(modules_crit_); | 107 std::list<RtpRtcp*> rtp_send_modules_ GUARDED_BY(modules_crit_); |
104 std::vector<RtpRtcp*> rtp_receive_modules_ GUARDED_BY(modules_crit_); | 108 std::vector<RtpRtcp*> rtp_receive_modules_ GUARDED_BY(modules_crit_); |
105 | 109 |
106 // TODO(eladalon): remb_crit_ only ever held from one function, and it's not | 110 // TODO(eladalon): remb_crit_ only ever held from one function, and it's not |
107 // clear if that function can actually be called from more than one thread. | 111 // clear if that function can actually be called from more than one thread. |
108 rtc::CriticalSection remb_crit_; | 112 rtc::CriticalSection remb_crit_; |
109 // The last time a REMB was sent. | 113 // The last time a REMB was sent. |
110 int64_t last_remb_time_ms_ GUARDED_BY(remb_crit_); | 114 int64_t last_remb_time_ms_ GUARDED_BY(remb_crit_); |
111 uint32_t last_send_bitrate_bps_ GUARDED_BY(remb_crit_); | 115 uint32_t last_send_bitrate_bps_ GUARDED_BY(remb_crit_); |
112 // The last bitrate update. | 116 // The last bitrate update. |
113 uint32_t bitrate_bps_ GUARDED_BY(remb_crit_); | 117 uint32_t bitrate_bps_ GUARDED_BY(remb_crit_); |
| 118 uint32_t max_bitrate_bps_ GUARDED_BY(remb_crit_); |
114 | 119 |
115 // Candidates for the REMB module can be RTP sender/receiver modules, with | 120 // Candidates for the REMB module can be RTP sender/receiver modules, with |
116 // the sender modules taking precedence. | 121 // the sender modules taking precedence. |
117 std::vector<RtpRtcp*> sender_remb_candidates_ GUARDED_BY(modules_crit_); | 122 std::vector<RtpRtcp*> sender_remb_candidates_ GUARDED_BY(modules_crit_); |
118 std::vector<RtpRtcp*> receiver_remb_candidates_ GUARDED_BY(modules_crit_); | 123 std::vector<RtpRtcp*> receiver_remb_candidates_ GUARDED_BY(modules_crit_); |
119 RtpRtcp* active_remb_module_ GUARDED_BY(modules_crit_); | 124 RtpRtcp* active_remb_module_ GUARDED_BY(modules_crit_); |
120 | 125 |
121 volatile int transport_seq_; | 126 volatile int transport_seq_; |
122 | 127 |
123 RTC_DISALLOW_COPY_AND_ASSIGN(PacketRouter); | 128 RTC_DISALLOW_COPY_AND_ASSIGN(PacketRouter); |
124 }; | 129 }; |
125 } // namespace webrtc | 130 } // namespace webrtc |
126 #endif // WEBRTC_MODULES_PACING_PACKET_ROUTER_H_ | 131 #endif // WEBRTC_MODULES_PACING_PACKET_ROUTER_H_ |
OLD | NEW |