| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 sent_video_rate_bps, sent_nack_rate_bps, | 72 sent_video_rate_bps, sent_nack_rate_bps, |
| 73 sent_fec_rate_bps); | 73 sent_fec_rate_bps); |
| 74 } | 74 } |
| 75 private: | 75 private: |
| 76 ViEChannel* owner_; | 76 ViEChannel* owner_; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 ViEChannel::ViEChannel(Transport* transport, | 79 ViEChannel::ViEChannel(Transport* transport, |
| 80 ProcessThread* module_process_thread, | 80 ProcessThread* module_process_thread, |
| 81 PayloadRouter* send_payload_router, | 81 PayloadRouter* send_payload_router, |
| 82 VideoCodingModule* vcm, | |
| 83 RtcpIntraFrameObserver* intra_frame_observer, | 82 RtcpIntraFrameObserver* intra_frame_observer, |
| 84 RtcpBandwidthObserver* bandwidth_observer, | 83 RtcpBandwidthObserver* bandwidth_observer, |
| 85 TransportFeedbackObserver* transport_feedback_observer, | 84 TransportFeedbackObserver* transport_feedback_observer, |
| 86 RemoteBitrateEstimator* remote_bitrate_estimator, | 85 RemoteBitrateEstimator* remote_bitrate_estimator, |
| 87 RtcpRttStats* rtt_stats, | 86 RtcpRttStats* rtt_stats, |
| 88 PacedSender* paced_sender, | 87 PacedSender* paced_sender, |
| 89 PacketRouter* packet_router, | 88 PacketRouter* packet_router, |
| 90 size_t max_rtp_streams, | 89 size_t max_rtp_streams, |
| 91 bool sender) | 90 bool sender) |
| 92 : sender_(sender), | 91 : sender_(sender), |
| 93 module_process_thread_(module_process_thread), | 92 module_process_thread_(module_process_thread), |
| 94 send_payload_router_(send_payload_router), | 93 send_payload_router_(send_payload_router), |
| 95 vcm_protection_callback_(new ViEChannelProtectionCallback(this)), | 94 vcm_protection_callback_(new ViEChannelProtectionCallback(this)), |
| 96 vcm_(vcm), | 95 vcm_(sender_ ? nullptr |
| 97 vie_receiver_(vcm_, remote_bitrate_estimator, this), | 96 : VideoCodingModule::Create(Clock::GetRealTimeClock(), |
| 98 vie_sync_(vcm_), | 97 nullptr, |
| 98 nullptr)), |
| 99 vie_receiver_(vcm_.get(), remote_bitrate_estimator, this), |
| 100 vie_sync_(vcm_.get()), |
| 99 stats_observer_(new ChannelStatsObserver(this)), | 101 stats_observer_(new ChannelStatsObserver(this)), |
| 100 receive_stats_callback_(nullptr), | 102 receive_stats_callback_(nullptr), |
| 101 incoming_video_stream_(nullptr), | 103 incoming_video_stream_(nullptr), |
| 102 intra_frame_observer_(intra_frame_observer), | 104 intra_frame_observer_(intra_frame_observer), |
| 103 rtt_stats_(rtt_stats), | 105 rtt_stats_(rtt_stats), |
| 104 paced_sender_(paced_sender), | 106 paced_sender_(paced_sender), |
| 105 packet_router_(packet_router), | 107 packet_router_(packet_router), |
| 106 bandwidth_observer_(bandwidth_observer), | 108 bandwidth_observer_(bandwidth_observer), |
| 107 transport_feedback_observer_(transport_feedback_observer), | 109 transport_feedback_observer_(transport_feedback_observer), |
| 108 nack_history_size_sender_(kMinSendSidePacketHistorySize), | 110 nack_history_size_sender_(kMinSendSidePacketHistorySize), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 134 if (sender_) { | 136 if (sender_) { |
| 135 RTC_DCHECK(send_payload_router_); | 137 RTC_DCHECK(send_payload_router_); |
| 136 RTC_DCHECK(!vcm_); | 138 RTC_DCHECK(!vcm_); |
| 137 } else { | 139 } else { |
| 138 RTC_DCHECK(!send_payload_router_); | 140 RTC_DCHECK(!send_payload_router_); |
| 139 RTC_DCHECK(vcm_); | 141 RTC_DCHECK(vcm_); |
| 140 vcm_->SetNackSettings(kMaxNackListSize, max_nack_reordering_threshold_, 0); | 142 vcm_->SetNackSettings(kMaxNackListSize, max_nack_reordering_threshold_, 0); |
| 141 } | 143 } |
| 142 } | 144 } |
| 143 | 145 |
| 144 int32_t ViEChannel::Init() { | 146 void ViEChannel::Init() { |
| 145 static const int kDefaultRenderDelayMs = 10; | |
| 146 module_process_thread_->RegisterModule(vie_receiver_.GetReceiveStatistics()); | 147 module_process_thread_->RegisterModule(vie_receiver_.GetReceiveStatistics()); |
| 147 | 148 |
| 148 // RTP/RTCP initialization. | 149 // RTP/RTCP initialization. |
| 149 module_process_thread_->RegisterModule(rtp_rtcp_modules_[0]); | 150 module_process_thread_->RegisterModule(rtp_rtcp_modules_[0]); |
| 150 | 151 |
| 151 rtp_rtcp_modules_[0]->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp); | 152 rtp_rtcp_modules_[0]->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp); |
| 152 if (paced_sender_) { | 153 if (paced_sender_) { |
| 153 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 154 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 154 rtp_rtcp->SetStorePacketsStatus(true, nack_history_size_sender_); | 155 rtp_rtcp->SetStorePacketsStatus(true, nack_history_size_sender_); |
| 155 } | 156 } |
| 156 packet_router_->AddRtpModule(rtp_rtcp_modules_[0], sender_); | 157 packet_router_->AddRtpModule(rtp_rtcp_modules_[0], sender_); |
| 157 if (sender_) { | 158 if (sender_) { |
| 158 send_payload_router_->SetSendingRtpModules( | 159 send_payload_router_->SetSendingRtpModules( |
| 159 std::vector<RtpRtcp*>(1, rtp_rtcp_modules_[0])); | 160 std::vector<RtpRtcp*>(1, rtp_rtcp_modules_[0])); |
| 160 RTC_DCHECK(!send_payload_router_->active()); | 161 RTC_DCHECK(!send_payload_router_->active()); |
| 161 } else { | 162 } else { |
| 162 if (vcm_->RegisterReceiveCallback(this) != 0) { | |
| 163 return -1; | |
| 164 } | |
| 165 vcm_->RegisterFrameTypeCallback(this); | |
| 166 vcm_->RegisterReceiveStatisticsCallback(this); | |
| 167 vcm_->RegisterDecoderTimingCallback(this); | |
| 168 vcm_->SetRenderDelay(kDefaultRenderDelayMs); | |
| 169 module_process_thread_->RegisterModule(&vie_sync_); | 163 module_process_thread_->RegisterModule(&vie_sync_); |
| 170 } | 164 } |
| 171 return 0; | |
| 172 } | 165 } |
| 173 | 166 |
| 174 ViEChannel::~ViEChannel() { | 167 ViEChannel::~ViEChannel() { |
| 175 UpdateHistograms(); | 168 UpdateHistograms(); |
| 176 // Make sure we don't get more callbacks from the RTP module. | 169 // Make sure we don't get more callbacks from the RTP module. |
| 177 module_process_thread_->DeRegisterModule( | 170 module_process_thread_->DeRegisterModule( |
| 178 vie_receiver_.GetReceiveStatistics()); | 171 vie_receiver_.GetReceiveStatistics()); |
| 179 if (sender_) { | 172 if (sender_) { |
| 180 send_payload_router_->SetSendingRtpModules(std::vector<RtpRtcp*>()); | 173 send_payload_router_->SetSendingRtpModules(std::vector<RtpRtcp*>()); |
| 181 } else { | 174 } else { |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 return 0; | 803 return 0; |
| 811 } | 804 } |
| 812 | 805 |
| 813 int32_t ViEChannel::SetMTU(uint16_t mtu) { | 806 int32_t ViEChannel::SetMTU(uint16_t mtu) { |
| 814 RTC_DCHECK(sender_); | 807 RTC_DCHECK(sender_); |
| 815 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 808 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 816 rtp_rtcp->SetMaxTransferUnit(mtu); | 809 rtp_rtcp->SetMaxTransferUnit(mtu); |
| 817 return 0; | 810 return 0; |
| 818 } | 811 } |
| 819 | 812 |
| 813 VideoCodingModule* ViEChannel::vcm() { |
| 814 return vcm_.get(); |
| 815 } |
| 816 |
| 820 RtpRtcp* ViEChannel::rtp_rtcp() { | 817 RtpRtcp* ViEChannel::rtp_rtcp() { |
| 821 return rtp_rtcp_modules_[0]; | 818 return rtp_rtcp_modules_[0]; |
| 822 } | 819 } |
| 823 | 820 |
| 824 ViEReceiver* ViEChannel::vie_receiver() { | 821 ViEReceiver* ViEChannel::vie_receiver() { |
| 825 return &vie_receiver_; | 822 return &vie_receiver_; |
| 826 } | 823 } |
| 827 | 824 |
| 828 VCMProtectionCallback* ViEChannel::vcm_protection_callback() { | 825 VCMProtectionCallback* ViEChannel::vcm_protection_callback() { |
| 829 return vcm_protection_callback_.get(); | 826 return vcm_protection_callback_.get(); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 rtc::CritScope lock(&crit_); | 1045 rtc::CritScope lock(&crit_); |
| 1049 receive_stats_callback_ = receive_statistics_proxy; | 1046 receive_stats_callback_ = receive_statistics_proxy; |
| 1050 } | 1047 } |
| 1051 | 1048 |
| 1052 void ViEChannel::SetIncomingVideoStream( | 1049 void ViEChannel::SetIncomingVideoStream( |
| 1053 IncomingVideoStream* incoming_video_stream) { | 1050 IncomingVideoStream* incoming_video_stream) { |
| 1054 rtc::CritScope lock(&crit_); | 1051 rtc::CritScope lock(&crit_); |
| 1055 incoming_video_stream_ = incoming_video_stream; | 1052 incoming_video_stream_ = incoming_video_stream; |
| 1056 } | 1053 } |
| 1057 } // namespace webrtc | 1054 } // namespace webrtc |
| OLD | NEW |