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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 namespace { | 43 namespace { |
44 constexpr int kPacketBufferStartSize = 32; | 44 constexpr int kPacketBufferStartSize = 32; |
45 constexpr int kPacketBufferMaxSixe = 2048; | 45 constexpr int kPacketBufferMaxSixe = 2048; |
46 } | 46 } |
47 | 47 |
48 std::unique_ptr<RtpRtcp> CreateRtpRtcpModule( | 48 std::unique_ptr<RtpRtcp> CreateRtpRtcpModule( |
49 ReceiveStatistics* receive_statistics, | 49 ReceiveStatistics* receive_statistics, |
50 Transport* outgoing_transport, | 50 Transport* outgoing_transport, |
51 RtcpRttStats* rtt_stats, | 51 RtcpRttStats* rtt_stats, |
52 RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer, | 52 RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer, |
53 RemoteBitrateEstimator* remote_bitrate_estimator, | |
54 TransportSequenceNumberAllocator* transport_sequence_number_allocator) { | 53 TransportSequenceNumberAllocator* transport_sequence_number_allocator) { |
55 RtpRtcp::Configuration configuration; | 54 RtpRtcp::Configuration configuration; |
56 configuration.audio = false; | 55 configuration.audio = false; |
57 configuration.receiver_only = true; | 56 configuration.receiver_only = true; |
58 configuration.receive_statistics = receive_statistics; | 57 configuration.receive_statistics = receive_statistics; |
59 configuration.outgoing_transport = outgoing_transport; | 58 configuration.outgoing_transport = outgoing_transport; |
60 configuration.intra_frame_callback = nullptr; | 59 configuration.intra_frame_callback = nullptr; |
61 configuration.rtt_stats = rtt_stats; | 60 configuration.rtt_stats = rtt_stats; |
62 configuration.rtcp_packet_type_counter_observer = | 61 configuration.rtcp_packet_type_counter_observer = |
63 rtcp_packet_type_counter_observer; | 62 rtcp_packet_type_counter_observer; |
(...skipping 10 matching lines...) Expand all Loading... |
74 rtp_rtcp->SetSendingStatus(false); | 73 rtp_rtcp->SetSendingStatus(false); |
75 rtp_rtcp->SetSendingMediaStatus(false); | 74 rtp_rtcp->SetSendingMediaStatus(false); |
76 rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound); | 75 rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound); |
77 | 76 |
78 return rtp_rtcp; | 77 return rtp_rtcp; |
79 } | 78 } |
80 | 79 |
81 static const int kPacketLogIntervalMs = 10000; | 80 static const int kPacketLogIntervalMs = 10000; |
82 | 81 |
83 RtpStreamReceiver::RtpStreamReceiver( | 82 RtpStreamReceiver::RtpStreamReceiver( |
84 RemoteBitrateEstimator* remote_bitrate_estimator, | |
85 Transport* transport, | 83 Transport* transport, |
86 RtcpRttStats* rtt_stats, | 84 RtcpRttStats* rtt_stats, |
87 PacketRouter* packet_router, | 85 PacketRouter* packet_router, |
88 VieRemb* remb, | 86 VieRemb* remb, |
89 const VideoReceiveStream::Config* config, | 87 const VideoReceiveStream::Config* config, |
90 ReceiveStatisticsProxy* receive_stats_proxy, | 88 ReceiveStatisticsProxy* receive_stats_proxy, |
91 ProcessThread* process_thread, | 89 ProcessThread* process_thread, |
92 NackSender* nack_sender, | 90 NackSender* nack_sender, |
93 KeyFrameRequestSender* keyframe_request_sender, | 91 KeyFrameRequestSender* keyframe_request_sender, |
94 video_coding::OnCompleteFrameCallback* complete_frame_callback, | 92 video_coding::OnCompleteFrameCallback* complete_frame_callback, |
95 VCMTiming* timing) | 93 VCMTiming* timing) |
96 : clock_(Clock::GetRealTimeClock()), | 94 : clock_(Clock::GetRealTimeClock()), |
97 config_(*config), | 95 config_(*config), |
98 remote_bitrate_estimator_(remote_bitrate_estimator), | |
99 packet_router_(packet_router), | 96 packet_router_(packet_router), |
100 remb_(remb), | 97 remb_(remb), |
101 process_thread_(process_thread), | 98 process_thread_(process_thread), |
102 ntp_estimator_(clock_), | 99 ntp_estimator_(clock_), |
103 rtp_header_parser_(RtpHeaderParser::Create()), | 100 rtp_header_parser_(RtpHeaderParser::Create()), |
104 rtp_receiver_(RtpReceiver::CreateVideoReceiver(clock_, | 101 rtp_receiver_(RtpReceiver::CreateVideoReceiver(clock_, |
105 this, | 102 this, |
106 this, | 103 this, |
107 &rtp_payload_registry_)), | 104 &rtp_payload_registry_)), |
108 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)), | 105 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)), |
109 ulpfec_receiver_(UlpfecReceiver::Create(this)), | 106 ulpfec_receiver_(UlpfecReceiver::Create(this)), |
110 receiving_(false), | 107 receiving_(false), |
111 restored_packet_in_use_(false), | 108 restored_packet_in_use_(false), |
112 last_packet_log_ms_(-1), | 109 last_packet_log_ms_(-1), |
113 rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(), | 110 rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(), |
114 transport, | 111 transport, |
115 rtt_stats, | 112 rtt_stats, |
116 receive_stats_proxy, | 113 receive_stats_proxy, |
117 remote_bitrate_estimator_, | |
118 packet_router)), | 114 packet_router)), |
119 complete_frame_callback_(complete_frame_callback), | 115 complete_frame_callback_(complete_frame_callback), |
120 keyframe_request_sender_(keyframe_request_sender), | 116 keyframe_request_sender_(keyframe_request_sender), |
121 timing_(timing) { | 117 timing_(timing) { |
122 packet_router_->AddRtpModule(rtp_rtcp_.get()); | 118 packet_router_->AddRtpModule(rtp_rtcp_.get()); |
123 rtp_receive_statistics_->RegisterRtpStatisticsCallback(receive_stats_proxy); | 119 rtp_receive_statistics_->RegisterRtpStatisticsCallback(receive_stats_proxy); |
124 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(receive_stats_proxy); | 120 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(receive_stats_proxy); |
125 | 121 |
126 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff) | 122 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff) |
127 << "A stream should not be configured with RTCP disabled. This value is " | 123 << "A stream should not be configured with RTCP disabled. This value is " |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 return 0; | 298 return 0; |
303 } | 299 } |
304 | 300 |
305 void RtpStreamReceiver::OnIncomingSSRCChanged(const uint32_t ssrc) { | 301 void RtpStreamReceiver::OnIncomingSSRCChanged(const uint32_t ssrc) { |
306 rtp_rtcp_->SetRemoteSSRC(ssrc); | 302 rtp_rtcp_->SetRemoteSSRC(ssrc); |
307 } | 303 } |
308 | 304 |
309 bool RtpStreamReceiver::DeliverRtp(const uint8_t* rtp_packet, | 305 bool RtpStreamReceiver::DeliverRtp(const uint8_t* rtp_packet, |
310 size_t rtp_packet_length, | 306 size_t rtp_packet_length, |
311 const PacketTime& packet_time) { | 307 const PacketTime& packet_time) { |
312 RTC_DCHECK(remote_bitrate_estimator_); | |
313 { | 308 { |
314 rtc::CritScope lock(&receive_cs_); | 309 rtc::CritScope lock(&receive_cs_); |
315 if (!receiving_) { | 310 if (!receiving_) { |
316 return false; | 311 return false; |
317 } | 312 } |
318 } | 313 } |
319 | 314 |
320 RTPHeader header; | 315 RTPHeader header; |
321 if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, | 316 if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, |
322 &header)) { | 317 &header)) { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 return; | 649 return; |
655 | 650 |
656 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) | 651 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) |
657 return; | 652 return; |
658 | 653 |
659 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), | 654 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), |
660 sprop_decoder.pps_nalu()); | 655 sprop_decoder.pps_nalu()); |
661 } | 656 } |
662 | 657 |
663 } // namespace webrtc | 658 } // namespace webrtc |
OLD | NEW |