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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 bitrate_allocator_->EnforceMinBitrate(false); | 549 bitrate_allocator_->EnforceMinBitrate(false); |
552 } | 550 } |
553 // We might've gotten new settings while configuring the encoder settings, | 551 // We might've gotten new settings while configuring the encoder settings, |
554 // restart from the top to see if that's the case before trying to encode | 552 // restart from the top to see if that's the case before trying to encode |
555 // a frame (which might correspond to the last frame size). | 553 // a frame (which might correspond to the last frame size). |
556 encoder_wakeup_event_.Set(); | 554 encoder_wakeup_event_.Set(); |
557 continue; | 555 continue; |
558 } | 556 } |
559 | 557 |
560 VideoFrame frame; | 558 VideoFrame frame; |
561 if (input_.GetVideoFrame(&frame)) | 559 if (input_.GetVideoFrame(&frame)) { |
| 560 // TODO(perkj): |pre_encode_callback| is only used by tests. Tests should |
| 561 // register as a sink to the VideoSource instead. |
| 562 if (config_.pre_encode_callback) { |
| 563 config_.pre_encode_callback->OnFrame(frame); |
| 564 } |
562 vie_encoder_.EncodeVideoFrame(frame); | 565 vie_encoder_.EncodeVideoFrame(frame); |
| 566 } |
563 } | 567 } |
564 vie_encoder_.DeRegisterExternalEncoder(config_.encoder_settings.payload_type); | 568 vie_encoder_.DeRegisterExternalEncoder(config_.encoder_settings.payload_type); |
565 } | 569 } |
566 | 570 |
567 void VideoSendStream::ReconfigureVideoEncoder( | 571 void VideoSendStream::ReconfigureVideoEncoder( |
568 const VideoEncoderConfig& config) { | 572 const VideoEncoderConfig& config) { |
569 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); | 573 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); |
570 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); | 574 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); |
571 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), config.streams.size()); | 575 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), config.streams.size()); |
572 VideoCodec video_codec = VideoEncoderConfigToVideoCodec( | 576 VideoCodec video_codec = VideoEncoderConfigToVideoCodec( |
(...skipping 184 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 |