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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 process_thread->RegisterModule(bitrate_controller_.get()); | 173 process_thread->RegisterModule(bitrate_controller_.get()); |
174 } | 174 } |
175 | 175 |
176 ChannelGroup::~ChannelGroup() { | 176 ChannelGroup::~ChannelGroup() { |
177 pacer_thread_->Stop(); | 177 pacer_thread_->Stop(); |
178 pacer_thread_->DeRegisterModule(pacer_.get()); | 178 pacer_thread_->DeRegisterModule(pacer_.get()); |
179 process_thread_->DeRegisterModule(bitrate_controller_.get()); | 179 process_thread_->DeRegisterModule(bitrate_controller_.get()); |
180 process_thread_->DeRegisterModule(call_stats_.get()); | 180 process_thread_->DeRegisterModule(call_stats_.get()); |
181 process_thread_->DeRegisterModule(remote_bitrate_estimator_.get()); | 181 process_thread_->DeRegisterModule(remote_bitrate_estimator_.get()); |
182 call_stats_->DeregisterStatsObserver(remote_bitrate_estimator_.get()); | 182 call_stats_->DeregisterStatsObserver(remote_bitrate_estimator_.get()); |
183 DCHECK(channel_map_.empty()); | 183 RTC_DCHECK(channel_map_.empty()); |
184 DCHECK(!remb_->InUse()); | 184 RTC_DCHECK(!remb_->InUse()); |
185 DCHECK(vie_encoder_map_.empty()); | 185 RTC_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 DCHECK(!ssrcs.empty()); | 193 RTC_DCHECK(!ssrcs.empty()); |
194 rtc::scoped_ptr<ViEEncoder> vie_encoder( | 194 rtc::scoped_ptr<ViEEncoder> vie_encoder( |
195 new ViEEncoder(channel_id, number_of_cores, *process_thread_, | 195 new ViEEncoder(channel_id, number_of_cores, *process_thread_, |
196 pacer_.get(), bitrate_allocator_.get())); | 196 pacer_.get(), bitrate_allocator_.get())); |
197 if (!vie_encoder->Init()) { | 197 if (!vie_encoder->Init()) { |
198 return false; | 198 return false; |
199 } | 199 } |
200 ViEEncoder* encoder = vie_encoder.get(); | 200 ViEEncoder* encoder = vie_encoder.get(); |
201 if (!CreateChannel(channel_id, engine_id, transport, number_of_cores, | 201 if (!CreateChannel(channel_id, engine_id, transport, number_of_cores, |
202 vie_encoder.release(), ssrcs.size(), true)) { | 202 vie_encoder.release(), ssrcs.size(), true)) { |
203 return false; | 203 return false; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 ViEEncoder* ChannelGroup::GetEncoder(int channel_id) const { | 296 ViEEncoder* ChannelGroup::GetEncoder(int channel_id) const { |
297 rtc::CritScope lock(&encoder_map_crit_); | 297 rtc::CritScope lock(&encoder_map_crit_); |
298 EncoderMap::const_iterator it = vie_encoder_map_.find(channel_id); | 298 EncoderMap::const_iterator it = vie_encoder_map_.find(channel_id); |
299 if (it == vie_encoder_map_.end()) | 299 if (it == vie_encoder_map_.end()) |
300 return nullptr; | 300 return nullptr; |
301 return it->second; | 301 return it->second; |
302 } | 302 } |
303 | 303 |
304 ViEChannel* ChannelGroup::PopChannel(int channel_id) { | 304 ViEChannel* ChannelGroup::PopChannel(int channel_id) { |
305 ChannelMap::iterator c_it = channel_map_.find(channel_id); | 305 ChannelMap::iterator c_it = channel_map_.find(channel_id); |
306 DCHECK(c_it != channel_map_.end()); | 306 RTC_DCHECK(c_it != channel_map_.end()); |
307 ViEChannel* channel = c_it->second; | 307 ViEChannel* channel = c_it->second; |
308 channel_map_.erase(c_it); | 308 channel_map_.erase(c_it); |
309 | 309 |
310 return channel; | 310 return channel; |
311 } | 311 } |
312 | 312 |
313 void ChannelGroup::SetSyncInterface(VoEVideoSync* sync_interface) { | 313 void ChannelGroup::SetSyncInterface(VoEVideoSync* sync_interface) { |
314 for (auto channel : channel_map_) | 314 for (auto channel : channel_map_) |
315 channel.second->SetVoiceChannel(-1, sync_interface); | 315 channel.second->SetVoiceChannel(-1, sync_interface); |
316 } | 316 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 rtc::CritScope lock(&encoder_map_crit_); | 363 rtc::CritScope lock(&encoder_map_crit_); |
364 for (const auto& encoder : vie_encoder_map_) | 364 for (const auto& encoder : vie_encoder_map_) |
365 pad_up_to_bitrate_bps += encoder.second->GetPaddingNeededBps(); | 365 pad_up_to_bitrate_bps += encoder.second->GetPaddingNeededBps(); |
366 } | 366 } |
367 pacer_->UpdateBitrate( | 367 pacer_->UpdateBitrate( |
368 target_bitrate_bps / 1000, | 368 target_bitrate_bps / 1000, |
369 PacedSender::kDefaultPaceMultiplier * target_bitrate_bps / 1000, | 369 PacedSender::kDefaultPaceMultiplier * target_bitrate_bps / 1000, |
370 pad_up_to_bitrate_bps / 1000); | 370 pad_up_to_bitrate_bps / 1000); |
371 } | 371 } |
372 } // namespace webrtc | 372 } // namespace webrtc |
OLD | NEW |