Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: webrtc/video_engine/vie_channel_group.cc

Issue 1250513006: Remove webrtc::Config from ViEChannelGroup. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove experiment.h from build files Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video_engine/vie_channel_group.h ('k') | webrtc/video_engine/vie_encoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "webrtc/video_engine/vie_channel_group.h" 11 #include "webrtc/video_engine/vie_channel_group.h"
12 12
13 #include "webrtc/base/checks.h" 13 #include "webrtc/base/checks.h"
14 #include "webrtc/base/thread_annotations.h" 14 #include "webrtc/base/thread_annotations.h"
15 #include "webrtc/common.h" 15 #include "webrtc/common.h"
16 #include "webrtc/experiments.h"
17 #include "webrtc/modules/pacing/include/paced_sender.h" 16 #include "webrtc/modules/pacing/include/paced_sender.h"
18 #include "webrtc/modules/pacing/include/packet_router.h" 17 #include "webrtc/modules/pacing/include/packet_router.h"
19 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s end_time.h" 18 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s end_time.h"
20 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl e_stream.h" 19 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl e_stream.h"
21 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h" 20 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
22 #include "webrtc/modules/utility/interface/process_thread.h" 21 #include "webrtc/modules/utility/interface/process_thread.h"
23 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" 22 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
24 #include "webrtc/system_wrappers/interface/logging.h" 23 #include "webrtc/system_wrappers/interface/logging.h"
25 #include "webrtc/video_engine/call_stats.h" 24 #include "webrtc/video_engine/call_stats.h"
26 #include "webrtc/video_engine/encoder_state_feedback.h" 25 #include "webrtc/video_engine/encoder_state_feedback.h"
27 #include "webrtc/video_engine/payload_router.h" 26 #include "webrtc/video_engine/payload_router.h"
28 #include "webrtc/video_engine/vie_channel.h" 27 #include "webrtc/video_engine/vie_channel.h"
29 #include "webrtc/video_engine/vie_encoder.h" 28 #include "webrtc/video_engine/vie_encoder.h"
30 #include "webrtc/video_engine/vie_remb.h" 29 #include "webrtc/video_engine/vie_remb.h"
31 #include "webrtc/voice_engine/include/voe_video_sync.h" 30 #include "webrtc/voice_engine/include/voe_video_sync.h"
32 31
33 namespace webrtc { 32 namespace webrtc {
34 namespace { 33 namespace {
35 34
36 static const uint32_t kTimeOffsetSwitchThreshold = 30; 35 static const uint32_t kTimeOffsetSwitchThreshold = 30;
36 static const uint32_t kMinBitrateBps = 30000;
37 37
38 class WrappingBitrateEstimator : public RemoteBitrateEstimator { 38 class WrappingBitrateEstimator : public RemoteBitrateEstimator {
39 public: 39 public:
40 WrappingBitrateEstimator(RemoteBitrateObserver* observer, 40 WrappingBitrateEstimator(RemoteBitrateObserver* observer, Clock* clock)
41 Clock* clock,
42 const Config& config)
43 : observer_(observer), 41 : observer_(observer),
44 clock_(clock), 42 clock_(clock),
45 crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), 43 crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
46 min_bitrate_bps_(config.Get<RemoteBitrateEstimatorMinRate>().min_rate), 44 min_bitrate_bps_(kMinBitrateBps),
47 rbe_(new RemoteBitrateEstimatorSingleStream(observer_, 45 rbe_(new RemoteBitrateEstimatorSingleStream(observer_,
48 clock_, 46 clock_,
49 min_bitrate_bps_)), 47 min_bitrate_bps_)),
50 using_absolute_send_time_(false), 48 using_absolute_send_time_(false),
51 packets_since_absolute_send_time_(0) {} 49 packets_since_absolute_send_time_(0) {}
52 50
53 virtual ~WrappingBitrateEstimator() {} 51 virtual ~WrappingBitrateEstimator() {}
54 52
55 void IncomingPacket(int64_t arrival_time_ms, 53 void IncomingPacket(int64_t arrival_time_ms,
56 size_t payload_size, 54 size_t payload_size,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 bitrate_allocator_(new BitrateAllocator()), 144 bitrate_allocator_(new BitrateAllocator()),
147 call_stats_(new CallStats()), 145 call_stats_(new CallStats()),
148 encoder_state_feedback_(new EncoderStateFeedback()), 146 encoder_state_feedback_(new EncoderStateFeedback()),
149 packet_router_(new PacketRouter()), 147 packet_router_(new PacketRouter()),
150 pacer_(new PacedSender(Clock::GetRealTimeClock(), 148 pacer_(new PacedSender(Clock::GetRealTimeClock(),
151 packet_router_.get(), 149 packet_router_.get(),
152 BitrateController::kDefaultStartBitrateKbps, 150 BitrateController::kDefaultStartBitrateKbps,
153 PacedSender::kDefaultPaceMultiplier * 151 PacedSender::kDefaultPaceMultiplier *
154 BitrateController::kDefaultStartBitrateKbps, 152 BitrateController::kDefaultStartBitrateKbps,
155 0)), 153 0)),
156 config_(new Config),
157 process_thread_(process_thread), 154 process_thread_(process_thread),
158 pacer_thread_(ProcessThread::Create()), 155 pacer_thread_(ProcessThread::Create()),
159 // Constructed last as this object calls the provided callback on 156 // Constructed last as this object calls the provided callback on
160 // construction. 157 // construction.
161 bitrate_controller_( 158 bitrate_controller_(
162 BitrateController::CreateBitrateController(Clock::GetRealTimeClock(), 159 BitrateController::CreateBitrateController(Clock::GetRealTimeClock(),
163 this)) { 160 this)) {
164 remote_bitrate_estimator_.reset(new WrappingBitrateEstimator( 161 remote_bitrate_estimator_.reset(new WrappingBitrateEstimator(
165 remb_.get(), Clock::GetRealTimeClock(), *config_.get())); 162 remb_.get(), Clock::GetRealTimeClock()));
166 163
167 call_stats_->RegisterStatsObserver(remote_bitrate_estimator_.get()); 164 call_stats_->RegisterStatsObserver(remote_bitrate_estimator_.get());
168 165
169 pacer_thread_->RegisterModule(pacer_.get()); 166 pacer_thread_->RegisterModule(pacer_.get());
170 pacer_thread_->Start(); 167 pacer_thread_->Start();
171 168
172 process_thread->RegisterModule(remote_bitrate_estimator_.get()); 169 process_thread->RegisterModule(remote_bitrate_estimator_.get());
173 process_thread->RegisterModule(call_stats_.get()); 170 process_thread->RegisterModule(call_stats_.get());
174 process_thread->RegisterModule(bitrate_controller_.get()); 171 process_thread->RegisterModule(bitrate_controller_.get());
175 } 172 }
(...skipping 11 matching lines...) Expand all
187 } 184 }
188 185
189 bool ChannelGroup::CreateSendChannel(int channel_id, 186 bool ChannelGroup::CreateSendChannel(int channel_id,
190 int engine_id, 187 int engine_id,
191 Transport* transport, 188 Transport* transport,
192 int number_of_cores, 189 int number_of_cores,
193 const std::vector<uint32_t>& ssrcs) { 190 const std::vector<uint32_t>& ssrcs) {
194 // TODO(pbos): Remove checks for empty ssrcs and add this check when there's 191 // TODO(pbos): Remove checks for empty ssrcs and add this check when there's
195 // no base channel. 192 // no base channel.
196 // DCHECK(!ssrcs.empty()); 193 // DCHECK(!ssrcs.empty());
197 rtc::scoped_ptr<ViEEncoder> vie_encoder( 194 rtc::scoped_ptr<ViEEncoder> vie_encoder(new ViEEncoder(
198 new ViEEncoder(channel_id, number_of_cores, *config_.get(), 195 channel_id, number_of_cores, *process_thread_, pacer_.get(),
199 *process_thread_, pacer_.get(), bitrate_allocator_.get(), 196 bitrate_allocator_.get(), bitrate_controller_.get(), false));
200 bitrate_controller_.get(), false));
201 if (!vie_encoder->Init()) { 197 if (!vie_encoder->Init()) {
202 return false; 198 return false;
203 } 199 }
204 ViEEncoder* encoder = vie_encoder.get(); 200 ViEEncoder* encoder = vie_encoder.get();
205 if (!CreateChannel(channel_id, engine_id, transport, number_of_cores, 201 if (!CreateChannel(channel_id, engine_id, transport, number_of_cores,
206 vie_encoder.release(), ssrcs.empty() ? 1 : ssrcs.size(), 202 vie_encoder.release(), ssrcs.empty() ? 1 : ssrcs.size(),
207 true)) { 203 true)) {
208 return false; 204 return false;
209 } 205 }
210 ViEChannel* channel = channel_map_[channel_id]; 206 ViEChannel* channel = channel_map_[channel_id];
(...skipping 18 matching lines...) Expand all
229 } 225 }
230 226
231 bool ChannelGroup::CreateChannel(int channel_id, 227 bool ChannelGroup::CreateChannel(int channel_id,
232 int engine_id, 228 int engine_id,
233 Transport* transport, 229 Transport* transport,
234 int number_of_cores, 230 int number_of_cores,
235 ViEEncoder* vie_encoder, 231 ViEEncoder* vie_encoder,
236 size_t max_rtp_streams, 232 size_t max_rtp_streams,
237 bool sender) { 233 bool sender) {
238 rtc::scoped_ptr<ViEChannel> channel(new ViEChannel( 234 rtc::scoped_ptr<ViEChannel> channel(new ViEChannel(
239 channel_id, engine_id, number_of_cores, *config_.get(), transport, 235 channel_id, engine_id, number_of_cores, transport, process_thread_,
240 process_thread_, encoder_state_feedback_->GetRtcpIntraFrameObserver(), 236 encoder_state_feedback_->GetRtcpIntraFrameObserver(),
241 bitrate_controller_->CreateRtcpBandwidthObserver(), 237 bitrate_controller_->CreateRtcpBandwidthObserver(),
242 remote_bitrate_estimator_.get(), call_stats_->rtcp_rtt_stats(), 238 remote_bitrate_estimator_.get(), call_stats_->rtcp_rtt_stats(),
243 pacer_.get(), packet_router_.get(), max_rtp_streams, sender)); 239 pacer_.get(), packet_router_.get(), max_rtp_streams, sender));
244 if (channel->Init() != 0) { 240 if (channel->Init() != 0) {
245 return false; 241 return false;
246 } 242 }
247 243
248 // Register the channel to receive stats updates. 244 // Register the channel to receive stats updates.
249 call_stats_->RegisterStatsObserver(channel->GetStatsObserver()); 245 call_stats_->RegisterStatsObserver(channel->GetStatsObserver());
250 246
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 rtc::CritScope lock(&encoder_map_crit_); 366 rtc::CritScope lock(&encoder_map_crit_);
371 for (const auto& encoder : vie_encoder_map_) 367 for (const auto& encoder : vie_encoder_map_)
372 pad_up_to_bitrate_bps += encoder.second->GetPaddingNeededBps(); 368 pad_up_to_bitrate_bps += encoder.second->GetPaddingNeededBps();
373 } 369 }
374 pacer_->UpdateBitrate( 370 pacer_->UpdateBitrate(
375 target_bitrate_bps / 1000, 371 target_bitrate_bps / 1000,
376 PacedSender::kDefaultPaceMultiplier * target_bitrate_bps / 1000, 372 PacedSender::kDefaultPaceMultiplier * target_bitrate_bps / 1000,
377 pad_up_to_bitrate_bps / 1000); 373 pad_up_to_bitrate_bps / 1000);
378 } 374 }
379 } // namespace webrtc 375 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video_engine/vie_channel_group.h ('k') | webrtc/video_engine/vie_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698