| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 ss << ", render_delay_ms: " << render_delay_ms; | 94 ss << ", render_delay_ms: " << render_delay_ms; |
| 95 ss << ", target_delay_ms: " << target_delay_ms; | 95 ss << ", target_delay_ms: " << target_delay_ms; |
| 96 ss << ", suspend_below_min_bitrate: " << (suspend_below_min_bitrate ? "on" | 96 ss << ", suspend_below_min_bitrate: " << (suspend_below_min_bitrate ? "on" |
| 97 : "off"); | 97 : "off"); |
| 98 ss << '}'; | 98 ss << '}'; |
| 99 return ss.str(); | 99 return ss.str(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 namespace internal { | 102 namespace internal { |
| 103 VideoSendStream::VideoSendStream( | 103 VideoSendStream::VideoSendStream( |
| 104 CpuOveruseObserver* overuse_observer, | |
| 105 int num_cpu_cores, | 104 int num_cpu_cores, |
| 106 ProcessThread* module_process_thread, | 105 ProcessThread* module_process_thread, |
| 107 ChannelGroup* channel_group, | 106 ChannelGroup* channel_group, |
| 108 int channel_id, | 107 int channel_id, |
| 109 const VideoSendStream::Config& config, | 108 const VideoSendStream::Config& config, |
| 110 const VideoEncoderConfig& encoder_config, | 109 const VideoEncoderConfig& encoder_config, |
| 111 const std::map<uint32_t, RtpState>& suspended_ssrcs) | 110 const std::map<uint32_t, RtpState>& suspended_ssrcs) |
| 112 : transport_adapter_(config.send_transport), | 111 : transport_adapter_(config.send_transport), |
| 113 encoded_frame_proxy_(config.post_encode_callback), | 112 encoded_frame_proxy_(config.post_encode_callback), |
| 114 config_(config), | 113 config_(config), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 config_.rtp.fec.ulpfec_payload_type); | 154 config_.rtp.fec.ulpfec_payload_type); |
| 156 vie_encoder_->UpdateProtectionMethod(enable_protection_nack, | 155 vie_encoder_->UpdateProtectionMethod(enable_protection_nack, |
| 157 enable_protection_fec); | 156 enable_protection_fec); |
| 158 | 157 |
| 159 ConfigureSsrcs(); | 158 ConfigureSsrcs(); |
| 160 | 159 |
| 161 vie_channel_->SetRTCPCName(config_.rtp.c_name.c_str()); | 160 vie_channel_->SetRTCPCName(config_.rtp.c_name.c_str()); |
| 162 | 161 |
| 163 input_.reset(new internal::VideoCaptureInput( | 162 input_.reset(new internal::VideoCaptureInput( |
| 164 module_process_thread_, vie_encoder_, config_.local_renderer, | 163 module_process_thread_, vie_encoder_, config_.local_renderer, |
| 165 &stats_proxy_, overuse_observer)); | 164 &stats_proxy_, this)); |
| 166 | 165 |
| 167 // 28 to match packet overhead in ModuleRtpRtcpImpl. | 166 // 28 to match packet overhead in ModuleRtpRtcpImpl. |
| 168 DCHECK_LE(config_.rtp.max_packet_size, static_cast<size_t>(0xFFFF - 28)); | 167 DCHECK_LE(config_.rtp.max_packet_size, static_cast<size_t>(0xFFFF - 28)); |
| 169 vie_channel_->SetMTU(static_cast<uint16_t>(config_.rtp.max_packet_size + 28)); | 168 vie_channel_->SetMTU(static_cast<uint16_t>(config_.rtp.max_packet_size + 28)); |
| 170 | 169 |
| 171 DCHECK(config.encoder_settings.encoder != nullptr); | 170 DCHECK(config.encoder_settings.encoder != nullptr); |
| 172 DCHECK_GE(config.encoder_settings.payload_type, 0); | 171 DCHECK_GE(config.encoder_settings.payload_type, 0); |
| 173 DCHECK_LE(config.encoder_settings.payload_type, 127); | 172 DCHECK_LE(config.encoder_settings.payload_type, 127); |
| 174 CHECK_EQ(0, vie_encoder_->RegisterExternalEncoder( | 173 CHECK_EQ(0, vie_encoder_->RegisterExternalEncoder( |
| 175 config.encoder_settings.encoder, | 174 config.encoder_settings.encoder, |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 382 } |
| 384 | 383 |
| 385 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { | 384 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { |
| 386 return vie_channel_->ReceivedRTCPPacket(packet, length) == 0; | 385 return vie_channel_->ReceivedRTCPPacket(packet, length) == 0; |
| 387 } | 386 } |
| 388 | 387 |
| 389 VideoSendStream::Stats VideoSendStream::GetStats() { | 388 VideoSendStream::Stats VideoSendStream::GetStats() { |
| 390 return stats_proxy_.GetStats(); | 389 return stats_proxy_.GetStats(); |
| 391 } | 390 } |
| 392 | 391 |
| 392 void VideoSendStream::OveruseDetected() { |
| 393 if (config_.overuse_callback) |
| 394 config_.overuse_callback->OnLoadUpdate(LoadObserver::kOveruse); |
| 395 } |
| 396 |
| 397 void VideoSendStream::NormalUsage() { |
| 398 if (config_.overuse_callback) |
| 399 config_.overuse_callback->OnLoadUpdate(LoadObserver::kUnderuse); |
| 400 } |
| 401 |
| 393 void VideoSendStream::ConfigureSsrcs() { | 402 void VideoSendStream::ConfigureSsrcs() { |
| 394 vie_channel_->SetSSRC(config_.rtp.ssrcs.front(), kViEStreamTypeNormal, 0); | 403 vie_channel_->SetSSRC(config_.rtp.ssrcs.front(), kViEStreamTypeNormal, 0); |
| 395 for (size_t i = 0; i < config_.rtp.ssrcs.size(); ++i) { | 404 for (size_t i = 0; i < config_.rtp.ssrcs.size(); ++i) { |
| 396 uint32_t ssrc = config_.rtp.ssrcs[i]; | 405 uint32_t ssrc = config_.rtp.ssrcs[i]; |
| 397 vie_channel_->SetSSRC(ssrc, kViEStreamTypeNormal, | 406 vie_channel_->SetSSRC(ssrc, kViEStreamTypeNormal, |
| 398 static_cast<unsigned char>(i)); | 407 static_cast<unsigned char>(i)); |
| 399 RtpStateMap::iterator it = suspended_ssrcs_.find(ssrc); | 408 RtpStateMap::iterator it = suspended_ssrcs_.find(ssrc); |
| 400 if (it != suspended_ssrcs_.end()) | 409 if (it != suspended_ssrcs_.end()) |
| 401 vie_channel_->SetRtpStateForSsrc(ssrc, it->second); | 410 vie_channel_->SetRtpStateForSsrc(ssrc, it->second); |
| 402 } | 411 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 vie_channel_->IsSendingFecEnabled()); | 510 vie_channel_->IsSendingFecEnabled()); |
| 502 | 511 |
| 503 // Restart the media flow | 512 // Restart the media flow |
| 504 vie_encoder_->Restart(); | 513 vie_encoder_->Restart(); |
| 505 | 514 |
| 506 return true; | 515 return true; |
| 507 } | 516 } |
| 508 | 517 |
| 509 } // namespace internal | 518 } // namespace internal |
| 510 } // namespace webrtc | 519 } // namespace webrtc |
| OLD | NEW |