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 29 matching lines...) Expand all Loading... | |
40 assert(parser_.get()); | 40 assert(parser_.get()); |
41 return parser_->RegisterRtpHeaderExtension(type, id); | 41 return parser_->RegisterRtpHeaderExtension(type, id); |
42 } | 42 } |
43 | 43 |
44 Packet* RtpFileSource::NextPacket() { | 44 Packet* RtpFileSource::NextPacket() { |
45 while (true) { | 45 while (true) { |
46 RtpPacket temp_packet; | 46 RtpPacket temp_packet; |
47 if (!rtp_reader_->NextPacket(&temp_packet)) { | 47 if (!rtp_reader_->NextPacket(&temp_packet)) { |
48 return NULL; | 48 return NULL; |
49 } | 49 } |
50 if (temp_packet.length == 0) { | 50 if (temp_packet.original_length == 0) { |
51 // May be an RTCP packet. | 51 // May be an RTCP packet. |
kwiberg-webrtc
2015/09/17 10:51:44
Tangent: What could it be besides an RTCP packet?
hlundin-webrtc
2015/09/17 13:33:07
An RTP packet in disguise? :)
kwiberg-webrtc
2015/09/17 13:39:31
Or a wolf in an RTP packet's clothing?
| |
52 // Read the next one. | 52 // Read the next one. |
53 continue; | 53 continue; |
54 } | 54 } |
55 rtc::scoped_ptr<uint8_t[]> packet_memory(new uint8_t[temp_packet.length]); | 55 rtc::scoped_ptr<uint8_t[]> packet_memory(new uint8_t[temp_packet.length]); |
56 memcpy(packet_memory.get(), temp_packet.data, temp_packet.length); | 56 memcpy(packet_memory.get(), temp_packet.data, temp_packet.length); |
57 rtc::scoped_ptr<Packet> packet(new Packet( | 57 rtc::scoped_ptr<Packet> packet(new Packet( |
58 packet_memory.release(), temp_packet.length, | 58 packet_memory.release(), temp_packet.length, |
59 temp_packet.original_length, temp_packet.time_ms, *parser_.get())); | 59 temp_packet.original_length, temp_packet.time_ms, *parser_.get())); |
60 if (!packet->valid_header()) { | 60 if (!packet->valid_header()) { |
61 assert(false); | 61 assert(false); |
(...skipping 19 matching lines...) Expand all Loading... | |
81 rtp_reader_.reset(RtpFileReader::Create(RtpFileReader::kPcap, file_name)); | 81 rtp_reader_.reset(RtpFileReader::Create(RtpFileReader::kPcap, file_name)); |
82 if (!rtp_reader_) { | 82 if (!rtp_reader_) { |
83 FATAL() << "Couldn't open input file as either a rtpdump or .pcap. Note " | 83 FATAL() << "Couldn't open input file as either a rtpdump or .pcap. Note " |
84 "that .pcapng is not supported."; | 84 "that .pcapng is not supported."; |
85 } | 85 } |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 } // namespace test | 89 } // namespace test |
90 } // namespace webrtc | 90 } // namespace webrtc |
OLD | NEW |