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 11 matching lines...) Expand all Loading... |
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 vcm::VideoReceiver* video_receiver, | 83 vcm::VideoReceiver* video_receiver, |
85 RemoteBitrateEstimator* remote_bitrate_estimator, | |
86 Transport* transport, | 84 Transport* transport, |
87 RtcpRttStats* rtt_stats, | 85 RtcpRttStats* rtt_stats, |
88 PacketRouter* packet_router, | 86 PacketRouter* packet_router, |
89 VieRemb* remb, | 87 VieRemb* remb, |
90 const VideoReceiveStream::Config* config, | 88 const VideoReceiveStream::Config* config, |
91 ReceiveStatisticsProxy* receive_stats_proxy, | 89 ReceiveStatisticsProxy* receive_stats_proxy, |
92 ProcessThread* process_thread, | 90 ProcessThread* process_thread, |
93 NackSender* nack_sender, | 91 NackSender* nack_sender, |
94 KeyFrameRequestSender* keyframe_request_sender, | 92 KeyFrameRequestSender* keyframe_request_sender, |
95 video_coding::OnCompleteFrameCallback* complete_frame_callback, | 93 video_coding::OnCompleteFrameCallback* complete_frame_callback, |
96 VCMTiming* timing) | 94 VCMTiming* timing) |
97 : clock_(Clock::GetRealTimeClock()), | 95 : clock_(Clock::GetRealTimeClock()), |
98 config_(*config), | 96 config_(*config), |
99 video_receiver_(video_receiver), | 97 video_receiver_(video_receiver), |
100 remote_bitrate_estimator_(remote_bitrate_estimator), | |
101 packet_router_(packet_router), | 98 packet_router_(packet_router), |
102 remb_(remb), | 99 remb_(remb), |
103 process_thread_(process_thread), | 100 process_thread_(process_thread), |
104 ntp_estimator_(clock_), | 101 ntp_estimator_(clock_), |
105 rtp_header_parser_(RtpHeaderParser::Create()), | 102 rtp_header_parser_(RtpHeaderParser::Create()), |
106 rtp_receiver_(RtpReceiver::CreateVideoReceiver(clock_, | 103 rtp_receiver_(RtpReceiver::CreateVideoReceiver(clock_, |
107 this, | 104 this, |
108 this, | 105 this, |
109 &rtp_payload_registry_)), | 106 &rtp_payload_registry_)), |
110 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)), | 107 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)), |
111 ulpfec_receiver_(UlpfecReceiver::Create(this)), | 108 ulpfec_receiver_(UlpfecReceiver::Create(this)), |
112 receiving_(false), | 109 receiving_(false), |
113 restored_packet_in_use_(false), | 110 restored_packet_in_use_(false), |
114 last_packet_log_ms_(-1), | 111 last_packet_log_ms_(-1), |
115 rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(), | 112 rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(), |
116 transport, | 113 transport, |
117 rtt_stats, | 114 rtt_stats, |
118 receive_stats_proxy, | 115 receive_stats_proxy, |
119 remote_bitrate_estimator_, | |
120 packet_router)), | 116 packet_router)), |
121 complete_frame_callback_(complete_frame_callback), | 117 complete_frame_callback_(complete_frame_callback), |
122 keyframe_request_sender_(keyframe_request_sender), | 118 keyframe_request_sender_(keyframe_request_sender), |
123 timing_(timing) { | 119 timing_(timing) { |
124 packet_router_->AddRtpModule(rtp_rtcp_.get()); | 120 packet_router_->AddRtpModule(rtp_rtcp_.get()); |
125 rtp_receive_statistics_->RegisterRtpStatisticsCallback(receive_stats_proxy); | 121 rtp_receive_statistics_->RegisterRtpStatisticsCallback(receive_stats_proxy); |
126 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(receive_stats_proxy); | 122 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(receive_stats_proxy); |
127 | 123 |
128 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff) | 124 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff) |
129 << "A stream should not be configured with RTCP disabled. This value is " | 125 << "A stream should not be configured with RTCP disabled. This value is " |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 return 0; | 312 return 0; |
317 } | 313 } |
318 | 314 |
319 void RtpStreamReceiver::OnIncomingSSRCChanged(const uint32_t ssrc) { | 315 void RtpStreamReceiver::OnIncomingSSRCChanged(const uint32_t ssrc) { |
320 rtp_rtcp_->SetRemoteSSRC(ssrc); | 316 rtp_rtcp_->SetRemoteSSRC(ssrc); |
321 } | 317 } |
322 | 318 |
323 bool RtpStreamReceiver::DeliverRtp(const uint8_t* rtp_packet, | 319 bool RtpStreamReceiver::DeliverRtp(const uint8_t* rtp_packet, |
324 size_t rtp_packet_length, | 320 size_t rtp_packet_length, |
325 const PacketTime& packet_time) { | 321 const PacketTime& packet_time) { |
326 RTC_DCHECK(remote_bitrate_estimator_); | |
327 { | 322 { |
328 rtc::CritScope lock(&receive_cs_); | 323 rtc::CritScope lock(&receive_cs_); |
329 if (!receiving_) { | 324 if (!receiving_) { |
330 return false; | 325 return false; |
331 } | 326 } |
332 } | 327 } |
333 | 328 |
334 RTPHeader header; | 329 RTPHeader header; |
335 if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, | 330 if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, |
336 &header)) { | 331 &header)) { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 return; | 668 return; |
674 | 669 |
675 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) | 670 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) |
676 return; | 671 return; |
677 | 672 |
678 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), | 673 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), |
679 sprop_decoder.pps_nalu()); | 674 sprop_decoder.pps_nalu()); |
680 } | 675 } |
681 | 676 |
682 } // namespace webrtc | 677 } // namespace webrtc |
OLD | NEW |