| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 overuse_detector_( | 169 overuse_detector_( |
| 170 Clock::GetRealTimeClock(), | 170 Clock::GetRealTimeClock(), |
| 171 GetCpuOveruseOptions(config.encoder_settings.full_overuse_time), | 171 GetCpuOveruseOptions(config.encoder_settings.full_overuse_time), |
| 172 this, | 172 this, |
| 173 config.post_encode_callback, | 173 config.post_encode_callback, |
| 174 &stats_proxy_), | 174 &stats_proxy_), |
| 175 vie_channel_(config.send_transport, | 175 vie_channel_(config.send_transport, |
| 176 module_process_thread_, | 176 module_process_thread_, |
| 177 &payload_router_, | 177 &payload_router_, |
| 178 nullptr, | 178 nullptr, |
| 179 encoder_feedback_.GetRtcpIntraFrameObserver(), | 179 &encoder_feedback_, |
| 180 congestion_controller_->GetBitrateController() | 180 congestion_controller_->GetBitrateController() |
| 181 ->CreateRtcpBandwidthObserver(), | 181 ->CreateRtcpBandwidthObserver(), |
| 182 congestion_controller_->GetTransportFeedbackObserver(), | 182 congestion_controller_->GetTransportFeedbackObserver(), |
| 183 nullptr, | 183 nullptr, |
| 184 call_stats_->rtcp_rtt_stats(), | 184 call_stats_->rtcp_rtt_stats(), |
| 185 congestion_controller_->pacer(), | 185 congestion_controller_->pacer(), |
| 186 congestion_controller_->packet_router(), | 186 congestion_controller_->packet_router(), |
| 187 config_.rtp.ssrcs.size(), | 187 config_.rtp.ssrcs.size(), |
| 188 true), | 188 true), |
| 189 vie_receiver_(vie_channel_.vie_receiver()), | 189 vie_receiver_(vie_channel_.vie_receiver()), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 202 &overuse_detector_) { | 202 &overuse_detector_) { |
| 203 LOG(LS_INFO) << "VideoSendStream: " << config_.ToString(); | 203 LOG(LS_INFO) << "VideoSendStream: " << config_.ToString(); |
| 204 | 204 |
| 205 RTC_DCHECK(!config_.rtp.ssrcs.empty()); | 205 RTC_DCHECK(!config_.rtp.ssrcs.empty()); |
| 206 RTC_DCHECK(module_process_thread_); | 206 RTC_DCHECK(module_process_thread_); |
| 207 RTC_DCHECK(call_stats_); | 207 RTC_DCHECK(call_stats_); |
| 208 RTC_DCHECK(congestion_controller_); | 208 RTC_DCHECK(congestion_controller_); |
| 209 RTC_DCHECK(remb_); | 209 RTC_DCHECK(remb_); |
| 210 | 210 |
| 211 RTC_CHECK(vie_encoder_.Init()); | 211 RTC_CHECK(vie_encoder_.Init()); |
| 212 encoder_feedback_.Init(config_.rtp.ssrcs, &vie_encoder_); |
| 212 RTC_CHECK(vie_channel_.Init() == 0); | 213 RTC_CHECK(vie_channel_.Init() == 0); |
| 213 | 214 |
| 214 vcm_->RegisterProtectionCallback(vie_channel_.vcm_protection_callback()); | 215 vcm_->RegisterProtectionCallback(vie_channel_.vcm_protection_callback()); |
| 215 | 216 |
| 216 call_stats_->RegisterStatsObserver(vie_channel_.GetStatsObserver()); | 217 call_stats_->RegisterStatsObserver(vie_channel_.GetStatsObserver()); |
| 217 | 218 |
| 218 vie_encoder_.SetSsrcs(std::vector<uint32_t>(1, config_.rtp.ssrcs[0])); | 219 vie_encoder_.SetSsrcs(std::vector<uint32_t>(1, config_.rtp.ssrcs[0])); |
| 219 | 220 |
| 220 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { | 221 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { |
| 221 const std::string& extension = config_.rtp.extensions[i].name; | 222 const std::string& extension = config_.rtp.extensions[i].name; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 RTC_CHECK(ReconfigureVideoEncoder(encoder_config)); | 282 RTC_CHECK(ReconfigureVideoEncoder(encoder_config)); |
| 282 | 283 |
| 283 vie_channel_.RegisterSendSideDelayObserver(&stats_proxy_); | 284 vie_channel_.RegisterSendSideDelayObserver(&stats_proxy_); |
| 284 | 285 |
| 285 if (config_.post_encode_callback) | 286 if (config_.post_encode_callback) |
| 286 vie_encoder_.RegisterPostEncodeImageCallback(&encoded_frame_proxy_); | 287 vie_encoder_.RegisterPostEncodeImageCallback(&encoded_frame_proxy_); |
| 287 | 288 |
| 288 if (config_.suspend_below_min_bitrate) | 289 if (config_.suspend_below_min_bitrate) |
| 289 vie_encoder_.SuspendBelowMinBitrate(); | 290 vie_encoder_.SuspendBelowMinBitrate(); |
| 290 | 291 |
| 291 encoder_feedback_.AddEncoder(config_.rtp.ssrcs, &vie_encoder_); | |
| 292 | |
| 293 vie_channel_.RegisterSendChannelRtcpStatisticsCallback(&stats_proxy_); | 292 vie_channel_.RegisterSendChannelRtcpStatisticsCallback(&stats_proxy_); |
| 294 vie_channel_.RegisterSendChannelRtpStatisticsCallback(&stats_proxy_); | 293 vie_channel_.RegisterSendChannelRtpStatisticsCallback(&stats_proxy_); |
| 295 vie_channel_.RegisterRtcpPacketTypeCounterObserver(&stats_proxy_); | 294 vie_channel_.RegisterRtcpPacketTypeCounterObserver(&stats_proxy_); |
| 296 vie_channel_.RegisterSendBitrateObserver(&stats_proxy_); | 295 vie_channel_.RegisterSendBitrateObserver(&stats_proxy_); |
| 297 vie_channel_.RegisterSendFrameCountObserver(&stats_proxy_); | 296 vie_channel_.RegisterSendFrameCountObserver(&stats_proxy_); |
| 298 | 297 |
| 299 module_process_thread_->RegisterModule(&overuse_detector_); | 298 module_process_thread_->RegisterModule(&overuse_detector_); |
| 300 } | 299 } |
| 301 | 300 |
| 302 VideoSendStream::~VideoSendStream() { | 301 VideoSendStream::~VideoSendStream() { |
| 303 LOG(LS_INFO) << "~VideoSendStream: " << config_.ToString(); | 302 LOG(LS_INFO) << "~VideoSendStream: " << config_.ToString(); |
| 304 Stop(); | 303 Stop(); |
| 305 | 304 |
| 306 module_process_thread_->DeRegisterModule(&overuse_detector_); | 305 module_process_thread_->DeRegisterModule(&overuse_detector_); |
| 307 vie_channel_.RegisterSendFrameCountObserver(nullptr); | 306 vie_channel_.RegisterSendFrameCountObserver(nullptr); |
| 308 vie_channel_.RegisterSendBitrateObserver(nullptr); | 307 vie_channel_.RegisterSendBitrateObserver(nullptr); |
| 309 vie_channel_.RegisterRtcpPacketTypeCounterObserver(nullptr); | 308 vie_channel_.RegisterRtcpPacketTypeCounterObserver(nullptr); |
| 310 vie_channel_.RegisterSendChannelRtpStatisticsCallback(nullptr); | 309 vie_channel_.RegisterSendChannelRtpStatisticsCallback(nullptr); |
| 311 vie_channel_.RegisterSendChannelRtcpStatisticsCallback(nullptr); | 310 vie_channel_.RegisterSendChannelRtcpStatisticsCallback(nullptr); |
| 312 | 311 |
| 313 vie_encoder_.DeRegisterExternalEncoder( | 312 vie_encoder_.DeRegisterExternalEncoder( |
| 314 config_.encoder_settings.payload_type); | 313 config_.encoder_settings.payload_type); |
| 315 | 314 |
| 316 call_stats_->DeregisterStatsObserver(vie_channel_.GetStatsObserver()); | 315 call_stats_->DeregisterStatsObserver(vie_channel_.GetStatsObserver()); |
| 317 | 316 |
| 318 RtpRtcp* rtp_module = vie_channel_.rtp_rtcp(); | 317 RtpRtcp* rtp_module = vie_channel_.rtp_rtcp(); |
| 319 rtp_module->SetREMBStatus(false); | 318 rtp_module->SetREMBStatus(false); |
| 320 remb_->RemoveRembSender(rtp_module); | 319 remb_->RemoveRembSender(rtp_module); |
| 321 | 320 |
| 322 // Remove the feedback, stop all encoding threads and processing. This must be | 321 // ViEChannel outlives ViEEncoder so remove encoder from feedback before |
| 323 // done before deleting the channel. | 322 // destruction. |
| 324 encoder_feedback_.RemoveEncoder(&vie_encoder_); | 323 encoder_feedback_.TearDown(); |
| 325 | 324 |
| 326 congestion_controller_->GetRemoteBitrateEstimator(false)->RemoveStream( | 325 congestion_controller_->GetRemoteBitrateEstimator(false)->RemoveStream( |
| 327 vie_receiver_->GetRemoteSsrc()); | 326 vie_receiver_->GetRemoteSsrc()); |
| 328 } | 327 } |
| 329 | 328 |
| 330 VideoCaptureInput* VideoSendStream::Input() { | 329 VideoCaptureInput* VideoSendStream::Input() { |
| 331 return &input_; | 330 return &input_; |
| 332 } | 331 } |
| 333 | 332 |
| 334 void VideoSendStream::Start() { | 333 void VideoSendStream::Start() { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 used_ssrcs.resize(static_cast<size_t>(video_codec.numberOfSimulcastStreams)); | 623 used_ssrcs.resize(static_cast<size_t>(video_codec.numberOfSimulcastStreams)); |
| 625 vie_encoder_.SetSsrcs(used_ssrcs); | 624 vie_encoder_.SetSsrcs(used_ssrcs); |
| 626 | 625 |
| 627 // Restart the media flow | 626 // Restart the media flow |
| 628 vie_encoder_.Restart(); | 627 vie_encoder_.Restart(); |
| 629 | 628 |
| 630 return true; | 629 return true; |
| 631 } | 630 } |
| 632 } // namespace internal | 631 } // namespace internal |
| 633 } // namespace webrtc | 632 } // namespace webrtc |
| OLD | NEW |