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

Side by Side Diff: media/cast/sender/congestion_control.cc

Issue 480563004: Cast: Reject old RTCP packets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The purpose of this file is determine what bitrate to use for mirroring. 5 // The purpose of this file is determine what bitrate to use for mirroring.
6 // Ideally this should be as much as possible, without causing any frames to 6 // Ideally this should be as much as possible, without causing any frames to
7 // arrive late. 7 // arrive late.
8 8
9 // The current algorithm is to measure how much bandwidth we've been using 9 // The current algorithm is to measure how much bandwidth we've been using
10 // recently. We also keep track of how much data has been queued up for sending 10 // recently. We also keep track of how much data has been queued up for sending
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (offset < 0 || offset >= static_cast<int32>(frame_stats_.size())) { 106 if (offset < 0 || offset >= static_cast<int32>(frame_stats_.size())) {
107 return NULL; 107 return NULL;
108 } 108 }
109 return &frame_stats_[offset]; 109 return &frame_stats_[offset];
110 } 110 }
111 111
112 void CongestionControl::AckFrame(uint32 frame_id, base::TimeTicks when) { 112 void CongestionControl::AckFrame(uint32 frame_id, base::TimeTicks when) {
113 FrameStats* frame_stats = GetFrameStats(last_acked_frame_); 113 FrameStats* frame_stats = GetFrameStats(last_acked_frame_);
114 while (IsNewerFrameId(frame_id, last_acked_frame_)) { 114 while (IsNewerFrameId(frame_id, last_acked_frame_)) {
115 FrameStats* last_frame_stats = frame_stats; 115 FrameStats* last_frame_stats = frame_stats;
116 frame_stats = GetFrameStats(last_acked_frame_ + 1);
Alpha Left Google 2014/08/19 18:01:36 Why this change? This isn't listed in the CL descr
hubbe 2014/08/19 18:27:16 Because the test I added exposed this bug. I'll ad
117 DCHECK(frame_stats);
118 if (frame_stats->sent_time.is_null()) {
119 // Can't ack a frame that hasn't been sent yet.
120 return;
121 }
116 last_acked_frame_++; 122 last_acked_frame_++;
117 frame_stats = GetFrameStats(last_acked_frame_); 123 if (when < frame_stats->sent_time)
118 DCHECK(frame_stats); 124 when = frame_stats->sent_time;
125
119 frame_stats->ack_time = when; 126 frame_stats->ack_time = when;
120 acked_bits_in_history_ += frame_stats->frame_size; 127 acked_bits_in_history_ += frame_stats->frame_size;
121 dead_time_in_history_ += DeadTime(*last_frame_stats, *frame_stats); 128 dead_time_in_history_ += DeadTime(*last_frame_stats, *frame_stats);
122 } 129 }
123 } 130 }
124 131
125 void CongestionControl::SendFrameToTransport(uint32 frame_id, 132 void CongestionControl::SendFrameToTransport(uint32 frame_id,
126 size_t frame_size, 133 size_t frame_size,
127 base::TimeTicks when) { 134 base::TimeTicks when) {
128 last_encoded_frame_ = frame_id; 135 last_encoded_frame_ = frame_id;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 VLOG(3) << " FBR:" << (bits_per_second / 1E6) 195 VLOG(3) << " FBR:" << (bits_per_second / 1E6)
189 << " EBF:" << empty_buffer_fraction 196 << " EBF:" << empty_buffer_fraction
190 << " SBR:" << (safe_bitrate / 1E6); 197 << " SBR:" << (safe_bitrate / 1E6);
191 bits_per_second = std::max(bits_per_second, min_bitrate_configured_); 198 bits_per_second = std::max(bits_per_second, min_bitrate_configured_);
192 bits_per_second = std::min(bits_per_second, max_bitrate_configured_); 199 bits_per_second = std::min(bits_per_second, max_bitrate_configured_);
193 return bits_per_second; 200 return bits_per_second;
194 } 201 }
195 202
196 } // namespace cast 203 } // namespace cast
197 } // namespace media 204 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698