OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |