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