1b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org/* 2b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * 4b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * Use of this source code is governed by a BSD-style license 5b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * that can be found in the LICENSE file in the root of the source 6b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * tree. An additional intellectual property rights grant can be found 7b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * in the file PATENTS. All contributing project authors may 8b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * be found in the AUTHORS file in the root of the source tree. 9b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org */ 10b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 11b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#ifndef WEBRTC_MODULES_UTILITY_SOURCE_RTP_DUMP_IMPL_H_ 12b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#define WEBRTC_MODULES_UTILITY_SOURCE_RTP_DUMP_IMPL_H_ 13b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 14f72d6b0ae18a7d27c6437397eda03beb4e60e5abpbos@webrtc.org#include "webrtc/modules/utility/interface/rtp_dump.h" 15b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 16b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgnamespace webrtc { 17b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass CriticalSectionWrapper; 18b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass FileWrapper; 19b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass RtpDumpImpl : public RtpDump 20b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org{ 21b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgpublic: 22b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org RtpDumpImpl(); 23b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org virtual ~RtpDumpImpl(); 24b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 259cd0bbc6e184925752a04ed33ccbdc6e125e318ahenrike@webrtc.org virtual int32_t Start(const char* fileNameUTF8) OVERRIDE; 269cd0bbc6e184925752a04ed33ccbdc6e125e318ahenrike@webrtc.org virtual int32_t Stop() OVERRIDE; 279cd0bbc6e184925752a04ed33ccbdc6e125e318ahenrike@webrtc.org virtual bool IsActive() const OVERRIDE; 289cd0bbc6e184925752a04ed33ccbdc6e125e318ahenrike@webrtc.org virtual int32_t DumpPacket(const uint8_t* packet, 299cd0bbc6e184925752a04ed33ccbdc6e125e318ahenrike@webrtc.org uint16_t packetLength) OVERRIDE; 30b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgprivate: 31b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org // Return the system time in ms. 32f85a509a2d847b32cddf23d077d83fc0601a43d7pbos@webrtc.org inline uint32_t GetTimeInMS() const; 33b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org // Return x in network byte order (big endian). 34f85a509a2d847b32cddf23d077d83fc0601a43d7pbos@webrtc.org inline uint32_t RtpDumpHtonl(uint32_t x) const; 35b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org // Return x in network byte order (big endian). 36f85a509a2d847b32cddf23d077d83fc0601a43d7pbos@webrtc.org inline uint16_t RtpDumpHtons(uint16_t x) const; 37b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 38b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org // Return true if the packet starts with a valid RTCP header. 396aae61c2c693fa3425c73c420e7046e95486b592pbos@webrtc.org // Note: See RtpUtility::RtpHeaderParser::RTCP() for details on how 40b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org // to determine if the packet is an RTCP packet. 41f85a509a2d847b32cddf23d077d83fc0601a43d7pbos@webrtc.org bool RTCP(const uint8_t* packet) const; 42b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 43b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgprivate: 44b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org CriticalSectionWrapper* _critSect; 45b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org FileWrapper& _file; 46f85a509a2d847b32cddf23d077d83fc0601a43d7pbos@webrtc.org uint32_t _startTime; 47b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org}; 483b89e10f31160da35b408fd00cb8f89d2b08862dpbos@webrtc.org} // namespace webrtc 49b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#endif // WEBRTC_MODULES_UTILITY_SOURCE_RTP_DUMP_IMPL_H_ 50