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

Side by Side Diff: webrtc/logging/rtc_event_log/rtc_event_log_parser.cc

Issue 2988153003: Replace CHECK(x && y) with two separate CHECK() calls (Closed)
Patch Set: fix mistakes Created 3 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 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 uint64_t varint = 0; 97 uint64_t varint = 0;
98 for (size_t bytes_read = 0; bytes_read < 10; ++bytes_read) { 98 for (size_t bytes_read = 0; bytes_read < 10; ++bytes_read) {
99 // The most significant bit of each byte is 0 if it is the last byte in 99 // The most significant bit of each byte is 0 if it is the last byte in
100 // the varint and 1 otherwise. Thus, we take the 7 least significant bits 100 // the varint and 1 otherwise. Thus, we take the 7 least significant bits
101 // of each byte and shift them 7 bits for each byte read previously to get 101 // of each byte and shift them 7 bits for each byte read previously to get
102 // the (unsigned) integer. 102 // the (unsigned) integer.
103 int byte = stream.get(); 103 int byte = stream.get();
104 if (stream.eof()) { 104 if (stream.eof()) {
105 return std::make_pair(varint, false); 105 return std::make_pair(varint, false);
106 } 106 }
107 RTC_DCHECK(0 <= byte && byte <= 255); 107 RTC_DCHECK_GE(byte, 0);
108 RTC_DCHECK_LE(byte, 255);
108 varint |= static_cast<uint64_t>(byte & 0x7F) << (7 * bytes_read); 109 varint |= static_cast<uint64_t>(byte & 0x7F) << (7 * bytes_read);
109 if ((byte & 0x80) == 0) { 110 if ((byte & 0x80) == 0) {
110 return std::make_pair(varint, true); 111 return std::make_pair(varint, true);
111 } 112 }
112 } 113 }
113 return std::make_pair(varint, false); 114 return std::make_pair(varint, false);
114 } 115 }
115 116
116 void GetHeaderExtensions( 117 void GetHeaderExtensions(
117 std::vector<RtpExtension>* header_extensions, 118 std::vector<RtpExtension>* header_extensions,
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 ParsedRtcEventLog::MediaType ParsedRtcEventLog::GetMediaType( 648 ParsedRtcEventLog::MediaType ParsedRtcEventLog::GetMediaType(
648 uint32_t ssrc, 649 uint32_t ssrc,
649 PacketDirection direction) const { 650 PacketDirection direction) const {
650 for (auto rit = streams_.rbegin(); rit != streams_.rend(); ++rit) { 651 for (auto rit = streams_.rbegin(); rit != streams_.rend(); ++rit) {
651 if (rit->ssrc == ssrc && rit->direction == direction) 652 if (rit->ssrc == ssrc && rit->direction == direction)
652 return rit->media_type; 653 return rit->media_type;
653 } 654 }
654 return MediaType::ANY; 655 return MediaType::ANY;
655 } 656 }
656 } // namespace webrtc 657 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/logging/rtc_event_log/rtc_event_log2stats.cc ('k') | webrtc/modules/audio_coding/codecs/cng/webrtc_cng.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698