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