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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 remb_(remb), | 365 remb_(remb), |
366 encoder_thread_(EncoderThreadFunction, this, "EncoderThread"), | 366 encoder_thread_(EncoderThreadFunction, this, "EncoderThread"), |
367 encoder_wakeup_event_(false, false), | 367 encoder_wakeup_event_(false, false), |
368 stop_encoder_thread_(0), | 368 stop_encoder_thread_(0), |
369 overuse_detector_( | 369 overuse_detector_( |
370 Clock::GetRealTimeClock(), | 370 Clock::GetRealTimeClock(), |
371 GetCpuOveruseOptions(config.encoder_settings.full_overuse_time), | 371 GetCpuOveruseOptions(config.encoder_settings.full_overuse_time), |
372 this, | 372 this, |
373 config.post_encode_callback, | 373 config.post_encode_callback, |
374 &stats_proxy_), | 374 &stats_proxy_), |
375 vie_encoder_(num_cpu_cores, | 375 vie_encoder_( |
376 config_.rtp.ssrcs, | 376 num_cpu_cores, |
377 module_process_thread_, | 377 config_.rtp.ssrcs, |
378 &stats_proxy_, | 378 module_process_thread_, |
379 config.pre_encode_callback, | 379 &stats_proxy_, |
380 &overuse_detector_, | 380 &overuse_detector_), |
381 congestion_controller_->pacer()), | |
382 video_sender_(vie_encoder_.video_sender()), | 381 video_sender_(vie_encoder_.video_sender()), |
383 bandwidth_observer_(congestion_controller_->GetBitrateController() | 382 bandwidth_observer_(congestion_controller_->GetBitrateController() |
384 ->CreateRtcpBandwidthObserver()), | 383 ->CreateRtcpBandwidthObserver()), |
385 rtp_rtcp_modules_(CreateRtpRtcpModules( | 384 rtp_rtcp_modules_(CreateRtpRtcpModules( |
386 config.send_transport, | 385 config.send_transport, |
387 &encoder_feedback_, | 386 &encoder_feedback_, |
388 bandwidth_observer_.get(), | 387 bandwidth_observer_.get(), |
389 congestion_controller_->GetTransportFeedbackObserver(), | 388 congestion_controller_->GetTransportFeedbackObserver(), |
390 call_stats_->rtcp_rtt_stats(), | 389 call_stats_->rtcp_rtt_stats(), |
391 congestion_controller_->pacer(), | 390 congestion_controller_->pacer(), |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 bitrate_allocator_->EnforceMinBitrate(false); | 570 bitrate_allocator_->EnforceMinBitrate(false); |
572 } | 571 } |
573 // We might've gotten new settings while configuring the encoder settings, | 572 // We might've gotten new settings while configuring the encoder settings, |
574 // restart from the top to see if that's the case before trying to encode | 573 // restart from the top to see if that's the case before trying to encode |
575 // a frame (which might correspond to the last frame size). | 574 // a frame (which might correspond to the last frame size). |
576 encoder_wakeup_event_.Set(); | 575 encoder_wakeup_event_.Set(); |
577 continue; | 576 continue; |
578 } | 577 } |
579 | 578 |
580 VideoFrame frame; | 579 VideoFrame frame; |
581 if (input_.GetVideoFrame(&frame)) | 580 if (input_.GetVideoFrame(&frame)) { |
| 581 // TODO(perkj): |pre_encode_callback| is only used by tests. Tests should |
| 582 // register as a sink to the VideoSource instead. |
| 583 if (config_.pre_encode_callback) { |
| 584 config_.pre_encode_callback->OnFrame(frame); |
| 585 } |
582 vie_encoder_.EncodeVideoFrame(frame); | 586 vie_encoder_.EncodeVideoFrame(frame); |
| 587 } |
583 } | 588 } |
584 vie_encoder_.DeRegisterExternalEncoder(config_.encoder_settings.payload_type); | 589 vie_encoder_.DeRegisterExternalEncoder(config_.encoder_settings.payload_type); |
585 } | 590 } |
586 | 591 |
587 void VideoSendStream::ReconfigureVideoEncoder( | 592 void VideoSendStream::ReconfigureVideoEncoder( |
588 const VideoEncoderConfig& config) { | 593 const VideoEncoderConfig& config) { |
589 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); | 594 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); |
590 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); | 595 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); |
591 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), config.streams.size()); | 596 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), config.streams.size()); |
592 VideoCodec video_codec = VideoEncoderConfigToVideoCodec( | 597 VideoCodec video_codec = VideoEncoderConfigToVideoCodec( |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 &module_nack_rate); | 772 &module_nack_rate); |
768 *sent_video_rate_bps += module_video_rate; | 773 *sent_video_rate_bps += module_video_rate; |
769 *sent_nack_rate_bps += module_nack_rate; | 774 *sent_nack_rate_bps += module_nack_rate; |
770 *sent_fec_rate_bps += module_fec_rate; | 775 *sent_fec_rate_bps += module_fec_rate; |
771 } | 776 } |
772 return 0; | 777 return 0; |
773 } | 778 } |
774 | 779 |
775 } // namespace internal | 780 } // namespace internal |
776 } // namespace webrtc | 781 } // namespace webrtc |
OLD | NEW |