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

Unified Diff: webrtc/pc/channel.cc

Issue 2437503004: Set actual transport overhead in rtp_rtcp (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 side-by-side diff with in-line comments
Download patch
Index: webrtc/pc/channel.cc
diff --git a/webrtc/pc/channel.cc b/webrtc/pc/channel.cc
index f22bdc4ca41029155f2fe4fe511bb9c2765ee679..477c2deb19e297a8a71ae9643b83de28bc0bcb3e 100644
--- a/webrtc/pc/channel.cc
+++ b/webrtc/pc/channel.cc
@@ -585,7 +585,8 @@ void BaseChannel::OnSelectedCandidatePairChanged(
network_route = rtc::NetworkRoute(
ready_to_send, selected_candidate_pair->local_candidate().network_id(),
selected_candidate_pair->remote_candidate().network_id(),
- last_sent_packet_id);
+ last_sent_packet_id,
+ GetTransportOverheadPerPacket(*selected_candidate_pair));
}
invoker_.AsyncInvoke<void>(
RTC_FROM_HERE, worker_thread_,
@@ -1661,6 +1662,29 @@ void BaseChannel::UpdateMediaSendRecvState() {
Bind(&BaseChannel::UpdateMediaSendRecvState_w, this));
}
+int BaseChannel::GetTransportOverheadPerPacket(
+ const CandidatePairInterface& selected_candidate_pair) {
+ constexpr int kIpv4Overhaed = 20;
+ constexpr int kIpv6Overhaed = 40;
+ constexpr int kUdpOverhaed = 8;
+ constexpr int kTcpOverhaed = 20;
+ constexpr int kSrtpAuthOverhaed = 4;
+
+ int ransport_overhead_per_packet = 0;
+ ransport_overhead_per_packet +=
+ selected_candidate_pair.local_candidate().protocol() == TCP_PROTOCOL_NAME
+ ? kTcpOverhaed
+ : kUdpOverhaed;
+ ransport_overhead_per_packet +=
+ selected_candidate_pair.local_candidate().address().family() == AF_INET
+ ? kIpv4Overhaed
+ : kIpv6Overhaed;
+ if (secure()) {
+ ransport_overhead_per_packet += kSrtpAuthOverhaed;
+ }
+ return ransport_overhead_per_packet;
+}
+
void VoiceChannel::UpdateMediaSendRecvState_w() {
// Render incoming data if we're the active call, and we have the local
// content. We receive data on the default channel and multiplexed streams.

Powered by Google App Engine
This is Rietveld 408576698