• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2012 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 // This file implements a class that writes a stream of RTP and RTCP packets
12 // to a file according to the format specified by rtpplay. See
13 // http://www.cs.columbia.edu/irt/software/rtptools/.
14 // Notes: supported platforms are Windows, Linux and Mac OSX
15 
16 #ifndef WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_
17 #define WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_
18 
19 #include "webrtc/system_wrappers/interface/file_wrapper.h"
20 #include "webrtc/typedefs.h"
21 
22 namespace webrtc {
23 class RtpDump
24 {
25 public:
26     // Factory method.
27     static RtpDump* CreateRtpDump();
28 
29     // Delete function. Destructor disabled.
30     static void DestroyRtpDump(RtpDump* object);
31 
32     // Open the file fileNameUTF8 for writing RTP/RTCP packets.
33     // Note: this API also adds the rtpplay header.
34     virtual int32_t Start(const char* fileNameUTF8) = 0;
35 
36     // Close the existing file. No more packets will be recorded.
37     virtual int32_t Stop() = 0;
38 
39     // Return true if a file is open for recording RTP/RTCP packets.
40     virtual bool IsActive() const = 0;
41 
42     // Writes the RTP/RTCP packet in packet with length packetLength in bytes.
43     // Note: packet should contain the RTP/RTCP part of the packet. I.e. the
44     // first bytes of packet should be the RTP/RTCP header.
45     virtual int32_t DumpPacket(const uint8_t* packet,
46                                uint16_t packetLength) = 0;
47 
48 protected:
49     virtual ~RtpDump();
50 };
51 }  // namespace webrtc
52 #endif // WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_
53