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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_( | 375 vie_encoder_( |
376 num_cpu_cores, | 376 num_cpu_cores, |
377 config_.rtp.ssrcs, | 377 config_.rtp.ssrcs, |
378 module_process_thread_, | 378 module_process_thread_, |
379 &stats_proxy_, | 379 &stats_proxy_, |
380 config.pre_encode_callback, | |
381 &overuse_detector_, | 380 &overuse_detector_, |
382 congestion_controller_->pacer(), | |
383 &payload_router_, | 381 &payload_router_, |
384 config.post_encode_callback ? &encoded_frame_proxy_ : nullptr), | 382 config.post_encode_callback ? &encoded_frame_proxy_ : nullptr), |
385 video_sender_(vie_encoder_.video_sender()), | 383 video_sender_(vie_encoder_.video_sender()), |
386 bandwidth_observer_(congestion_controller_->GetBitrateController() | 384 bandwidth_observer_(congestion_controller_->GetBitrateController() |
387 ->CreateRtcpBandwidthObserver()), | 385 ->CreateRtcpBandwidthObserver()), |
388 rtp_rtcp_modules_(CreateRtpRtcpModules( | 386 rtp_rtcp_modules_(CreateRtpRtcpModules( |
389 config.send_transport, | 387 config.send_transport, |
390 &encoder_feedback_, | 388 &encoder_feedback_, |
391 bandwidth_observer_.get(), | 389 bandwidth_observer_.get(), |
392 congestion_controller_->GetTransportFeedbackObserver(), | 390 congestion_controller_->GetTransportFeedbackObserver(), |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 bitrate_allocator_->EnforceMinBitrate(false); | 570 bitrate_allocator_->EnforceMinBitrate(false); |
573 } | 571 } |
574 // We might've gotten new settings while configuring the encoder settings, | 572 // We might've gotten new settings while configuring the encoder settings, |
575 // 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 |
576 // a frame (which might correspond to the last frame size). | 574 // a frame (which might correspond to the last frame size). |
577 encoder_wakeup_event_.Set(); | 575 encoder_wakeup_event_.Set(); |
578 continue; | 576 continue; |
579 } | 577 } |
580 | 578 |
581 VideoFrame frame; | 579 VideoFrame frame; |
582 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 } |
583 vie_encoder_.EncodeVideoFrame(frame); | 586 vie_encoder_.EncodeVideoFrame(frame); |
| 587 } |
584 } | 588 } |
585 vie_encoder_.DeRegisterExternalEncoder(config_.encoder_settings.payload_type); | 589 vie_encoder_.DeRegisterExternalEncoder(config_.encoder_settings.payload_type); |
586 } | 590 } |
587 | 591 |
588 void VideoSendStream::ReconfigureVideoEncoder( | 592 void VideoSendStream::ReconfigureVideoEncoder( |
589 const VideoEncoderConfig& config) { | 593 const VideoEncoderConfig& config) { |
590 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); | 594 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); |
591 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); | 595 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); |
592 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), config.streams.size()); | 596 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), config.streams.size()); |
593 VideoCodec video_codec = VideoEncoderConfigToVideoCodec( | 597 VideoCodec video_codec = VideoEncoderConfigToVideoCodec( |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 &module_nack_rate); | 761 &module_nack_rate); |
758 *sent_video_rate_bps += module_video_rate; | 762 *sent_video_rate_bps += module_video_rate; |
759 *sent_nack_rate_bps += module_nack_rate; | 763 *sent_nack_rate_bps += module_nack_rate; |
760 *sent_fec_rate_bps += module_fec_rate; | 764 *sent_fec_rate_bps += module_fec_rate; |
761 } | 765 } |
762 return 0; | 766 return 0; |
763 } | 767 } |
764 | 768 |
765 } // namespace internal | 769 } // namespace internal |
766 } // namespace webrtc | 770 } // namespace webrtc |
OLD | NEW |