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

Side by Side Diff: webrtc/common_types.h

Issue 2535643002: Replace some asserts with DCHECKs (Closed)
Patch Set: Don't use the enum hack 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) 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 #ifndef WEBRTC_COMMON_TYPES_H_ 11 #ifndef WEBRTC_COMMON_TYPES_H_
12 #define WEBRTC_COMMON_TYPES_H_ 12 #define WEBRTC_COMMON_TYPES_H_
13 13
14 #include <assert.h>
15 #include <stddef.h> 14 #include <stddef.h>
16 #include <string.h> 15 #include <string.h>
17 16
18 #include <string> 17 #include <string>
19 #include <vector> 18 #include <vector>
20 19
20 #include "webrtc/base/checks.h"
21 #include "webrtc/base/optional.h" 21 #include "webrtc/base/optional.h"
22 #include "webrtc/common_video/rotation.h" 22 #include "webrtc/common_video/rotation.h"
23 #include "webrtc/typedefs.h" 23 #include "webrtc/typedefs.h"
24 24
25 #if defined(_MSC_VER) 25 #if defined(_MSC_VER)
26 // Disable "new behavior: elements of array will be default initialized" 26 // Disable "new behavior: elements of array will be default initialized"
27 // warning. Affects OverUseDetectorOptions. 27 // warning. Affects OverUseDetectorOptions.
28 #pragma warning(disable : 4351) 28 #pragma warning(disable : 4351)
29 #endif 29 #endif
30 30
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 : header_bytes(0), payload_bytes(0), padding_bytes(0), packets(0) {} 798 : header_bytes(0), payload_bytes(0), padding_bytes(0), packets(0) {}
799 799
800 void Add(const RtpPacketCounter& other) { 800 void Add(const RtpPacketCounter& other) {
801 header_bytes += other.header_bytes; 801 header_bytes += other.header_bytes;
802 payload_bytes += other.payload_bytes; 802 payload_bytes += other.payload_bytes;
803 padding_bytes += other.padding_bytes; 803 padding_bytes += other.padding_bytes;
804 packets += other.packets; 804 packets += other.packets;
805 } 805 }
806 806
807 void Subtract(const RtpPacketCounter& other) { 807 void Subtract(const RtpPacketCounter& other) {
808 assert(header_bytes >= other.header_bytes); 808 RTC_DCHECK_GE(header_bytes, other.header_bytes);
809 header_bytes -= other.header_bytes; 809 header_bytes -= other.header_bytes;
810 assert(payload_bytes >= other.payload_bytes); 810 RTC_DCHECK_GE(payload_bytes, other.payload_bytes);
811 payload_bytes -= other.payload_bytes; 811 payload_bytes -= other.payload_bytes;
812 assert(padding_bytes >= other.padding_bytes); 812 RTC_DCHECK_GE(padding_bytes, other.padding_bytes);
813 padding_bytes -= other.padding_bytes; 813 padding_bytes -= other.padding_bytes;
814 assert(packets >= other.packets); 814 RTC_DCHECK_GE(packets, other.packets);
815 packets -= other.packets; 815 packets -= other.packets;
816 } 816 }
817 817
818 void AddPacket(size_t packet_length, const RTPHeader& header) { 818 void AddPacket(size_t packet_length, const RTPHeader& header) {
819 ++packets; 819 ++packets;
820 header_bytes += header.headerLength; 820 header_bytes += header.headerLength;
821 padding_bytes += header.paddingLength; 821 padding_bytes += header.paddingLength;
822 payload_bytes += 822 payload_bytes +=
823 packet_length - (header.headerLength + header.paddingLength); 823 packet_length - (header.headerLength + header.paddingLength);
824 } 824 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 enum class RtcpMode { kOff, kCompound, kReducedSize }; 893 enum class RtcpMode { kOff, kCompound, kReducedSize };
894 894
895 enum NetworkState { 895 enum NetworkState {
896 kNetworkUp, 896 kNetworkUp,
897 kNetworkDown, 897 kNetworkDown,
898 }; 898 };
899 899
900 } // namespace webrtc 900 } // namespace webrtc
901 901
902 #endif // WEBRTC_COMMON_TYPES_H_ 902 #endif // WEBRTC_COMMON_TYPES_H_
OLDNEW
« no previous file with comments | « webrtc/common_audio/resampler/sinc_resampler.cc ('k') | webrtc/common_video/libyuv/webrtc_libyuv.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698