OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 |
(...skipping 16 matching lines...) Expand all Loading... |
27 namespace test { | 27 namespace test { |
28 | 28 |
29 class RtpFileReader; | 29 class RtpFileReader; |
30 | 30 |
31 class RtpFileSource : public PacketSource { | 31 class RtpFileSource : public PacketSource { |
32 public: | 32 public: |
33 // Creates an RtpFileSource reading from |file_name|. If the file cannot be | 33 // Creates an RtpFileSource reading from |file_name|. If the file cannot be |
34 // opened, or has the wrong format, NULL will be returned. | 34 // opened, or has the wrong format, NULL will be returned. |
35 static RtpFileSource* Create(const std::string& file_name); | 35 static RtpFileSource* Create(const std::string& file_name); |
36 | 36 |
| 37 // Checks whether a files is a valid RTP dump or PCAP (Wireshark) file. |
| 38 static bool ValidRtpDump(const std::string& file_name); |
| 39 static bool ValidPcap(const std::string& file_name); |
| 40 |
37 virtual ~RtpFileSource(); | 41 virtual ~RtpFileSource(); |
38 | 42 |
39 // Registers an RTP header extension and binds it to |id|. | 43 // Registers an RTP header extension and binds it to |id|. |
40 virtual bool RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); | 44 virtual bool RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); |
41 | 45 |
42 // Returns a pointer to the next packet. Returns NULL if end of file was | 46 // Returns a pointer to the next packet. Returns NULL if end of file was |
43 // reached, or if a the data was corrupt. | 47 // reached, or if a the data was corrupt. |
44 Packet* NextPacket() override; | 48 Packet* NextPacket() override; |
45 | 49 |
46 private: | 50 private: |
47 static const int kFirstLineLength = 40; | 51 static const int kFirstLineLength = 40; |
48 static const int kRtpFileHeaderSize = 4 + 4 + 4 + 2 + 2; | 52 static const int kRtpFileHeaderSize = 4 + 4 + 4 + 2 + 2; |
49 static const size_t kPacketHeaderSize = 8; | 53 static const size_t kPacketHeaderSize = 8; |
50 | 54 |
51 RtpFileSource(); | 55 RtpFileSource(); |
52 | 56 |
53 bool OpenFile(const std::string& file_name); | 57 bool OpenFile(const std::string& file_name); |
54 | 58 |
55 rtc::scoped_ptr<RtpFileReader> rtp_reader_; | 59 rtc::scoped_ptr<RtpFileReader> rtp_reader_; |
56 rtc::scoped_ptr<RtpHeaderParser> parser_; | 60 rtc::scoped_ptr<RtpHeaderParser> parser_; |
57 | 61 |
58 RTC_DISALLOW_COPY_AND_ASSIGN(RtpFileSource); | 62 RTC_DISALLOW_COPY_AND_ASSIGN(RtpFileSource); |
59 }; | 63 }; |
60 | 64 |
61 } // namespace test | 65 } // namespace test |
62 } // namespace webrtc | 66 } // namespace webrtc |
63 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_FILE_SOURCE_H_ | 67 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_FILE_SOURCE_H_ |
OLD | NEW |