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

Side by Side Diff: webrtc/modules/congestion_controller/transport_feedback_adapter.cc

Issue 2589743002: Make OverheadObserver::OnOverheadChanged count RTP headers only (Closed)
Patch Set: Add explicit cast. Created 3 years, 11 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
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
11 #include "webrtc/modules/congestion_controller/transport_feedback_adapter.h" 11 #include "webrtc/modules/congestion_controller/transport_feedback_adapter.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <limits> 14 #include <limits>
15 15
16 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
17 #include "webrtc/base/logging.h" 17 #include "webrtc/base/logging.h"
18 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" 18 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
19 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" 19 #include "webrtc/modules/congestion_controller/delay_based_bwe.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
21 #include "webrtc/modules/utility/include/process_thread.h" 21 #include "webrtc/modules/utility/include/process_thread.h"
22 #include "webrtc/system_wrappers/include/field_trial.h"
22 23
23 namespace webrtc { 24 namespace webrtc {
24 25
25 const int64_t kNoTimestamp = -1; 26 const int64_t kNoTimestamp = -1;
26 const int64_t kSendTimeHistoryWindowMs = 10000; 27 const int64_t kSendTimeHistoryWindowMs = 10000;
27 const int64_t kBaseTimestampScaleFactor = 28 const int64_t kBaseTimestampScaleFactor =
28 rtcp::TransportFeedback::kDeltaScaleFactor * (1 << 8); 29 rtcp::TransportFeedback::kDeltaScaleFactor * (1 << 8);
29 const int64_t kBaseTimestampRangeSizeUs = kBaseTimestampScaleFactor * (1 << 24); 30 const int64_t kBaseTimestampRangeSizeUs = kBaseTimestampScaleFactor * (1 << 24);
30 31
31 class PacketInfoComparator { 32 class PacketInfoComparator {
(...skipping 20 matching lines...) Expand all
52 53
53 void TransportFeedbackAdapter::InitBwe() { 54 void TransportFeedbackAdapter::InitBwe() {
54 rtc::CritScope cs(&bwe_lock_); 55 rtc::CritScope cs(&bwe_lock_);
55 delay_based_bwe_.reset(new DelayBasedBwe(clock_)); 56 delay_based_bwe_.reset(new DelayBasedBwe(clock_));
56 } 57 }
57 58
58 void TransportFeedbackAdapter::AddPacket(uint16_t sequence_number, 59 void TransportFeedbackAdapter::AddPacket(uint16_t sequence_number,
59 size_t length, 60 size_t length,
60 int probe_cluster_id) { 61 int probe_cluster_id) {
61 rtc::CritScope cs(&lock_); 62 rtc::CritScope cs(&lock_);
63 if (webrtc::field_trial::FindFullName("WebRTC-SendSideBwe-WithOverhead") ==
64 "Enabled") {
65 length += transport_overhead_bytes_per_packet_;
66 }
62 send_time_history_.AddAndRemoveOld(sequence_number, length, probe_cluster_id); 67 send_time_history_.AddAndRemoveOld(sequence_number, length, probe_cluster_id);
63 } 68 }
64 69
65 void TransportFeedbackAdapter::OnSentPacket(uint16_t sequence_number, 70 void TransportFeedbackAdapter::OnSentPacket(uint16_t sequence_number,
66 int64_t send_time_ms) { 71 int64_t send_time_ms) {
67 rtc::CritScope cs(&lock_); 72 rtc::CritScope cs(&lock_);
68 send_time_history_.OnSentPacket(sequence_number, send_time_ms); 73 send_time_history_.OnSentPacket(sequence_number, send_time_ms);
69 } 74 }
70 75
71 void TransportFeedbackAdapter::SetMinBitrate(int min_bitrate_bps) { 76 void TransportFeedbackAdapter::SetMinBitrate(int min_bitrate_bps) {
72 rtc::CritScope cs(&bwe_lock_); 77 rtc::CritScope cs(&bwe_lock_);
73 delay_based_bwe_->SetMinBitrate(min_bitrate_bps); 78 delay_based_bwe_->SetMinBitrate(min_bitrate_bps);
74 } 79 }
75 80
81 void TransportFeedbackAdapter::SetTransportOverhead(
82 int transport_overhead_bytes_per_packet) {
83 rtc::CritScope cs(&lock_);
84 transport_overhead_bytes_per_packet_ = transport_overhead_bytes_per_packet;
85 }
86
76 int64_t TransportFeedbackAdapter::GetProbingIntervalMs() const { 87 int64_t TransportFeedbackAdapter::GetProbingIntervalMs() const {
77 rtc::CritScope cs(&bwe_lock_); 88 rtc::CritScope cs(&bwe_lock_);
78 return delay_based_bwe_->GetProbingIntervalMs(); 89 return delay_based_bwe_->GetProbingIntervalMs();
79 } 90 }
80 91
81 std::vector<PacketInfo> TransportFeedbackAdapter::GetPacketFeedbackVector( 92 std::vector<PacketInfo> TransportFeedbackAdapter::GetPacketFeedbackVector(
82 const rtcp::TransportFeedback& feedback) { 93 const rtcp::TransportFeedback& feedback) {
83 int64_t timestamp_us = feedback.GetBaseTimeUs(); 94 int64_t timestamp_us = feedback.GetBaseTimeUs();
84 // Add timestamp deltas to a local time base selected on first packet arrival. 95 // Add timestamp deltas to a local time base selected on first packet arrival.
85 // This won't be the true time base, but makes it easier to manually inspect 96 // This won't be the true time base, but makes it easier to manually inspect
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return last_packet_feedback_vector_; 165 return last_packet_feedback_vector_;
155 } 166 }
156 167
157 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, 168 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms,
158 int64_t max_rtt_ms) { 169 int64_t max_rtt_ms) {
159 rtc::CritScope cs(&bwe_lock_); 170 rtc::CritScope cs(&bwe_lock_);
160 delay_based_bwe_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); 171 delay_based_bwe_->OnRttUpdate(avg_rtt_ms, max_rtt_ms);
161 } 172 }
162 173
163 } // namespace webrtc 174 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/congestion_controller/transport_feedback_adapter.h ('k') | webrtc/modules/rtp_rtcp/include/rtp_rtcp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698