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

Side by Side Diff: media/cast/net/rtcp/rtcp.cc

Issue 410433002: Cast: Avoid hitting a DCHECK caused by race condition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: flakr Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "media/cast/net/rtcp/rtcp.h" 5 #include "media/cast/net/rtcp/rtcp.h"
6 6
7 #include "media/cast/cast_config.h" 7 #include "media/cast/cast_config.h"
8 #include "media/cast/cast_defines.h" 8 #include "media/cast/cast_defines.h"
9 #include "media/cast/cast_environment.h" 9 #include "media/cast/cast_environment.h"
10 #include "media/cast/net/cast_transport_defines.h" 10 #include "media/cast/net/cast_transport_defines.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 rtp_receiver_statistics->GetStatistics( 152 rtp_receiver_statistics->GetStatistics(
153 &report_block.fraction_lost, &report_block.cumulative_lost, 153 &report_block.fraction_lost, &report_block.cumulative_lost,
154 &report_block.extended_high_sequence_number, &report_block.jitter); 154 &report_block.extended_high_sequence_number, &report_block.jitter);
155 } 155 }
156 156
157 report_block.last_sr = last_report_truncated_ntp_; 157 report_block.last_sr = last_report_truncated_ntp_;
158 if (!time_last_report_received_.is_null()) { 158 if (!time_last_report_received_.is_null()) {
159 uint32 delay_seconds = 0; 159 uint32 delay_seconds = 0;
160 uint32 delay_fraction = 0; 160 uint32 delay_fraction = 0;
161 base::TimeDelta delta = now - time_last_report_received_; 161 base::TimeDelta delta = now - time_last_report_received_;
162
163 // TODO(hclam): DLRR is not used by any receiver. Consider removing
164 // it. There is one race condition in the computation of the time for
165 // DLRR: current time is submitted to this method while
166 // |time_last_report_received_| is updated just before that. This can
167 // happen if current time is not submitted synchronously.
168 if (delta < base::TimeDelta())
169 delta = base::TimeDelta();
170 ConvertTimeToFractions(delta.InMicroseconds(), &delay_seconds, 162 ConvertTimeToFractions(delta.InMicroseconds(), &delay_seconds,
171 &delay_fraction); 163 &delay_fraction);
172 report_block.delay_since_last_sr = 164 report_block.delay_since_last_sr =
173 ConvertToNtpDiff(delay_seconds, delay_fraction); 165 ConvertToNtpDiff(delay_seconds, delay_fraction);
174 } else { 166 } else {
175 report_block.delay_since_last_sr = 0; 167 report_block.delay_since_last_sr = 0;
176 } 168 }
177 } 169 }
178 rtcp_sender_->SendRtcpFromRtpReceiver(packet_type_flags, 170 rtcp_sender_->SendRtcpFromRtpReceiver(packet_type_flags,
179 &report_block, 171 &report_block,
(...skipping 15 matching lines...) Expand all
195 SaveLastSentNtpTime(current_time, current_ntp_seconds, 187 SaveLastSentNtpTime(current_time, current_ntp_seconds,
196 current_ntp_fractions); 188 current_ntp_fractions);
197 189
198 RtcpDlrrReportBlock dlrr; 190 RtcpDlrrReportBlock dlrr;
199 if (!time_last_report_received_.is_null()) { 191 if (!time_last_report_received_.is_null()) {
200 packet_type_flags |= kRtcpDlrr; 192 packet_type_flags |= kRtcpDlrr;
201 dlrr.last_rr = last_report_truncated_ntp_; 193 dlrr.last_rr = last_report_truncated_ntp_;
202 uint32 delay_seconds = 0; 194 uint32 delay_seconds = 0;
203 uint32 delay_fraction = 0; 195 uint32 delay_fraction = 0;
204 base::TimeDelta delta = current_time - time_last_report_received_; 196 base::TimeDelta delta = current_time - time_last_report_received_;
197 // TODO(hclam): DLRR is not used by any receiver. Consider removing
198 // it. There is one race condition in the computation of the time for
199 // DLRR: current time is submitted to this method while
200 // |time_last_report_received_| is updated just before that. This can
201 // happen if current time is not submitted synchronously.
202 if (delta < base::TimeDelta())
203 delta = base::TimeDelta();
205 ConvertTimeToFractions(delta.InMicroseconds(), &delay_seconds, 204 ConvertTimeToFractions(delta.InMicroseconds(), &delay_seconds,
206 &delay_fraction); 205 &delay_fraction);
207 206
208 dlrr.delay_since_last_rr = ConvertToNtpDiff(delay_seconds, delay_fraction); 207 dlrr.delay_since_last_rr = ConvertToNtpDiff(delay_seconds, delay_fraction);
209 } 208 }
210 209
211 RtcpSenderInfo sender_info; 210 RtcpSenderInfo sender_info;
212 sender_info.ntp_seconds = current_ntp_seconds; 211 sender_info.ntp_seconds = current_ntp_seconds;
213 sender_info.ntp_fraction = current_ntp_fractions; 212 sender_info.ntp_fraction = current_ntp_fractions;
214 sender_info.rtp_timestamp = current_time_as_rtp_timestamp; 213 sender_info.rtp_timestamp = current_time_as_rtp_timestamp;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 359 }
361 360
362 void Rtcp::OnReceivedReceiverLog(const RtcpReceiverLogMessage& receiver_log) { 361 void Rtcp::OnReceivedReceiverLog(const RtcpReceiverLogMessage& receiver_log) {
363 if (log_callback_.is_null()) 362 if (log_callback_.is_null())
364 return; 363 return;
365 log_callback_.Run(receiver_log); 364 log_callback_.Run(receiver_log);
366 } 365 }
367 366
368 } // namespace cast 367 } // namespace cast
369 } // namespace media 368 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698