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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 stop_encoder_thread_(0), | 372 stop_encoder_thread_(0), |
373 overuse_detector_( | 373 overuse_detector_( |
374 Clock::GetRealTimeClock(), | 374 Clock::GetRealTimeClock(), |
375 GetCpuOveruseOptions(config.encoder_settings.full_overuse_time), | 375 GetCpuOveruseOptions(config.encoder_settings.full_overuse_time), |
376 this, | 376 this, |
377 config.post_encode_callback, | 377 config.post_encode_callback, |
378 &stats_proxy_), | 378 &stats_proxy_), |
379 vie_encoder_(num_cpu_cores, | 379 vie_encoder_(num_cpu_cores, |
380 module_process_thread_, | 380 module_process_thread_, |
381 &stats_proxy_, | 381 &stats_proxy_, |
382 config.pre_encode_callback, | 382 &overuse_detector_), |
383 &overuse_detector_, | |
384 congestion_controller_->pacer()), | |
385 encoder_feedback_(Clock::GetRealTimeClock(), | 383 encoder_feedback_(Clock::GetRealTimeClock(), |
386 config.rtp.ssrcs, | 384 config.rtp.ssrcs, |
387 &vie_encoder_), | 385 &vie_encoder_), |
388 video_sender_(vie_encoder_.video_sender()), | 386 video_sender_(vie_encoder_.video_sender()), |
389 bandwidth_observer_(congestion_controller_->GetBitrateController() | 387 bandwidth_observer_(congestion_controller_->GetBitrateController() |
390 ->CreateRtcpBandwidthObserver()), | 388 ->CreateRtcpBandwidthObserver()), |
391 rtp_rtcp_modules_(CreateRtpRtcpModules( | 389 rtp_rtcp_modules_(CreateRtpRtcpModules( |
392 config.send_transport, | 390 config.send_transport, |
393 &encoder_feedback_, | 391 &encoder_feedback_, |
394 bandwidth_observer_.get(), | 392 bandwidth_observer_.get(), |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 bitrate_allocator_->EnforceMinBitrate(false); | 581 bitrate_allocator_->EnforceMinBitrate(false); |
584 } | 582 } |
585 // We might've gotten new settings while configuring the encoder settings, | 583 // We might've gotten new settings while configuring the encoder settings, |
586 // restart from the top to see if that's the case before trying to encode | 584 // restart from the top to see if that's the case before trying to encode |
587 // a frame (which might correspond to the last frame size). | 585 // a frame (which might correspond to the last frame size). |
588 encoder_wakeup_event_.Set(); | 586 encoder_wakeup_event_.Set(); |
589 continue; | 587 continue; |
590 } | 588 } |
591 | 589 |
592 VideoFrame frame; | 590 VideoFrame frame; |
593 if (input_.GetVideoFrame(&frame)) | 591 if (input_.GetVideoFrame(&frame)) { |
| 592 // TODO(perkj): |pre_encode_callback| is only used by tests. Tests should |
| 593 // register as a sink to the VideoSource instead. |
| 594 if (config_.pre_encode_callback) { |
| 595 config_.pre_encode_callback->OnFrame(frame); |
| 596 } |
594 vie_encoder_.EncodeVideoFrame(frame); | 597 vie_encoder_.EncodeVideoFrame(frame); |
| 598 } |
595 } | 599 } |
596 vie_encoder_.DeRegisterExternalEncoder(config_.encoder_settings.payload_type); | 600 vie_encoder_.DeRegisterExternalEncoder(config_.encoder_settings.payload_type); |
597 } | 601 } |
598 | 602 |
599 void VideoSendStream::ReconfigureVideoEncoder( | 603 void VideoSendStream::ReconfigureVideoEncoder( |
600 const VideoEncoderConfig& config) { | 604 const VideoEncoderConfig& config) { |
601 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); | 605 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); |
602 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); | 606 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); |
603 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), config.streams.size()); | 607 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), config.streams.size()); |
604 VideoCodec video_codec = VideoEncoderConfigToVideoCodec( | 608 VideoCodec video_codec = VideoEncoderConfigToVideoCodec( |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 &module_nack_rate); | 808 &module_nack_rate); |
805 *sent_video_rate_bps += module_video_rate; | 809 *sent_video_rate_bps += module_video_rate; |
806 *sent_nack_rate_bps += module_nack_rate; | 810 *sent_nack_rate_bps += module_nack_rate; |
807 *sent_fec_rate_bps += module_fec_rate; | 811 *sent_fec_rate_bps += module_fec_rate; |
808 } | 812 } |
809 return 0; | 813 return 0; |
810 } | 814 } |
811 | 815 |
812 } // namespace internal | 816 } // namespace internal |
813 } // namespace webrtc | 817 } // namespace webrtc |
OLD | NEW |