OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 uint32_t ssrc() const { return ssrc_; } | 59 uint32_t ssrc() const { return ssrc_; } |
60 uint16_t seq_num() const { return seq_num_; } | 60 uint16_t seq_num() const { return seq_num_; } |
61 | 61 |
62 private: | 62 private: |
63 rtc::scoped_ptr<uint8_t[]> data_; | 63 rtc::scoped_ptr<uint8_t[]> data_; |
64 size_t length_; | 64 size_t length_; |
65 int64_t resend_time_ms_; | 65 int64_t resend_time_ms_; |
66 uint32_t ssrc_; | 66 uint32_t ssrc_; |
67 uint16_t seq_num_; | 67 uint16_t seq_num_; |
68 | 68 |
69 DISALLOW_IMPLICIT_CONSTRUCTORS(RawRtpPacket); | 69 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RawRtpPacket); |
70 }; | 70 }; |
71 | 71 |
72 class LostPackets { | 72 class LostPackets { |
73 public: | 73 public: |
74 LostPackets(Clock* clock, int64_t rtt_ms) | 74 LostPackets(Clock* clock, int64_t rtt_ms) |
75 : crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), | 75 : crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), |
76 debug_file_(fopen("PacketLossDebug.txt", "w")), | 76 debug_file_(fopen("PacketLossDebug.txt", "w")), |
77 loss_count_(0), | 77 loss_count_(0), |
78 packets_(), | 78 packets_(), |
79 clock_(clock), | 79 clock_(clock), |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 typedef RtpPacketList::iterator RtpPacketIterator; | 175 typedef RtpPacketList::iterator RtpPacketIterator; |
176 typedef RtpPacketList::const_iterator ConstRtpPacketIterator; | 176 typedef RtpPacketList::const_iterator ConstRtpPacketIterator; |
177 | 177 |
178 rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_; | 178 rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_; |
179 FILE* debug_file_; | 179 FILE* debug_file_; |
180 int loss_count_; | 180 int loss_count_; |
181 RtpPacketList packets_; | 181 RtpPacketList packets_; |
182 Clock* clock_; | 182 Clock* clock_; |
183 int64_t rtt_ms_; | 183 int64_t rtt_ms_; |
184 | 184 |
185 DISALLOW_IMPLICIT_CONSTRUCTORS(LostPackets); | 185 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(LostPackets); |
186 }; | 186 }; |
187 | 187 |
188 class SsrcHandlers { | 188 class SsrcHandlers { |
189 public: | 189 public: |
190 SsrcHandlers(PayloadSinkFactoryInterface* payload_sink_factory, | 190 SsrcHandlers(PayloadSinkFactoryInterface* payload_sink_factory, |
191 const PayloadTypes& payload_types) | 191 const PayloadTypes& payload_types) |
192 : payload_sink_factory_(payload_sink_factory), | 192 : payload_sink_factory_(payload_sink_factory), |
193 payload_types_(payload_types), | 193 payload_types_(payload_types), |
194 handlers_() { | 194 handlers_() { |
195 assert(payload_sink_factory); | 195 assert(payload_sink_factory); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_; | 298 rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_; |
299 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; | 299 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; |
300 rtc::scoped_ptr<RtpReceiver> rtp_module_; | 300 rtc::scoped_ptr<RtpReceiver> rtp_module_; |
301 rtc::scoped_ptr<PayloadSinkInterface> payload_sink_; | 301 rtc::scoped_ptr<PayloadSinkInterface> payload_sink_; |
302 | 302 |
303 private: | 303 private: |
304 uint32_t ssrc_; | 304 uint32_t ssrc_; |
305 const PayloadTypes& payload_types_; | 305 const PayloadTypes& payload_types_; |
306 LostPackets* lost_packets_; | 306 LostPackets* lost_packets_; |
307 | 307 |
308 DISALLOW_COPY_AND_ASSIGN(Handler); | 308 RTC_DISALLOW_COPY_AND_ASSIGN(Handler); |
309 }; | 309 }; |
310 | 310 |
311 typedef std::map<uint32_t, Handler*> HandlerMap; | 311 typedef std::map<uint32_t, Handler*> HandlerMap; |
312 typedef std::map<uint32_t, Handler*>::iterator HandlerMapIt; | 312 typedef std::map<uint32_t, Handler*>::iterator HandlerMapIt; |
313 | 313 |
314 PayloadSinkFactoryInterface* payload_sink_factory_; | 314 PayloadSinkFactoryInterface* payload_sink_factory_; |
315 PayloadTypes payload_types_; | 315 PayloadTypes payload_types_; |
316 HandlerMap handlers_; | 316 HandlerMap handlers_; |
317 | 317 |
318 DISALLOW_IMPLICIT_CONSTRUCTORS(SsrcHandlers); | 318 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SsrcHandlers); |
319 }; | 319 }; |
320 | 320 |
321 class RtpPlayerImpl : public RtpPlayerInterface { | 321 class RtpPlayerImpl : public RtpPlayerInterface { |
322 public: | 322 public: |
323 RtpPlayerImpl(PayloadSinkFactoryInterface* payload_sink_factory, | 323 RtpPlayerImpl(PayloadSinkFactoryInterface* payload_sink_factory, |
324 const PayloadTypes& payload_types, | 324 const PayloadTypes& payload_types, |
325 Clock* clock, | 325 Clock* clock, |
326 rtc::scoped_ptr<test::RtpFileReader>* packet_source, | 326 rtc::scoped_ptr<test::RtpFileReader>* packet_source, |
327 float loss_rate, | 327 float loss_rate, |
328 int64_t rtt_ms, | 328 int64_t rtt_ms, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 int64_t first_packet_rtp_time_; | 460 int64_t first_packet_rtp_time_; |
461 int64_t first_packet_time_ms_; | 461 int64_t first_packet_time_ms_; |
462 float loss_rate_; | 462 float loss_rate_; |
463 LostPackets lost_packets_; | 463 LostPackets lost_packets_; |
464 uint32_t resend_packet_count_; | 464 uint32_t resend_packet_count_; |
465 uint32_t no_loss_startup_; | 465 uint32_t no_loss_startup_; |
466 bool end_of_file_; | 466 bool end_of_file_; |
467 bool reordering_; | 467 bool reordering_; |
468 rtc::scoped_ptr<RawRtpPacket> reorder_buffer_; | 468 rtc::scoped_ptr<RawRtpPacket> reorder_buffer_; |
469 | 469 |
470 DISALLOW_IMPLICIT_CONSTRUCTORS(RtpPlayerImpl); | 470 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpPlayerImpl); |
471 }; | 471 }; |
472 | 472 |
473 RtpPlayerInterface* Create(const std::string& input_filename, | 473 RtpPlayerInterface* Create(const std::string& input_filename, |
474 PayloadSinkFactoryInterface* payload_sink_factory, Clock* clock, | 474 PayloadSinkFactoryInterface* payload_sink_factory, Clock* clock, |
475 const PayloadTypes& payload_types, float loss_rate, int64_t rtt_ms, | 475 const PayloadTypes& payload_types, float loss_rate, int64_t rtt_ms, |
476 bool reordering) { | 476 bool reordering) { |
477 rtc::scoped_ptr<test::RtpFileReader> packet_source( | 477 rtc::scoped_ptr<test::RtpFileReader> packet_source( |
478 test::RtpFileReader::Create(test::RtpFileReader::kRtpDump, | 478 test::RtpFileReader::Create(test::RtpFileReader::kRtpDump, |
479 input_filename)); | 479 input_filename)); |
480 if (packet_source.get() == NULL) { | 480 if (packet_source.get() == NULL) { |
481 packet_source.reset(test::RtpFileReader::Create(test::RtpFileReader::kPcap, | 481 packet_source.reset(test::RtpFileReader::Create(test::RtpFileReader::kPcap, |
482 input_filename)); | 482 input_filename)); |
483 if (packet_source.get() == NULL) { | 483 if (packet_source.get() == NULL) { |
484 return NULL; | 484 return NULL; |
485 } | 485 } |
486 } | 486 } |
487 | 487 |
488 rtc::scoped_ptr<RtpPlayerImpl> impl( | 488 rtc::scoped_ptr<RtpPlayerImpl> impl( |
489 new RtpPlayerImpl(payload_sink_factory, payload_types, clock, | 489 new RtpPlayerImpl(payload_sink_factory, payload_types, clock, |
490 &packet_source, loss_rate, rtt_ms, reordering)); | 490 &packet_source, loss_rate, rtt_ms, reordering)); |
491 return impl.release(); | 491 return impl.release(); |
492 } | 492 } |
493 } // namespace rtpplayer | 493 } // namespace rtpplayer |
494 } // namespace webrtc | 494 } // namespace webrtc |
OLD | NEW |