| 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 |
| 11 #include "webrtc/video/video_send_stream.h" | 11 #include "webrtc/video/video_send_stream.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include <sstream> | 14 #include <sstream> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 20 #include "webrtc/system_wrappers/interface/logging.h" | 20 #include "webrtc/system_wrappers/interface/logging.h" |
| 21 #include "webrtc/system_wrappers/interface/trace_event.h" | 21 #include "webrtc/system_wrappers/interface/trace_event.h" |
| 22 #include "webrtc/video/video_capture_input.h" | 22 #include "webrtc/video/video_capture_input.h" |
| 23 #include "webrtc/video_engine/encoder_state_feedback.h" | |
| 24 #include "webrtc/video_engine/vie_channel.h" | 23 #include "webrtc/video_engine/vie_channel.h" |
| 25 #include "webrtc/video_engine/vie_channel_group.h" | 24 #include "webrtc/video_engine/vie_channel_group.h" |
| 26 #include "webrtc/video_engine/vie_defines.h" | 25 #include "webrtc/video_engine/vie_defines.h" |
| 27 #include "webrtc/video_engine/vie_encoder.h" | 26 #include "webrtc/video_engine/vie_encoder.h" |
| 28 #include "webrtc/video_send_stream.h" | 27 #include "webrtc/video_send_stream.h" |
| 29 | 28 |
| 30 namespace webrtc { | 29 namespace webrtc { |
| 31 std::string | 30 std::string |
| 32 VideoSendStream::Config::EncoderSettings::ToString() const { | 31 VideoSendStream::Config::EncoderSettings::ToString() const { |
| 33 std::stringstream ss; | 32 std::stringstream ss; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 encoded_frame_proxy_(config.post_encode_callback), | 113 encoded_frame_proxy_(config.post_encode_callback), |
| 115 config_(config), | 114 config_(config), |
| 116 suspended_ssrcs_(suspended_ssrcs), | 115 suspended_ssrcs_(suspended_ssrcs), |
| 117 module_process_thread_(module_process_thread), | 116 module_process_thread_(module_process_thread), |
| 118 channel_group_(channel_group), | 117 channel_group_(channel_group), |
| 119 channel_id_(channel_id), | 118 channel_id_(channel_id), |
| 120 use_config_bitrate_(true), | 119 use_config_bitrate_(true), |
| 121 stats_proxy_(Clock::GetRealTimeClock(), config) { | 120 stats_proxy_(Clock::GetRealTimeClock(), config) { |
| 122 DCHECK(!config_.rtp.ssrcs.empty()); | 121 DCHECK(!config_.rtp.ssrcs.empty()); |
| 123 CHECK(channel_group->CreateSendChannel(channel_id_, 0, &transport_adapter_, | 122 CHECK(channel_group->CreateSendChannel(channel_id_, 0, &transport_adapter_, |
| 124 num_cpu_cores, | 123 num_cpu_cores, config_.rtp.ssrcs, |
| 125 config_.rtp.ssrcs.size(), true)); | 124 true)); |
| 126 vie_channel_ = channel_group_->GetChannel(channel_id_); | 125 vie_channel_ = channel_group_->GetChannel(channel_id_); |
| 127 vie_encoder_ = channel_group_->GetEncoder(channel_id_); | 126 vie_encoder_ = channel_group_->GetEncoder(channel_id_); |
| 128 | 127 |
| 129 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { | 128 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { |
| 130 const std::string& extension = config_.rtp.extensions[i].name; | 129 const std::string& extension = config_.rtp.extensions[i].name; |
| 131 int id = config_.rtp.extensions[i].id; | 130 int id = config_.rtp.extensions[i].id; |
| 132 // One-byte-extension local identifiers are in the range 1-14 inclusive. | 131 // One-byte-extension local identifiers are in the range 1-14 inclusive. |
| 133 DCHECK_GE(id, 1); | 132 DCHECK_GE(id, 1); |
| 134 DCHECK_LE(id, 14); | 133 DCHECK_LE(id, 14); |
| 135 if (extension == RtpExtension::kTOffset) { | 134 if (extension == RtpExtension::kTOffset) { |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 return false; | 487 return false; |
| 489 } | 488 } |
| 490 | 489 |
| 491 // Not all configured SSRCs have to be utilized (simulcast senders don't have | 490 // Not all configured SSRCs have to be utilized (simulcast senders don't have |
| 492 // to send on all SSRCs at once etc.) | 491 // to send on all SSRCs at once etc.) |
| 493 std::vector<uint32_t> used_ssrcs = config_.rtp.ssrcs; | 492 std::vector<uint32_t> used_ssrcs = config_.rtp.ssrcs; |
| 494 used_ssrcs.resize(static_cast<size_t>(video_codec.numberOfSimulcastStreams)); | 493 used_ssrcs.resize(static_cast<size_t>(video_codec.numberOfSimulcastStreams)); |
| 495 | 494 |
| 496 // Update used SSRCs. | 495 // Update used SSRCs. |
| 497 vie_encoder_->SetSsrcs(used_ssrcs); | 496 vie_encoder_->SetSsrcs(used_ssrcs); |
| 498 EncoderStateFeedback* encoder_state_feedback = | |
| 499 channel_group_->GetEncoderStateFeedback(); | |
| 500 encoder_state_feedback->UpdateSsrcs(used_ssrcs, vie_encoder_); | |
| 501 | 497 |
| 502 // Update the protection mode, we might be switching NACK/FEC. | 498 // Update the protection mode, we might be switching NACK/FEC. |
| 503 vie_encoder_->UpdateProtectionMethod(vie_encoder_->nack_enabled(), | 499 vie_encoder_->UpdateProtectionMethod(vie_encoder_->nack_enabled(), |
| 504 vie_channel_->IsSendingFecEnabled()); | 500 vie_channel_->IsSendingFecEnabled()); |
| 505 | 501 |
| 506 // Restart the media flow | 502 // Restart the media flow |
| 507 vie_encoder_->Restart(); | 503 vie_encoder_->Restart(); |
| 508 | 504 |
| 509 return true; | 505 return true; |
| 510 } | 506 } |
| 511 | 507 |
| 512 } // namespace internal | 508 } // namespace internal |
| 513 } // namespace webrtc | 509 } // namespace webrtc |
| OLD | NEW |