OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 21 matching lines...) Expand all Loading... |
32 enum RtpDumpPacketFilter { | 32 enum RtpDumpPacketFilter { |
33 PF_NONE = 0x0, | 33 PF_NONE = 0x0, |
34 PF_RTPHEADER = 0x1, | 34 PF_RTPHEADER = 0x1, |
35 PF_RTPPACKET = 0x3, // includes header | 35 PF_RTPPACKET = 0x3, // includes header |
36 // PF_RTCPHEADER = 0x4, // TODO(juberti) | 36 // PF_RTCPHEADER = 0x4, // TODO(juberti) |
37 PF_RTCPPACKET = 0xC, // includes header | 37 PF_RTCPPACKET = 0xC, // includes header |
38 PF_ALL = 0xF | 38 PF_ALL = 0xF |
39 }; | 39 }; |
40 | 40 |
41 struct RtpDumpFileHeader { | 41 struct RtpDumpFileHeader { |
42 RtpDumpFileHeader(uint32_t start_ms, uint32_t s, uint16_t p); | 42 RtpDumpFileHeader(int64_t start_ms, uint32_t s, uint16_t p); |
43 void WriteToByteBuffer(rtc::ByteBufferWriter* buf); | 43 void WriteToByteBuffer(rtc::ByteBufferWriter* buf); |
44 | 44 |
45 static const char kFirstLine[]; | 45 static const char kFirstLine[]; |
46 static const size_t kHeaderLength = 16; | 46 static const size_t kHeaderLength = 16; |
47 uint32_t start_sec; // start of recording, the seconds part. | 47 uint32_t start_sec; // start of recording, the seconds part. |
48 uint32_t start_usec; // start of recording, the microseconds part. | 48 uint32_t start_usec; // start of recording, the microseconds part. |
49 uint32_t source; // network source (multicast address). | 49 uint32_t source; // network source (multicast address). |
50 uint16_t port; // UDP port. | 50 uint16_t port; // UDP port. |
51 uint16_t padding; // 2 bytes padding. | 51 uint16_t padding; // 2 bytes padding. |
52 }; | 52 }; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return stream_->SetPosition(first_line_and_file_header_len_); | 105 return stream_->SetPosition(first_line_and_file_header_len_); |
106 } | 106 } |
107 | 107 |
108 private: | 108 private: |
109 // Check if its matches "#!rtpplay1.0 address/port\n". | 109 // Check if its matches "#!rtpplay1.0 address/port\n". |
110 bool CheckFirstLine(const std::string& first_line); | 110 bool CheckFirstLine(const std::string& first_line); |
111 | 111 |
112 rtc::StreamInterface* stream_; | 112 rtc::StreamInterface* stream_; |
113 bool file_header_read_; | 113 bool file_header_read_; |
114 size_t first_line_and_file_header_len_; | 114 size_t first_line_and_file_header_len_; |
115 uint32_t start_time_ms_; | 115 int64_t start_time_ms_; |
116 uint32_t ssrc_override_; | 116 uint32_t ssrc_override_; |
117 | 117 |
118 RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpReader); | 118 RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpReader); |
119 }; | 119 }; |
120 | 120 |
121 // RtpDumpLoopReader reads RTP dump packets from the input stream and rewinds | 121 // RtpDumpLoopReader reads RTP dump packets from the input stream and rewinds |
122 // the stream when it ends. RtpDumpLoopReader maintains the elapsed time, the | 122 // the stream when it ends. RtpDumpLoopReader maintains the elapsed time, the |
123 // RTP sequence number and the RTP timestamp properly. RtpDumpLoopReader can | 123 // RTP sequence number and the RTP timestamp properly. RtpDumpLoopReader can |
124 // handle both RTP dump and RTCP dump. We assume that the dump does not mix | 124 // handle both RTP dump and RTCP dump. We assume that the dump does not mix |
125 // RTP packets and RTCP packets. | 125 // RTP packets and RTCP packets. |
(...skipping 25 matching lines...) Expand all Loading... |
151 uint32_t rtp_timestamp_increase_; | 151 uint32_t rtp_timestamp_increase_; |
152 // How many RTP packets and how many payload frames in the input stream. RTP | 152 // How many RTP packets and how many payload frames in the input stream. RTP |
153 // packets belong to the same frame have the same RTP timestamp, different | 153 // packets belong to the same frame have the same RTP timestamp, different |
154 // dump timestamp, and different RTP sequence number. | 154 // dump timestamp, and different RTP sequence number. |
155 uint32_t packet_count_; | 155 uint32_t packet_count_; |
156 uint32_t frame_count_; | 156 uint32_t frame_count_; |
157 // The elapsed time, RTP sequence number, and RTP timestamp of the first and | 157 // The elapsed time, RTP sequence number, and RTP timestamp of the first and |
158 // the previous dump packets in the input stream. | 158 // the previous dump packets in the input stream. |
159 uint32_t first_elapsed_time_; | 159 uint32_t first_elapsed_time_; |
160 int first_rtp_seq_num_; | 160 int first_rtp_seq_num_; |
161 uint32_t first_rtp_timestamp_; | 161 int64_t first_rtp_timestamp_; |
162 uint32_t prev_elapsed_time_; | 162 uint32_t prev_elapsed_time_; |
163 int prev_rtp_seq_num_; | 163 int prev_rtp_seq_num_; |
164 uint32_t prev_rtp_timestamp_; | 164 int64_t prev_rtp_timestamp_; |
165 | 165 |
166 RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpLoopReader); | 166 RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpLoopReader); |
167 }; | 167 }; |
168 | 168 |
169 class RtpDumpWriter { | 169 class RtpDumpWriter { |
170 public: | 170 public: |
171 explicit RtpDumpWriter(rtc::StreamInterface* stream); | 171 explicit RtpDumpWriter(rtc::StreamInterface* stream); |
172 | 172 |
173 // Filter to control what packets we actually record. | 173 // Filter to control what packets we actually record. |
174 void set_packet_filter(int filter); | 174 void set_packet_filter(int filter); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 bool file_header_written_; | 208 bool file_header_written_; |
209 uint32_t start_time_ms_; // Time when the record starts. | 209 uint32_t start_time_ms_; // Time when the record starts. |
210 // If writing to the stream takes longer than this many ms, log a warning. | 210 // If writing to the stream takes longer than this many ms, log a warning. |
211 uint32_t warn_slow_writes_delay_; | 211 uint32_t warn_slow_writes_delay_; |
212 RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpWriter); | 212 RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpWriter); |
213 }; | 213 }; |
214 | 214 |
215 } // namespace cricket | 215 } // namespace cricket |
216 | 216 |
217 #endif // WEBRTC_MEDIA_BASE_RTPDUMP_H_ | 217 #endif // WEBRTC_MEDIA_BASE_RTPDUMP_H_ |
OLD | NEW |