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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 PacketRouter(); | 42 PacketRouter(); |
43 ~PacketRouter() override; | 43 ~PacketRouter() override; |
44 | 44 |
45 // TODO(nisse): Delete, as soon as downstream app is updated. | 45 // TODO(nisse): Delete, as soon as downstream app is updated. |
46 RTC_DEPRECATED void AddRtpModule(RtpRtcp* rtp_module) { | 46 RTC_DEPRECATED void AddRtpModule(RtpRtcp* rtp_module) { |
47 AddReceiveRtpModule(rtp_module); | 47 AddReceiveRtpModule(rtp_module); |
48 } | 48 } |
49 RTC_DEPRECATED void RemoveRtpModule(RtpRtcp* rtp_module) { | 49 RTC_DEPRECATED void RemoveRtpModule(RtpRtcp* rtp_module) { |
50 RemoveReceiveRtpModule(rtp_module); | 50 RemoveReceiveRtpModule(rtp_module); |
51 } | 51 } |
52 void AddSendRtpModule(RtpRtcp* rtp_module); | 52 |
| 53 void AddSendRtpModule(RtpRtcp* rtp_module, bool remb_candidate); |
53 void RemoveSendRtpModule(RtpRtcp* rtp_module); | 54 void RemoveSendRtpModule(RtpRtcp* rtp_module); |
| 55 RTC_DEPRECATED void AddSendRtpModule(RtpRtcp* rtp_module) { |
| 56 AddSendRtpModule(rtp_module, true); |
| 57 } |
54 | 58 |
55 void AddReceiveRtpModule(RtpRtcp* rtp_module); | 59 void AddReceiveRtpModule(RtpRtcp* rtp_module, bool remb_candidate); |
56 void RemoveReceiveRtpModule(RtpRtcp* rtp_module); | 60 void RemoveReceiveRtpModule(RtpRtcp* rtp_module); |
| 61 RTC_DEPRECATED void AddReceiveRtpModule(RtpRtcp* rtp_module) { |
| 62 AddReceiveRtpModule(rtp_module, true); |
| 63 } |
57 | 64 |
58 // Implements PacedSender::Callback. | 65 // Implements PacedSender::Callback. |
59 bool TimeToSendPacket(uint32_t ssrc, | 66 bool TimeToSendPacket(uint32_t ssrc, |
60 uint16_t sequence_number, | 67 uint16_t sequence_number, |
61 int64_t capture_timestamp, | 68 int64_t capture_timestamp, |
62 bool retransmission, | 69 bool retransmission, |
63 const PacedPacketInfo& packet_info) override; | 70 const PacedPacketInfo& packet_info) override; |
64 | 71 |
65 size_t TimeToSendPadding(size_t bytes, | 72 size_t TimeToSendPadding(size_t bytes, |
66 const PacedPacketInfo& packet_info) override; | 73 const PacedPacketInfo& packet_info) override; |
(...skipping 10 matching lines...) Expand all Loading... |
77 uint32_t bitrate_bps) override; | 84 uint32_t bitrate_bps) override; |
78 | 85 |
79 // Send REMB feedback. | 86 // Send REMB feedback. |
80 virtual bool SendRemb(uint32_t bitrate_bps, | 87 virtual bool SendRemb(uint32_t bitrate_bps, |
81 const std::vector<uint32_t>& ssrcs); | 88 const std::vector<uint32_t>& ssrcs); |
82 | 89 |
83 // Send transport feedback packet to send-side. | 90 // Send transport feedback packet to send-side. |
84 virtual bool SendTransportFeedback(rtcp::TransportFeedback* packet); | 91 virtual bool SendTransportFeedback(rtcp::TransportFeedback* packet); |
85 | 92 |
86 private: | 93 private: |
| 94 void AddRembModuleCandidate(RtpRtcp* candidate_module, bool sender) |
| 95 EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); |
| 96 void MaybeRemoveRembModuleCandidate(RtpRtcp* candidate_module, bool sender) |
| 97 EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); |
| 98 void UnsetActiveRembModule() EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); |
| 99 void DetermineActiveRembModule() EXCLUSIVE_LOCKS_REQUIRED(modules_crit_); |
| 100 |
87 rtc::RaceChecker pacer_race_; | 101 rtc::RaceChecker pacer_race_; |
88 rtc::CriticalSection modules_crit_; | 102 rtc::CriticalSection modules_crit_; |
89 std::list<RtpRtcp*> rtp_send_modules_ GUARDED_BY(modules_crit_); | 103 std::list<RtpRtcp*> rtp_send_modules_ GUARDED_BY(modules_crit_); |
90 std::vector<RtpRtcp*> rtp_receive_modules_ GUARDED_BY(modules_crit_); | 104 std::vector<RtpRtcp*> rtp_receive_modules_ GUARDED_BY(modules_crit_); |
91 | 105 |
| 106 // 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. |
92 rtc::CriticalSection remb_crit_; | 108 rtc::CriticalSection remb_crit_; |
93 // The last time a REMB was sent. | 109 // The last time a REMB was sent. |
94 int64_t last_remb_time_ms_ GUARDED_BY(remb_crit_); | 110 int64_t last_remb_time_ms_ GUARDED_BY(remb_crit_); |
95 uint32_t last_send_bitrate_bps_ GUARDED_BY(remb_crit_); | 111 uint32_t last_send_bitrate_bps_ GUARDED_BY(remb_crit_); |
96 // The last bitrate update. | 112 // The last bitrate update. |
97 uint32_t bitrate_bps_ GUARDED_BY(remb_crit_); | 113 uint32_t bitrate_bps_ GUARDED_BY(remb_crit_); |
98 | 114 |
| 115 // Candidates for the REMB module can be RTP sender/receiver modules, with |
| 116 // the sender modules taking precedence. |
| 117 std::vector<RtpRtcp*> sender_remb_candidates_ GUARDED_BY(modules_crit_); |
| 118 std::vector<RtpRtcp*> receiver_remb_candidates_ GUARDED_BY(modules_crit_); |
| 119 RtpRtcp* active_remb_module_ GUARDED_BY(modules_crit_); |
| 120 |
99 volatile int transport_seq_; | 121 volatile int transport_seq_; |
100 | 122 |
101 RTC_DISALLOW_COPY_AND_ASSIGN(PacketRouter); | 123 RTC_DISALLOW_COPY_AND_ASSIGN(PacketRouter); |
102 }; | 124 }; |
103 } // namespace webrtc | 125 } // namespace webrtc |
104 #endif // WEBRTC_MODULES_PACING_PACKET_ROUTER_H_ | 126 #endif // WEBRTC_MODULES_PACING_PACKET_ROUTER_H_ |
OLD | NEW |