| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 ->CreateRtcpBandwidthObserver(), | 181 ->CreateRtcpBandwidthObserver(), |
| 182 congestion_controller_->GetTransportFeedbackObserver(), | 182 congestion_controller_->GetTransportFeedbackObserver(), |
| 183 nullptr, | 183 nullptr, |
| 184 call_stats_->rtcp_rtt_stats(), | 184 call_stats_->rtcp_rtt_stats(), |
| 185 congestion_controller_->pacer(), | 185 congestion_controller_->pacer(), |
| 186 congestion_controller_->packet_router(), | 186 congestion_controller_->packet_router(), |
| 187 config_.rtp.ssrcs.size(), | 187 config_.rtp.ssrcs.size(), |
| 188 true), | 188 true), |
| 189 vie_receiver_(vie_channel_.vie_receiver()), | 189 vie_receiver_(vie_channel_.vie_receiver()), |
| 190 vie_encoder_(num_cpu_cores, | 190 vie_encoder_(num_cpu_cores, |
| 191 config_.rtp.ssrcs, |
| 191 module_process_thread_, | 192 module_process_thread_, |
| 192 &stats_proxy_, | 193 &stats_proxy_, |
| 193 config.pre_encode_callback, | 194 config.pre_encode_callback, |
| 194 &overuse_detector_, | 195 &overuse_detector_, |
| 195 congestion_controller_->pacer(), | 196 congestion_controller_->pacer(), |
| 196 &payload_router_, | 197 &payload_router_, |
| 197 bitrate_allocator), | 198 bitrate_allocator), |
| 198 vcm_(vie_encoder_.vcm()), | 199 vcm_(vie_encoder_.vcm()), |
| 199 input_(&vie_encoder_, | 200 input_(&vie_encoder_, |
| 200 config_.local_renderer, | 201 config_.local_renderer, |
| 201 &stats_proxy_, | 202 &stats_proxy_, |
| 202 &overuse_detector_) { | 203 &overuse_detector_) { |
| 203 LOG(LS_INFO) << "VideoSendStream: " << config_.ToString(); | 204 LOG(LS_INFO) << "VideoSendStream: " << config_.ToString(); |
| 204 | 205 |
| 205 RTC_DCHECK(!config_.rtp.ssrcs.empty()); | 206 RTC_DCHECK(!config_.rtp.ssrcs.empty()); |
| 206 RTC_DCHECK(module_process_thread_); | 207 RTC_DCHECK(module_process_thread_); |
| 207 RTC_DCHECK(call_stats_); | 208 RTC_DCHECK(call_stats_); |
| 208 RTC_DCHECK(congestion_controller_); | 209 RTC_DCHECK(congestion_controller_); |
| 209 RTC_DCHECK(remb_); | 210 RTC_DCHECK(remb_); |
| 210 | 211 |
| 211 RTC_CHECK(vie_encoder_.Init()); | 212 RTC_CHECK(vie_encoder_.Init()); |
| 212 encoder_feedback_.Init(config_.rtp.ssrcs, &vie_encoder_); | 213 encoder_feedback_.Init(config_.rtp.ssrcs, &vie_encoder_); |
| 213 RTC_CHECK(vie_channel_.Init() == 0); | 214 RTC_CHECK(vie_channel_.Init() == 0); |
| 214 | 215 |
| 215 vcm_->RegisterProtectionCallback(vie_channel_.vcm_protection_callback()); | 216 vcm_->RegisterProtectionCallback(vie_channel_.vcm_protection_callback()); |
| 216 | 217 |
| 217 call_stats_->RegisterStatsObserver(vie_channel_.GetStatsObserver()); | 218 call_stats_->RegisterStatsObserver(vie_channel_.GetStatsObserver()); |
| 218 | 219 |
| 219 vie_encoder_.SetSsrcs(std::vector<uint32_t>(1, config_.rtp.ssrcs[0])); | |
| 220 | |
| 221 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { | 220 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { |
| 222 const std::string& extension = config_.rtp.extensions[i].name; | 221 const std::string& extension = config_.rtp.extensions[i].name; |
| 223 int id = config_.rtp.extensions[i].id; | 222 int id = config_.rtp.extensions[i].id; |
| 224 // One-byte-extension local identifiers are in the range 1-14 inclusive. | 223 // One-byte-extension local identifiers are in the range 1-14 inclusive. |
| 225 RTC_DCHECK_GE(id, 1); | 224 RTC_DCHECK_GE(id, 1); |
| 226 RTC_DCHECK_LE(id, 14); | 225 RTC_DCHECK_LE(id, 14); |
| 227 if (extension == RtpExtension::kTOffset) { | 226 if (extension == RtpExtension::kTOffset) { |
| 228 RTC_CHECK_EQ(0, vie_channel_.SetSendTimestampOffsetStatus(true, id)); | 227 RTC_CHECK_EQ(0, vie_channel_.SetSendTimestampOffsetStatus(true, id)); |
| 229 } else if (extension == RtpExtension::kAbsSendTime) { | 228 } else if (extension == RtpExtension::kAbsSendTime) { |
| 230 RTC_CHECK_EQ(0, vie_channel_.SetSendAbsoluteSendTimeStatus(true, id)); | 229 RTC_CHECK_EQ(0, vie_channel_.SetSendAbsoluteSendTimeStatus(true, id)); |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 if (vie_encoder_.SetEncoder(video_codec) != 0) { | 594 if (vie_encoder_.SetEncoder(video_codec) != 0) { |
| 596 LOG(LS_ERROR) << "Failed to set encoder."; | 595 LOG(LS_ERROR) << "Failed to set encoder."; |
| 597 return false; | 596 return false; |
| 598 } | 597 } |
| 599 | 598 |
| 600 if (vie_channel_.SetSendCodec(video_codec, false) != 0) { | 599 if (vie_channel_.SetSendCodec(video_codec, false) != 0) { |
| 601 LOG(LS_ERROR) << "Failed to set send codec."; | 600 LOG(LS_ERROR) << "Failed to set send codec."; |
| 602 return false; | 601 return false; |
| 603 } | 602 } |
| 604 | 603 |
| 605 // Not all configured SSRCs have to be utilized (simulcast senders don't have | |
| 606 // to send on all SSRCs at once etc.) | |
| 607 std::vector<uint32_t> used_ssrcs = config_.rtp.ssrcs; | |
| 608 used_ssrcs.resize(static_cast<size_t>(video_codec.numberOfSimulcastStreams)); | |
| 609 vie_encoder_.SetSsrcs(used_ssrcs); | |
| 610 | |
| 611 // Restart the media flow | 604 // Restart the media flow |
| 612 vie_encoder_.Restart(); | 605 vie_encoder_.Restart(); |
| 613 | 606 |
| 614 return true; | 607 return true; |
| 615 } | 608 } |
| 616 } // namespace internal | 609 } // namespace internal |
| 617 } // namespace webrtc | 610 } // namespace webrtc |
| OLD | NEW |