niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
leozwang@webrtc.org | 2559cbf | 2012-02-27 19:18:25 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef WEBRTC_MODULES_UTILITY_SOURCE_RTP_DUMP_IMPL_H_ |
| 12 | #define WEBRTC_MODULES_UTILITY_SOURCE_RTP_DUMP_IMPL_H_ |
| 13 | |
| 14 | #include "rtp_dump.h" |
| 15 | |
| 16 | namespace webrtc { |
| 17 | class CriticalSectionWrapper; |
| 18 | class FileWrapper; |
| 19 | class RtpDumpImpl : public RtpDump |
| 20 | { |
| 21 | public: |
| 22 | RtpDumpImpl(); |
| 23 | virtual ~RtpDumpImpl(); |
| 24 | |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 25 | virtual int32_t Start(const char* fileNameUTF8); |
| 26 | virtual int32_t Stop(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | virtual bool IsActive() const; |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 28 | virtual int32_t DumpPacket(const uint8_t* packet, uint16_t packetLength); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 29 | private: |
| 30 | // Return the system time in ms. |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 31 | inline uint32_t GetTimeInMS() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 32 | // Return x in network byte order (big endian). |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 33 | inline uint32_t RtpDumpHtonl(uint32_t x) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | // Return x in network byte order (big endian). |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 35 | inline uint16_t RtpDumpHtons(uint16_t x) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | |
| 37 | // Return true if the packet starts with a valid RTCP header. |
| 38 | // Note: See ModuleRTPUtility::RTPHeaderParser::RTCP() for details on how |
| 39 | // to determine if the packet is an RTCP packet. |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 40 | bool RTCP(const uint8_t* packet) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 41 | |
| 42 | private: |
henrike@webrtc.org | 105e071 | 2011-12-16 19:53:46 +0000 | [diff] [blame] | 43 | CriticalSectionWrapper* _critSect; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | FileWrapper& _file; |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 45 | uint32_t _startTime; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 46 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 47 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 48 | #endif // WEBRTC_MODULES_UTILITY_SOURCE_RTP_DUMP_IMPL_H_ |