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

Side by Side Diff: webrtc/test/rtcp_packet_parser.h

Issue 2534683002: RTC_[D]CHECK_op: Remove superfluous casts (Closed)
Patch Set: test Created 4 years 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 23 matching lines...) Expand all
34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
35 35
36 namespace webrtc { 36 namespace webrtc {
37 namespace test { 37 namespace test {
38 // Parse RTCP packet of given type. Assumes RTCP header is valid and that there 38 // Parse RTCP packet of given type. Assumes RTCP header is valid and that there
39 // is excatly one packet of correct type in the buffer. 39 // is excatly one packet of correct type in the buffer.
40 template <typename Packet> 40 template <typename Packet>
41 bool ParseSinglePacket(const uint8_t* buffer, size_t size, Packet* packet) { 41 bool ParseSinglePacket(const uint8_t* buffer, size_t size, Packet* packet) {
42 rtcp::CommonHeader header; 42 rtcp::CommonHeader header;
43 RTC_CHECK(header.Parse(buffer, size)); 43 RTC_CHECK(header.Parse(buffer, size));
44 RTC_CHECK_EQ(static_cast<ptrdiff_t>(size), header.NextPacket() - buffer); 44 RTC_CHECK_EQ(size, header.NextPacket() - buffer);
45 return packet->Parse(header); 45 return packet->Parse(header);
46 } 46 }
47 // Same function, but takes raw buffer as single argument instead of pair. 47 // Same function, but takes raw buffer as single argument instead of pair.
48 template <typename Packet> 48 template <typename Packet>
49 bool ParseSinglePacket(rtc::ArrayView<const uint8_t> buffer, Packet* packet) { 49 bool ParseSinglePacket(rtc::ArrayView<const uint8_t> buffer, Packet* packet) {
50 return ParseSinglePacket(buffer.data(), buffer.size(), packet); 50 return ParseSinglePacket(buffer.data(), buffer.size(), packet);
51 } 51 }
52 52
53 class RtcpPacketParser { 53 class RtcpPacketParser {
54 public: 54 public:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 PacketCounter<rtcp::Sli> sli_; 118 PacketCounter<rtcp::Sli> sli_;
119 PacketCounter<rtcp::Tmmbn> tmmbn_; 119 PacketCounter<rtcp::Tmmbn> tmmbn_;
120 PacketCounter<rtcp::Tmmbr> tmmbr_; 120 PacketCounter<rtcp::Tmmbr> tmmbr_;
121 PacketCounter<rtcp::TransportFeedback> transport_feedback_; 121 PacketCounter<rtcp::TransportFeedback> transport_feedback_;
122 uint32_t sender_ssrc_ = 0; 122 uint32_t sender_ssrc_ = 0;
123 }; 123 };
124 124
125 } // namespace test 125 } // namespace test
126 } // namespace webrtc 126 } // namespace webrtc
127 #endif // WEBRTC_TEST_RTCP_PACKET_PARSER_H_ 127 #endif // WEBRTC_TEST_RTCP_PACKET_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698