Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: webrtc/video/video_send_stream.cc

Issue 2996643002: BWE allocation strategy
Patch Set: BWE allocation strategy Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "webrtc/video/video_send_stream.h" 10 #include "webrtc/video/video_send_stream.h"
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 RTC_DCHECK_RUN_ON(worker_queue_); 914 RTC_DCHECK_RUN_ON(worker_queue_);
915 LOG(LS_INFO) << "VideoSendStream::Start"; 915 LOG(LS_INFO) << "VideoSendStream::Start";
916 if (payload_router_.IsActive()) 916 if (payload_router_.IsActive())
917 return; 917 return;
918 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); 918 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start");
919 payload_router_.SetActive(true); 919 payload_router_.SetActive(true);
920 920
921 bitrate_allocator_->AddObserver( 921 bitrate_allocator_->AddObserver(
922 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, 922 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_,
923 max_padding_bitrate_, !config_->suspend_below_min_bitrate, 923 max_padding_bitrate_, !config_->suspend_below_min_bitrate,
924 config_->track_id); 924 config_->track_id);
925 925
926 // Start monitoring encoder activity. 926 // Start monitoring encoder activity.
927 { 927 {
928 rtc::CritScope lock(&encoder_activity_crit_sect_); 928 rtc::CritScope lock(&encoder_activity_crit_sect_);
929 RTC_DCHECK(!check_encoder_activity_task_); 929 RTC_DCHECK(!check_encoder_activity_task_);
930 check_encoder_activity_task_ = new CheckEncoderActivityTask(weak_ptr_); 930 check_encoder_activity_task_ = new CheckEncoderActivityTask(weak_ptr_);
931 worker_queue_->PostDelayedTask( 931 worker_queue_->PostDelayedTask(
932 std::unique_ptr<rtc::QueuedTask>(check_encoder_activity_task_), 932 std::unique_ptr<rtc::QueuedTask>(check_encoder_activity_task_),
933 CheckEncoderActivityTask::kEncoderTimeOutMs); 933 CheckEncoderActivityTask::kEncoderTimeOutMs);
934 } 934 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 const BitrateAllocation& allocation) { 968 const BitrateAllocation& allocation) {
969 payload_router_.OnBitrateAllocationUpdated(allocation); 969 payload_router_.OnBitrateAllocationUpdated(allocation);
970 } 970 }
971 971
972 void VideoSendStreamImpl::SignalEncoderActive() { 972 void VideoSendStreamImpl::SignalEncoderActive() {
973 RTC_DCHECK_RUN_ON(worker_queue_); 973 RTC_DCHECK_RUN_ON(worker_queue_);
974 LOG(LS_INFO) << "SignalEncoderActive, Encoder is active."; 974 LOG(LS_INFO) << "SignalEncoderActive, Encoder is active.";
975 bitrate_allocator_->AddObserver( 975 bitrate_allocator_->AddObserver(
976 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, 976 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_,
977 max_padding_bitrate_, !config_->suspend_below_min_bitrate, 977 max_padding_bitrate_, !config_->suspend_below_min_bitrate,
978 config_->track_id); 978 config_->track_id);
979 } 979 }
980 980
981 void VideoSendStreamImpl::OnEncoderConfigurationChanged( 981 void VideoSendStreamImpl::OnEncoderConfigurationChanged(
982 std::vector<VideoStream> streams, 982 std::vector<VideoStream> streams,
983 int min_transmit_bitrate_bps) { 983 int min_transmit_bitrate_bps) {
984 if (!worker_queue_->IsCurrent()) { 984 if (!worker_queue_->IsCurrent()) {
985 worker_queue_->PostTask( 985 worker_queue_->PostTask(
986 std::unique_ptr<rtc::QueuedTask>(new EncoderReconfiguredTask( 986 std::unique_ptr<rtc::QueuedTask>(new EncoderReconfiguredTask(
987 weak_ptr_, std::move(streams), min_transmit_bitrate_bps))); 987 weak_ptr_, std::move(streams), min_transmit_bitrate_bps)));
988 return; 988 return;
(...skipping 22 matching lines...) Expand all
1011 protection_bitrate_calculator_.SetEncodingData( 1011 protection_bitrate_calculator_.SetEncodingData(
1012 streams[0].width, streams[0].height, number_of_temporal_layers, 1012 streams[0].width, streams[0].height, number_of_temporal_layers,
1013 config_->rtp.max_packet_size); 1013 config_->rtp.max_packet_size);
1014 1014
1015 if (payload_router_.IsActive()) { 1015 if (payload_router_.IsActive()) {
1016 // The send stream is started already. Update the allocator with new bitrate 1016 // The send stream is started already. Update the allocator with new bitrate
1017 // limits. 1017 // limits.
1018 bitrate_allocator_->AddObserver( 1018 bitrate_allocator_->AddObserver(
1019 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, 1019 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_,
1020 max_padding_bitrate_, !config_->suspend_below_min_bitrate, 1020 max_padding_bitrate_, !config_->suspend_below_min_bitrate,
1021 config_->track_id); 1021 config_->track_id);
1022 } 1022 }
1023 } 1023 }
1024 1024
1025 EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage( 1025 EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage(
1026 const EncodedImage& encoded_image, 1026 const EncodedImage& encoded_image,
1027 const CodecSpecificInfo* codec_specific_info, 1027 const CodecSpecificInfo* codec_specific_info,
1028 const RTPFragmentationHeader* fragmentation) { 1028 const RTPFragmentationHeader* fragmentation) {
1029 // Encoded is called on whatever thread the real encoder implementation run 1029 // Encoded is called on whatever thread the real encoder implementation run
1030 // on. In the case of hardware encoders, there might be several encoders 1030 // on. In the case of hardware encoders, there might be several encoders
1031 // running in parallel on different threads. 1031 // running in parallel on different threads.
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 std::min(config_->rtp.max_packet_size, 1344 std::min(config_->rtp.max_packet_size,
1345 kPathMTU - transport_overhead_bytes_per_packet_); 1345 kPathMTU - transport_overhead_bytes_per_packet_);
1346 1346
1347 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 1347 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
1348 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); 1348 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size);
1349 } 1349 }
1350 } 1350 }
1351 1351
1352 } // namespace internal 1352 } // namespace internal
1353 } // namespace webrtc 1353 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698