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 #include "webrtc/video/video_send_stream.h" | 10 #include "webrtc/video/video_send_stream.h" |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 RTC_DCHECK_RUN_ON(worker_queue_); | 951 RTC_DCHECK_RUN_ON(worker_queue_); |
952 LOG(LS_INFO) << "VideoSendStream::Start"; | 952 LOG(LS_INFO) << "VideoSendStream::Start"; |
953 if (payload_router_.IsActive()) | 953 if (payload_router_.IsActive()) |
954 return; | 954 return; |
955 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); | 955 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); |
956 payload_router_.SetActive(true); | 956 payload_router_.SetActive(true); |
957 | 957 |
958 bitrate_allocator_->AddObserver( | 958 bitrate_allocator_->AddObserver( |
959 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, | 959 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, |
960 max_padding_bitrate_, !config_->suspend_below_min_bitrate, | 960 max_padding_bitrate_, !config_->suspend_below_min_bitrate, |
961 config_->track_id); | 961 config_->track_id); |
962 | 962 |
963 // Start monitoring encoder activity. | 963 // Start monitoring encoder activity. |
964 { | 964 { |
965 rtc::CritScope lock(&encoder_activity_crit_sect_); | 965 rtc::CritScope lock(&encoder_activity_crit_sect_); |
966 RTC_DCHECK(!check_encoder_activity_task_); | 966 RTC_DCHECK(!check_encoder_activity_task_); |
967 check_encoder_activity_task_ = new CheckEncoderActivityTask(weak_ptr_); | 967 check_encoder_activity_task_ = new CheckEncoderActivityTask(weak_ptr_); |
968 worker_queue_->PostDelayedTask( | 968 worker_queue_->PostDelayedTask( |
969 std::unique_ptr<rtc::QueuedTask>(check_encoder_activity_task_), | 969 std::unique_ptr<rtc::QueuedTask>(check_encoder_activity_task_), |
970 CheckEncoderActivityTask::kEncoderTimeOutMs); | 970 CheckEncoderActivityTask::kEncoderTimeOutMs); |
971 } | 971 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 const BitrateAllocation& allocation) { | 1005 const BitrateAllocation& allocation) { |
1006 payload_router_.OnBitrateAllocationUpdated(allocation); | 1006 payload_router_.OnBitrateAllocationUpdated(allocation); |
1007 } | 1007 } |
1008 | 1008 |
1009 void VideoSendStreamImpl::SignalEncoderActive() { | 1009 void VideoSendStreamImpl::SignalEncoderActive() { |
1010 RTC_DCHECK_RUN_ON(worker_queue_); | 1010 RTC_DCHECK_RUN_ON(worker_queue_); |
1011 LOG(LS_INFO) << "SignalEncoderActive, Encoder is active."; | 1011 LOG(LS_INFO) << "SignalEncoderActive, Encoder is active."; |
1012 bitrate_allocator_->AddObserver( | 1012 bitrate_allocator_->AddObserver( |
1013 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, | 1013 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, |
1014 max_padding_bitrate_, !config_->suspend_below_min_bitrate, | 1014 max_padding_bitrate_, !config_->suspend_below_min_bitrate, |
1015 config_->track_id); | 1015 config_->track_id); |
1016 } | 1016 } |
1017 | 1017 |
1018 void VideoSendStreamImpl::OnEncoderConfigurationChanged( | 1018 void VideoSendStreamImpl::OnEncoderConfigurationChanged( |
1019 std::vector<VideoStream> streams, | 1019 std::vector<VideoStream> streams, |
1020 int min_transmit_bitrate_bps) { | 1020 int min_transmit_bitrate_bps) { |
1021 if (!worker_queue_->IsCurrent()) { | 1021 if (!worker_queue_->IsCurrent()) { |
1022 worker_queue_->PostTask( | 1022 worker_queue_->PostTask( |
1023 std::unique_ptr<rtc::QueuedTask>(new EncoderReconfiguredTask( | 1023 std::unique_ptr<rtc::QueuedTask>(new EncoderReconfiguredTask( |
1024 weak_ptr_, std::move(streams), min_transmit_bitrate_bps))); | 1024 weak_ptr_, std::move(streams), min_transmit_bitrate_bps))); |
1025 return; | 1025 return; |
(...skipping 22 matching lines...) Expand all Loading... |
1048 protection_bitrate_calculator_.SetEncodingData( | 1048 protection_bitrate_calculator_.SetEncodingData( |
1049 streams[0].width, streams[0].height, number_of_temporal_layers, | 1049 streams[0].width, streams[0].height, number_of_temporal_layers, |
1050 config_->rtp.max_packet_size); | 1050 config_->rtp.max_packet_size); |
1051 | 1051 |
1052 if (payload_router_.IsActive()) { | 1052 if (payload_router_.IsActive()) { |
1053 // The send stream is started already. Update the allocator with new bitrate | 1053 // The send stream is started already. Update the allocator with new bitrate |
1054 // limits. | 1054 // limits. |
1055 bitrate_allocator_->AddObserver( | 1055 bitrate_allocator_->AddObserver( |
1056 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, | 1056 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, |
1057 max_padding_bitrate_, !config_->suspend_below_min_bitrate, | 1057 max_padding_bitrate_, !config_->suspend_below_min_bitrate, |
1058 config_->track_id); | 1058 config_->track_id); |
1059 } | 1059 } |
1060 } | 1060 } |
1061 | 1061 |
1062 EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage( | 1062 EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage( |
1063 const EncodedImage& encoded_image, | 1063 const EncodedImage& encoded_image, |
1064 const CodecSpecificInfo* codec_specific_info, | 1064 const CodecSpecificInfo* codec_specific_info, |
1065 const RTPFragmentationHeader* fragmentation) { | 1065 const RTPFragmentationHeader* fragmentation) { |
1066 // Encoded is called on whatever thread the real encoder implementation run | 1066 // Encoded is called on whatever thread the real encoder implementation run |
1067 // on. In the case of hardware encoders, there might be several encoders | 1067 // on. In the case of hardware encoders, there might be several encoders |
1068 // running in parallel on different threads. | 1068 // running in parallel on different threads. |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 std::min(config_->rtp.max_packet_size, | 1382 std::min(config_->rtp.max_packet_size, |
1383 kPathMTU - transport_overhead_bytes_per_packet_); | 1383 kPathMTU - transport_overhead_bytes_per_packet_); |
1384 | 1384 |
1385 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 1385 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
1386 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); | 1386 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); |
1387 } | 1387 } |
1388 } | 1388 } |
1389 | 1389 |
1390 } // namespace internal | 1390 } // namespace internal |
1391 } // namespace webrtc | 1391 } // namespace webrtc |
OLD | NEW |