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

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

Issue 2655033002: Prioritize video packets when sending padding or preemptive retransmits. (Closed)
Patch Set: . Created 3 years, 10 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_unittest.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 12 matching lines...) Expand all
23 } 23 }
24 24
25 PacketRouter::~PacketRouter() { 25 PacketRouter::~PacketRouter() {
26 RTC_DCHECK(rtp_modules_.empty()); 26 RTC_DCHECK(rtp_modules_.empty());
27 } 27 }
28 28
29 void PacketRouter::AddRtpModule(RtpRtcp* rtp_module) { 29 void PacketRouter::AddRtpModule(RtpRtcp* rtp_module) {
30 rtc::CritScope cs(&modules_crit_); 30 rtc::CritScope cs(&modules_crit_);
31 RTC_DCHECK(std::find(rtp_modules_.begin(), rtp_modules_.end(), rtp_module) == 31 RTC_DCHECK(std::find(rtp_modules_.begin(), rtp_modules_.end(), rtp_module) ==
32 rtp_modules_.end()); 32 rtp_modules_.end());
33 rtp_modules_.push_back(rtp_module); 33 // Put modules which can use regular payload packets (over rtx) instead of
34 // padding first as it's less of a waste
35 if ((rtp_module->RtxSendStatus() & kRtxRedundantPayloads) > 0) {
36 rtp_modules_.push_front(rtp_module);
37 } else {
38 rtp_modules_.push_back(rtp_module);
39 }
34 } 40 }
35 41
36 void PacketRouter::RemoveRtpModule(RtpRtcp* rtp_module) { 42 void PacketRouter::RemoveRtpModule(RtpRtcp* rtp_module) {
37 rtc::CritScope cs(&modules_crit_); 43 rtc::CritScope cs(&modules_crit_);
38 RTC_DCHECK(std::find(rtp_modules_.begin(), rtp_modules_.end(), rtp_module) != 44 RTC_DCHECK(std::find(rtp_modules_.begin(), rtp_modules_.end(), rtp_module) !=
39 rtp_modules_.end()); 45 rtp_modules_.end());
40 rtp_modules_.remove(rtp_module); 46 rtp_modules_.remove(rtp_module);
41 } 47 }
42 48
43 bool PacketRouter::TimeToSendPacket(uint32_t ssrc, 49 bool PacketRouter::TimeToSendPacket(uint32_t ssrc,
(...skipping 13 matching lines...) Expand all
57 } 63 }
58 } 64 }
59 return true; 65 return true;
60 } 66 }
61 67
62 size_t PacketRouter::TimeToSendPadding(size_t bytes_to_send, 68 size_t PacketRouter::TimeToSendPadding(size_t bytes_to_send,
63 int probe_cluster_id) { 69 int probe_cluster_id) {
64 RTC_DCHECK(pacer_thread_checker_.CalledOnValidThread()); 70 RTC_DCHECK(pacer_thread_checker_.CalledOnValidThread());
65 size_t total_bytes_sent = 0; 71 size_t total_bytes_sent = 0;
66 rtc::CritScope cs(&modules_crit_); 72 rtc::CritScope cs(&modules_crit_);
73 // Rtp modules are ordered by which stream can most benefit from padding.
67 for (RtpRtcp* module : rtp_modules_) { 74 for (RtpRtcp* module : rtp_modules_) {
68 if (module->SendingMedia()) { 75 if (module->SendingMedia()) {
69 size_t bytes_sent = module->TimeToSendPadding( 76 size_t bytes_sent = module->TimeToSendPadding(
70 bytes_to_send - total_bytes_sent, probe_cluster_id); 77 bytes_to_send - total_bytes_sent, probe_cluster_id);
71 total_bytes_sent += bytes_sent; 78 total_bytes_sent += bytes_sent;
72 if (total_bytes_sent >= bytes_to_send) 79 if (total_bytes_sent >= bytes_to_send)
73 break; 80 break;
74 } 81 }
75 } 82 }
76 return total_bytes_sent; 83 return total_bytes_sent;
(...skipping 25 matching lines...) Expand all
102 rtc::CritScope cs(&modules_crit_); 109 rtc::CritScope cs(&modules_crit_);
103 for (auto* rtp_module : rtp_modules_) { 110 for (auto* rtp_module : rtp_modules_) {
104 packet->SetSenderSsrc(rtp_module->SSRC()); 111 packet->SetSenderSsrc(rtp_module->SSRC());
105 if (rtp_module->SendFeedbackPacket(*packet)) 112 if (rtp_module->SendFeedbackPacket(*packet))
106 return true; 113 return true;
107 } 114 }
108 return false; 115 return false;
109 } 116 }
110 117
111 } // namespace webrtc 118 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/pacing/packet_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698