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

Side by Side Diff: webrtc/modules/pacing/packet_router.h

Issue 2973363002: Explicitly inform PacketRouter which RTP-RTCP modules are REMB-candidates (Closed)
Patch Set: Unit-tests added. Created 3 years, 5 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
« no previous file with comments | « no previous file | webrtc/modules/pacing/packet_router.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 // receive modules. 37 // receive modules.
38 class PacketRouter : public PacedSender::PacketSender, 38 class PacketRouter : public PacedSender::PacketSender,
39 public TransportSequenceNumberAllocator, 39 public TransportSequenceNumberAllocator,
40 public RemoteBitrateObserver { 40 public RemoteBitrateObserver {
41 public: 41 public:
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 constexpr bool remb_candidate = true; // Default to old behavior.
48 AddReceiveRtpModule(rtp_module, remb_candidate);
48 } 49 }
49 RTC_DEPRECATED void RemoveRtpModule(RtpRtcp* rtp_module) { 50 RTC_DEPRECATED void RemoveRtpModule(RtpRtcp* rtp_module) {
50 RemoveReceiveRtpModule(rtp_module); 51 RemoveReceiveRtpModule(rtp_module);
51 } 52 }
52 void AddSendRtpModule(RtpRtcp* rtp_module); 53 void AddSendRtpModule(RtpRtcp* rtp_module, bool remb_candidate);
danilchap 2017/07/19 12:47:20 overload to make the change backward compatible. (
eladalon 2017/07/27 15:57:26 Done. (For posterity - keeping remb_candidate beca
53 void RemoveSendRtpModule(RtpRtcp* rtp_module); 54 void RemoveSendRtpModule(RtpRtcp* rtp_module);
54 55
55 void AddReceiveRtpModule(RtpRtcp* rtp_module); 56 void AddReceiveRtpModule(RtpRtcp* rtp_module, bool remb_candidate);
56 void RemoveReceiveRtpModule(RtpRtcp* rtp_module); 57 void RemoveReceiveRtpModule(RtpRtcp* rtp_module);
57 58
58 // Implements PacedSender::Callback. 59 // Implements PacedSender::Callback.
59 bool TimeToSendPacket(uint32_t ssrc, 60 bool TimeToSendPacket(uint32_t ssrc,
60 uint16_t sequence_number, 61 uint16_t sequence_number,
61 int64_t capture_timestamp, 62 int64_t capture_timestamp,
62 bool retransmission, 63 bool retransmission,
63 const PacedPacketInfo& packet_info) override; 64 const PacedPacketInfo& packet_info) override;
64 65
65 size_t TimeToSendPadding(size_t bytes, 66 size_t TimeToSendPadding(size_t bytes,
(...skipping 11 matching lines...) Expand all
77 uint32_t bitrate_bps) override; 78 uint32_t bitrate_bps) override;
78 79
79 // Send REMB feedback. 80 // Send REMB feedback.
80 virtual bool SendRemb(uint32_t bitrate_bps, 81 virtual bool SendRemb(uint32_t bitrate_bps,
81 const std::vector<uint32_t>& ssrcs); 82 const std::vector<uint32_t>& ssrcs);
82 83
83 // Send transport feedback packet to send-side. 84 // Send transport feedback packet to send-side.
84 virtual bool SendTransportFeedback(rtcp::TransportFeedback* packet); 85 virtual bool SendTransportFeedback(rtcp::TransportFeedback* packet);
85 86
86 private: 87 private:
88 void AddRembModuleCandidate(RtpRtcp* candidate_module, bool sender)
89 EXCLUSIVE_LOCKS_REQUIRED(modules_crit_);
90 void MaybeRemoveRembModuleCandidate(RtpRtcp* candidate_module, bool sender)
91 EXCLUSIVE_LOCKS_REQUIRED(modules_crit_);
92 void DetermineActiveRembModule() EXCLUSIVE_LOCKS_REQUIRED(modules_crit_);
93
87 rtc::RaceChecker pacer_race_; 94 rtc::RaceChecker pacer_race_;
88 rtc::CriticalSection modules_crit_; 95 rtc::CriticalSection modules_crit_;
89 std::list<RtpRtcp*> rtp_send_modules_ GUARDED_BY(modules_crit_); 96 std::list<RtpRtcp*> rtp_send_modules_ GUARDED_BY(modules_crit_);
90 std::vector<RtpRtcp*> rtp_receive_modules_ GUARDED_BY(modules_crit_); 97 std::vector<RtpRtcp*> rtp_receive_modules_ GUARDED_BY(modules_crit_);
91 98
99 // TODO(eladalon): remb_crit_ only ever held from one function, and it's not
100 // clear if that function can actually be caleld from more than one thread.
92 rtc::CriticalSection remb_crit_; 101 rtc::CriticalSection remb_crit_;
93 // The last time a REMB was sent. 102 // The last time a REMB was sent.
94 int64_t last_remb_time_ms_ GUARDED_BY(remb_crit_); 103 int64_t last_remb_time_ms_ GUARDED_BY(remb_crit_);
95 uint32_t last_send_bitrate_bps_ GUARDED_BY(remb_crit_); 104 uint32_t last_send_bitrate_bps_ GUARDED_BY(remb_crit_);
96 // The last bitrate update. 105 // The last bitrate update.
97 uint32_t bitrate_bps_ GUARDED_BY(remb_crit_); 106 uint32_t bitrate_bps_ GUARDED_BY(remb_crit_);
98 107
108 // Candidates for the REMB module can be RTP sender/receiver modules, with
109 // the sender modules taking precedence.
110 std::vector<RtpRtcp*> sender_remb_candidates_ GUARDED_BY(modules_crit_);
111 std::vector<RtpRtcp*> receiver_remb_candidates_ GUARDED_BY(modules_crit_);
112 RtpRtcp* active_remb_module_ GUARDED_BY(modules_crit_);
113
99 volatile int transport_seq_; 114 volatile int transport_seq_;
100 115
101 RTC_DISALLOW_COPY_AND_ASSIGN(PacketRouter); 116 RTC_DISALLOW_COPY_AND_ASSIGN(PacketRouter);
102 }; 117 };
103 } // namespace webrtc 118 } // namespace webrtc
104 #endif // WEBRTC_MODULES_PACING_PACKET_ROUTER_H_ 119 #endif // WEBRTC_MODULES_PACING_PACKET_ROUTER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/pacing/packet_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698