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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 void VideoSendStreamImpl::Start() { | 913 void VideoSendStreamImpl::Start() { |
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 | 925 |
925 // Start monitoring encoder activity. | 926 // Start monitoring encoder activity. |
926 { | 927 { |
927 rtc::CritScope lock(&encoder_activity_crit_sect_); | 928 rtc::CritScope lock(&encoder_activity_crit_sect_); |
928 RTC_DCHECK(!check_encoder_activity_task_); | 929 RTC_DCHECK(!check_encoder_activity_task_); |
929 check_encoder_activity_task_ = new CheckEncoderActivityTask(weak_ptr_); | 930 check_encoder_activity_task_ = new CheckEncoderActivityTask(weak_ptr_); |
930 worker_queue_->PostDelayedTask( | 931 worker_queue_->PostDelayedTask( |
931 std::unique_ptr<rtc::QueuedTask>(check_encoder_activity_task_), | 932 std::unique_ptr<rtc::QueuedTask>(check_encoder_activity_task_), |
932 CheckEncoderActivityTask::kEncoderTimeOutMs); | 933 CheckEncoderActivityTask::kEncoderTimeOutMs); |
933 } | 934 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 void VideoSendStreamImpl::OnBitrateAllocationUpdated( | 967 void VideoSendStreamImpl::OnBitrateAllocationUpdated( |
967 const BitrateAllocation& allocation) { | 968 const BitrateAllocation& allocation) { |
968 payload_router_.OnBitrateAllocationUpdated(allocation); | 969 payload_router_.OnBitrateAllocationUpdated(allocation); |
969 } | 970 } |
970 | 971 |
971 void VideoSendStreamImpl::SignalEncoderActive() { | 972 void VideoSendStreamImpl::SignalEncoderActive() { |
972 RTC_DCHECK_RUN_ON(worker_queue_); | 973 RTC_DCHECK_RUN_ON(worker_queue_); |
973 LOG(LS_INFO) << "SignalEncoderActive, Encoder is active."; | 974 LOG(LS_INFO) << "SignalEncoderActive, Encoder is active."; |
974 bitrate_allocator_->AddObserver( | 975 bitrate_allocator_->AddObserver( |
975 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, | 976 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, |
976 max_padding_bitrate_, !config_->suspend_below_min_bitrate); | 977 max_padding_bitrate_, !config_->suspend_below_min_bitrate, |
| 978 config_->track_id); |
977 } | 979 } |
978 | 980 |
979 void VideoSendStreamImpl::OnEncoderConfigurationChanged( | 981 void VideoSendStreamImpl::OnEncoderConfigurationChanged( |
980 std::vector<VideoStream> streams, | 982 std::vector<VideoStream> streams, |
981 int min_transmit_bitrate_bps) { | 983 int min_transmit_bitrate_bps) { |
982 if (!worker_queue_->IsCurrent()) { | 984 if (!worker_queue_->IsCurrent()) { |
983 worker_queue_->PostTask( | 985 worker_queue_->PostTask( |
984 std::unique_ptr<rtc::QueuedTask>(new EncoderReconfiguredTask( | 986 std::unique_ptr<rtc::QueuedTask>(new EncoderReconfiguredTask( |
985 weak_ptr_, std::move(streams), min_transmit_bitrate_bps))); | 987 weak_ptr_, std::move(streams), min_transmit_bitrate_bps))); |
986 return; | 988 return; |
(...skipping 21 matching lines...) Expand all Loading... |
1008 streams.back().temporal_layer_thresholds_bps.size() + 1; | 1010 streams.back().temporal_layer_thresholds_bps.size() + 1; |
1009 protection_bitrate_calculator_.SetEncodingData( | 1011 protection_bitrate_calculator_.SetEncodingData( |
1010 streams[0].width, streams[0].height, number_of_temporal_layers, | 1012 streams[0].width, streams[0].height, number_of_temporal_layers, |
1011 config_->rtp.max_packet_size); | 1013 config_->rtp.max_packet_size); |
1012 | 1014 |
1013 if (payload_router_.IsActive()) { | 1015 if (payload_router_.IsActive()) { |
1014 // 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 |
1015 // limits. | 1017 // limits. |
1016 bitrate_allocator_->AddObserver( | 1018 bitrate_allocator_->AddObserver( |
1017 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, | 1019 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, |
1018 max_padding_bitrate_, !config_->suspend_below_min_bitrate); | 1020 max_padding_bitrate_, !config_->suspend_below_min_bitrate, |
| 1021 config_->track_id); |
1019 } | 1022 } |
1020 } | 1023 } |
1021 | 1024 |
1022 EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage( | 1025 EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage( |
1023 const EncodedImage& encoded_image, | 1026 const EncodedImage& encoded_image, |
1024 const CodecSpecificInfo* codec_specific_info, | 1027 const CodecSpecificInfo* codec_specific_info, |
1025 const RTPFragmentationHeader* fragmentation) { | 1028 const RTPFragmentationHeader* fragmentation) { |
1026 // Encoded is called on whatever thread the real encoder implementation run | 1029 // Encoded is called on whatever thread the real encoder implementation run |
1027 // 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 |
1028 // 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 Loading... |
1341 std::min(config_->rtp.max_packet_size, | 1344 std::min(config_->rtp.max_packet_size, |
1342 kPathMTU - transport_overhead_bytes_per_packet_); | 1345 kPathMTU - transport_overhead_bytes_per_packet_); |
1343 | 1346 |
1344 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 1347 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
1345 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); | 1348 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); |
1346 } | 1349 } |
1347 } | 1350 } |
1348 | 1351 |
1349 } // namespace internal | 1352 } // namespace internal |
1350 } // namespace webrtc | 1353 } // namespace webrtc |
OLD | NEW |