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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // May be an RTCP packet. | 65 // May be an RTCP packet. |
66 // Read the next one. | 66 // Read the next one. |
67 continue; | 67 continue; |
68 } | 68 } |
69 std::unique_ptr<uint8_t[]> packet_memory(new uint8_t[temp_packet.length]); | 69 std::unique_ptr<uint8_t[]> packet_memory(new uint8_t[temp_packet.length]); |
70 memcpy(packet_memory.get(), temp_packet.data, temp_packet.length); | 70 memcpy(packet_memory.get(), temp_packet.data, temp_packet.length); |
71 std::unique_ptr<Packet> packet(new Packet( | 71 std::unique_ptr<Packet> packet(new Packet( |
72 packet_memory.release(), temp_packet.length, | 72 packet_memory.release(), temp_packet.length, |
73 temp_packet.original_length, temp_packet.time_ms, *parser_.get())); | 73 temp_packet.original_length, temp_packet.time_ms, *parser_.get())); |
74 if (!packet->valid_header()) { | 74 if (!packet->valid_header()) { |
75 assert(false); | 75 continue; |
76 return NULL; | |
77 } | 76 } |
78 if (filter_.test(packet->header().payloadType) || | 77 if (filter_.test(packet->header().payloadType) || |
79 (use_ssrc_filter_ && packet->header().ssrc != ssrc_)) { | 78 (use_ssrc_filter_ && packet->header().ssrc != ssrc_)) { |
80 // This payload type should be filtered out. Continue to the next packet. | 79 // This payload type should be filtered out. Continue to the next packet. |
81 continue; | 80 continue; |
82 } | 81 } |
83 return packet; | 82 return packet; |
84 } | 83 } |
85 } | 84 } |
86 | 85 |
87 RtpFileSource::RtpFileSource() | 86 RtpFileSource::RtpFileSource() |
88 : PacketSource(), | 87 : PacketSource(), |
89 parser_(RtpHeaderParser::Create()) {} | 88 parser_(RtpHeaderParser::Create()) {} |
90 | 89 |
91 bool RtpFileSource::OpenFile(const std::string& file_name) { | 90 bool RtpFileSource::OpenFile(const std::string& file_name) { |
92 rtp_reader_.reset(RtpFileReader::Create(RtpFileReader::kRtpDump, file_name)); | 91 rtp_reader_.reset(RtpFileReader::Create(RtpFileReader::kRtpDump, file_name)); |
93 if (rtp_reader_) | 92 if (rtp_reader_) |
94 return true; | 93 return true; |
95 rtp_reader_.reset(RtpFileReader::Create(RtpFileReader::kPcap, file_name)); | 94 rtp_reader_.reset(RtpFileReader::Create(RtpFileReader::kPcap, file_name)); |
96 if (!rtp_reader_) { | 95 if (!rtp_reader_) { |
97 FATAL() << "Couldn't open input file as either a rtpdump or .pcap. Note " | 96 FATAL() << "Couldn't open input file as either a rtpdump or .pcap. Note " |
98 "that .pcapng is not supported."; | 97 "that .pcapng is not supported."; |
99 } | 98 } |
100 return true; | 99 return true; |
101 } | 100 } |
102 | 101 |
103 } // namespace test | 102 } // namespace test |
104 } // namespace webrtc | 103 } // namespace webrtc |
OLD | NEW |