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

Side by Side Diff: webrtc/media/base/rtpdataengine.cc

Issue 3007153003: Enable UBSan float-cast-overflow warnings and fix existing ones (Closed)
Patch Set: Fix/silence existing warnings Created 3 years, 3 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) 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
11 #include "webrtc/media/base/rtpdataengine.h" 11 #include "webrtc/media/base/rtpdataengine.h"
12 12
13 #include "webrtc/media/base/codec.h" 13 #include "webrtc/media/base/codec.h"
14 #include "webrtc/media/base/mediaconstants.h" 14 #include "webrtc/media/base/mediaconstants.h"
15 #include "webrtc/media/base/rtputils.h" 15 #include "webrtc/media/base/rtputils.h"
16 #include "webrtc/media/base/streamparams.h" 16 #include "webrtc/media/base/streamparams.h"
17 #include "webrtc/rtc_base/copyonwritebuffer.h" 17 #include "webrtc/rtc_base/copyonwritebuffer.h"
18 #include "webrtc/rtc_base/helpers.h" 18 #include "webrtc/rtc_base/helpers.h"
19 #include "webrtc/rtc_base/logging.h" 19 #include "webrtc/rtc_base/logging.h"
20 #include "webrtc/rtc_base/ratelimiter.h" 20 #include "webrtc/rtc_base/ratelimiter.h"
21 #include "webrtc/rtc_base/sanitizer.h"
21 #include "webrtc/rtc_base/stringutils.h" 22 #include "webrtc/rtc_base/stringutils.h"
22 23
23 namespace cricket { 24 namespace cricket {
24 25
25 // We want to avoid IP fragmentation. 26 // We want to avoid IP fragmentation.
26 static const size_t kDataMaxRtpPacketLen = 1200U; 27 static const size_t kDataMaxRtpPacketLen = 1200U;
27 // We reserve space after the RTP header for future wiggle room. 28 // We reserve space after the RTP header for future wiggle room.
28 static const unsigned char kReservedSpace[] = { 29 static const unsigned char kReservedSpace[] = {
29 0x00, 0x00, 0x00, 0x00 30 0x00, 0x00, 0x00, 0x00
30 }; 31 };
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 68
68 RtpDataMediaChannel::~RtpDataMediaChannel() { 69 RtpDataMediaChannel::~RtpDataMediaChannel() {
69 std::map<uint32_t, RtpClock*>::const_iterator iter; 70 std::map<uint32_t, RtpClock*>::const_iterator iter;
70 for (iter = rtp_clock_by_send_ssrc_.begin(); 71 for (iter = rtp_clock_by_send_ssrc_.begin();
71 iter != rtp_clock_by_send_ssrc_.end(); 72 iter != rtp_clock_by_send_ssrc_.end();
72 ++iter) { 73 ++iter) {
73 delete iter->second; 74 delete iter->second;
74 } 75 }
75 } 76 }
76 77
77 void RtpClock::Tick(double now, int* seq_num, uint32_t* timestamp) { 78 void RTC_NO_SANITIZE("float-cast-overflow") // bugs.webrtc.org/8204
79 RtpClock::Tick(double now, int* seq_num, uint32_t* timestamp) {
78 *seq_num = ++last_seq_num_; 80 *seq_num = ++last_seq_num_;
79 *timestamp = timestamp_offset_ + static_cast<uint32_t>(now * clockrate_); 81 *timestamp = timestamp_offset_ + static_cast<uint32_t>(now * clockrate_);
82 // UBSan: 5.92374e+10 is outside the range of representable values of type
83 // 'unsigned int'
80 } 84 }
81 85
82 const DataCodec* FindUnknownCodec(const std::vector<DataCodec>& codecs) { 86 const DataCodec* FindUnknownCodec(const std::vector<DataCodec>& codecs) {
83 DataCodec data_codec(kGoogleRtpDataCodecPlType, kGoogleRtpDataCodecName); 87 DataCodec data_codec(kGoogleRtpDataCodecPlType, kGoogleRtpDataCodecName);
84 std::vector<DataCodec>::const_iterator iter; 88 std::vector<DataCodec>::const_iterator iter;
85 for (iter = codecs.begin(); iter != codecs.end(); ++iter) { 89 for (iter = codecs.begin(); iter != codecs.end(); ++iter) {
86 if (!iter->Matches(data_codec)) { 90 if (!iter->Matches(data_codec)) {
87 return &(*iter); 91 return &(*iter);
88 } 92 }
89 } 93 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 *result = SDR_SUCCESS; 341 *result = SDR_SUCCESS;
338 } 342 }
339 return true; 343 return true;
340 } 344 }
341 345
342 rtc::DiffServCodePoint RtpDataMediaChannel::PreferredDscp() const { 346 rtc::DiffServCodePoint RtpDataMediaChannel::PreferredDscp() const {
343 return rtc::DSCP_AF41; 347 return rtc::DSCP_AF41;
344 } 348 }
345 349
346 } // namespace cricket 350 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698