blob: 28b5a70bfead15f1642755a140ed2b5ff8ccc081 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
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
16namespace webrtc {
17class CriticalSectionWrapper;
18class FileWrapper;
19class RtpDumpImpl : public RtpDump
20{
21public:
22 RtpDumpImpl();
23 virtual ~RtpDumpImpl();
24
25 virtual WebRtc_Word32 Start(const WebRtc_Word8* fileNameUTF8);
26 virtual WebRtc_Word32 Stop();
27 virtual bool IsActive() const;
28 virtual WebRtc_Word32 DumpPacket(const WebRtc_UWord8* packet,
29 WebRtc_UWord16 packetLength);
30private:
31 // Return the system time in ms.
32 inline WebRtc_UWord32 GetTimeInMS() const;
33 // Return x in network byte order (big endian).
34 inline WebRtc_UWord32 RtpDumpHtonl(WebRtc_UWord32 x) const;
35 // Return x in network byte order (big endian).
36 inline WebRtc_UWord16 RtpDumpHtons(WebRtc_UWord16 x) const;
37
38 // Return true if the packet starts with a valid RTCP header.
39 // Note: See ModuleRTPUtility::RTPHeaderParser::RTCP() for details on how
40 // to determine if the packet is an RTCP packet.
41 bool RTCP(const WebRtc_UWord8* packet) const;
42
43private:
henrike@webrtc.org105e0712011-12-16 19:53:46 +000044 CriticalSectionWrapper* _critSect;
niklase@google.com470e71d2011-07-07 08:21:25 +000045 FileWrapper& _file;
46 WebRtc_UWord32 _startTime;
47};
48} // namespace webrtc
49#endif // WEBRTC_MODULES_UTILITY_SOURCE_RTP_DUMP_IMPL_H_