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

Side by Side Diff: webrtc/system_wrappers/source/rtp_to_ntp.cc

Issue 1891703002: Potential division by zero in RtpToNtpMs() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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/system_wrappers/source/rtp_to_ntp_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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return false; 64 return false;
65 } 65 }
66 66
67 RtcpMeasurement measurement; 67 RtcpMeasurement measurement;
68 measurement.ntp_secs = ntp_secs; 68 measurement.ntp_secs = ntp_secs;
69 measurement.ntp_frac = ntp_frac; 69 measurement.ntp_frac = ntp_frac;
70 measurement.rtp_timestamp = rtp_timestamp; 70 measurement.rtp_timestamp = rtp_timestamp;
71 71
72 for (RtcpList::iterator it = rtcp_list->begin(); 72 for (RtcpList::iterator it = rtcp_list->begin();
73 it != rtcp_list->end(); ++it) { 73 it != rtcp_list->end(); ++it) {
74 if (measurement.ntp_secs == (*it).ntp_secs && 74 if ((measurement.ntp_secs == (*it).ntp_secs &&
75 measurement.ntp_frac == (*it).ntp_frac) { 75 measurement.ntp_frac == (*it).ntp_frac) ||
76 (measurement.rtp_timestamp == (*it).rtp_timestamp)) {
76 // This RTCP has already been added to the list. 77 // This RTCP has already been added to the list.
77 return true; 78 return true;
78 } 79 }
79 } 80 }
80 81
81 // We need two RTCP SR reports to map between RTP and NTP. More than two will 82 // We need two RTCP SR reports to map between RTP and NTP. More than two will
82 // not improve the mapping. 83 // not improve the mapping.
83 if (rtcp_list->size() == 2) { 84 if (rtcp_list->size() == 2) {
84 rtcp_list->pop_back(); 85 rtcp_list->pop_back();
85 } 86 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 144 }
144 } else if (static_cast<int32_t>(old_timestamp - new_timestamp) > 0) { 145 } else if (static_cast<int32_t>(old_timestamp - new_timestamp) > 0) {
145 // This difference should be less than -2^31 if we have had a backward wrap 146 // This difference should be less than -2^31 if we have had a backward wrap
146 // around. Since it is cast to a int32_t, it should be positive. 147 // around. Since it is cast to a int32_t, it should be positive.
147 return -1; 148 return -1;
148 } 149 }
149 return 0; 150 return 0;
150 } 151 }
151 152
152 } // namespace webrtc 153 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/system_wrappers/source/rtp_to_ntp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698