OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 DCHECK(channel_map_.empty()); | 183 DCHECK(channel_map_.empty()); |
184 DCHECK(!remb_->InUse()); | 184 DCHECK(!remb_->InUse()); |
185 DCHECK(vie_encoder_map_.empty()); | 185 DCHECK(vie_encoder_map_.empty()); |
186 } | 186 } |
187 | 187 |
188 bool ChannelGroup::CreateSendChannel(int channel_id, | 188 bool ChannelGroup::CreateSendChannel(int channel_id, |
189 int engine_id, | 189 int engine_id, |
190 Transport* transport, | 190 Transport* transport, |
191 int number_of_cores, | 191 int number_of_cores, |
192 const std::vector<uint32_t>& ssrcs) { | 192 const std::vector<uint32_t>& ssrcs) { |
193 // TODO(pbos): Remove checks for empty ssrcs and add this check when there's | 193 DCHECK(!ssrcs.empty()); |
194 // no base channel. | |
195 // DCHECK(!ssrcs.empty()); | |
196 rtc::scoped_ptr<ViEEncoder> vie_encoder(new ViEEncoder( | 194 rtc::scoped_ptr<ViEEncoder> vie_encoder(new ViEEncoder( |
197 channel_id, number_of_cores, *process_thread_, pacer_.get(), | 195 channel_id, number_of_cores, *process_thread_, pacer_.get(), |
198 bitrate_allocator_.get(), bitrate_controller_.get(), false)); | 196 bitrate_allocator_.get(), bitrate_controller_.get())); |
199 if (!vie_encoder->Init()) { | 197 if (!vie_encoder->Init()) { |
200 return false; | 198 return false; |
201 } | 199 } |
202 ViEEncoder* encoder = vie_encoder.get(); | 200 ViEEncoder* encoder = vie_encoder.get(); |
203 if (!CreateChannel(channel_id, engine_id, transport, number_of_cores, | 201 if (!CreateChannel(channel_id, engine_id, transport, number_of_cores, |
204 vie_encoder.release(), ssrcs.empty() ? 1 : ssrcs.size(), | 202 vie_encoder.release(), ssrcs.size(), true)) { |
205 true)) { | |
206 return false; | 203 return false; |
207 } | 204 } |
208 ViEChannel* channel = channel_map_[channel_id]; | 205 ViEChannel* channel = channel_map_[channel_id]; |
209 // Connect the encoder with the send packet router, to enable sending. | 206 // Connect the encoder with the send packet router, to enable sending. |
210 encoder->StartThreadsAndSetSharedMembers(channel->send_payload_router(), | 207 encoder->StartThreadsAndSetSharedMembers(channel->send_payload_router(), |
211 channel->vcm_protection_callback()); | 208 channel->vcm_protection_callback()); |
212 | 209 |
213 if (!ssrcs.empty()) { | 210 encoder_state_feedback_->AddEncoder(ssrcs, encoder); |
214 encoder_state_feedback_->AddEncoder(ssrcs, encoder); | 211 std::vector<uint32_t> first_ssrc(1, ssrcs[0]); |
215 std::vector<uint32_t> first_ssrc(1, ssrcs[0]); | 212 encoder->SetSsrcs(first_ssrc); |
216 encoder->SetSsrcs(first_ssrc); | |
217 } | |
218 return true; | 213 return true; |
219 } | 214 } |
220 | 215 |
221 bool ChannelGroup::CreateReceiveChannel(int channel_id, | 216 bool ChannelGroup::CreateReceiveChannel(int channel_id, |
222 int engine_id, | 217 int engine_id, |
223 Transport* transport, | 218 Transport* transport, |
224 int number_of_cores) { | 219 int number_of_cores) { |
225 return CreateChannel(channel_id, engine_id, transport, number_of_cores, | 220 return CreateChannel(channel_id, engine_id, transport, number_of_cores, |
226 nullptr, 1, false); | 221 nullptr, 1, false); |
227 } | 222 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 rtc::CritScope lock(&encoder_map_crit_); | 363 rtc::CritScope lock(&encoder_map_crit_); |
369 for (const auto& encoder : vie_encoder_map_) | 364 for (const auto& encoder : vie_encoder_map_) |
370 pad_up_to_bitrate_bps += encoder.second->GetPaddingNeededBps(); | 365 pad_up_to_bitrate_bps += encoder.second->GetPaddingNeededBps(); |
371 } | 366 } |
372 pacer_->UpdateBitrate( | 367 pacer_->UpdateBitrate( |
373 target_bitrate_bps / 1000, | 368 target_bitrate_bps / 1000, |
374 PacedSender::kDefaultPaceMultiplier * target_bitrate_bps / 1000, | 369 PacedSender::kDefaultPaceMultiplier * target_bitrate_bps / 1000, |
375 pad_up_to_bitrate_bps / 1000); | 370 pad_up_to_bitrate_bps / 1000); |
376 } | 371 } |
377 } // namespace webrtc | 372 } // namespace webrtc |
OLD | NEW |