summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhenrik.lundin@webrtc.org <henrik.lundin@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-01-29 08:47:15 +0000
committerhenrik.lundin@webrtc.org <henrik.lundin@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-01-29 08:47:15 +0000
commitd2f95a8b894344de70a531ebcd3c2b7dfab12e27 (patch)
treec0401e06e8eb8ffd5f2557a6ab2aa2edcdf72e4a
parent4d088c69fbe6659f2e2841b36ff0d0578dc6c51d (diff)
downloadwebrtc-d2f95a8b894344de70a531ebcd3c2b7dfab12e27.tar.gz
Connect webrtc::Config to WrappingBitrateEstimator
This is the second CL for this change. Connection to the ViE API remains to be done. BUG=2698 R=mflodman@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/5769004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5455 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r--experiments.h7
-rw-r--r--video_engine/vie_base_impl.cc8
-rw-r--r--video_engine/vie_base_impl.h2
-rw-r--r--video_engine/vie_channel_group.cc22
-rw-r--r--video_engine/vie_channel_group.h5
-rw-r--r--video_engine/vie_channel_manager.cc14
-rw-r--r--video_engine/vie_channel_manager.h5
7 files changed, 47 insertions, 16 deletions
diff --git a/experiments.h b/experiments.h
index 0fe1cd1c..f6d54a07 100644
--- a/experiments.h
+++ b/experiments.h
@@ -21,5 +21,12 @@ struct PaddingStrategy {
const bool redundant_payloads;
};
+
+struct RemoteBitrateEstimatorMinRate {
+ RemoteBitrateEstimatorMinRate() : min_rate(30000) {}
+ RemoteBitrateEstimatorMinRate(uint32_t min_rate) : min_rate(min_rate) {}
+
+ uint32_t min_rate;
+};
} // namespace webrtc
#endif // WEBRTC_EXPERIMENTS_H_
diff --git a/video_engine/vie_base_impl.cc b/video_engine/vie_base_impl.cc
index 9b466b2c..d9276f5d 100644
--- a/video_engine/vie_base_impl.cc
+++ b/video_engine/vie_base_impl.cc
@@ -154,9 +154,15 @@ int ViEBaseImpl::CpuOveruseMeasures(int video_channel,
}
int ViEBaseImpl::CreateChannel(int& video_channel) { // NOLINT
+ return CreateChannel(video_channel, static_cast<const Config*>(NULL));
+}
+
+int ViEBaseImpl::CreateChannel(int& video_channel, // NOLINT
+ const Config* config) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_.instance_id()),
"%s", __FUNCTION__);
- if (shared_data_.channel_manager()->CreateChannel(&video_channel) == -1) {
+ if (shared_data_.channel_manager()->CreateChannel(&video_channel,
+ config) == -1) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_.instance_id()),
"%s: Could not create channel", __FUNCTION__);
video_channel = -1;
diff --git a/video_engine/vie_base_impl.h b/video_engine/vie_base_impl.h
index 231efc9a..04c1b40a 100644
--- a/video_engine/vie_base_impl.h
+++ b/video_engine/vie_base_impl.h
@@ -40,6 +40,8 @@ class ViEBaseImpl
int* capture_queue_delay_ms_per_s);
virtual int CreateChannel(int& video_channel); // NOLINT
virtual int CreateChannel(int& video_channel, // NOLINT
+ const Config* config);
+ virtual int CreateChannel(int& video_channel, // NOLINT
int original_channel);
virtual int CreateReceiveChannel(int& video_channel, // NOLINT
int original_channel);
diff --git a/video_engine/vie_channel_group.cc b/video_engine/vie_channel_group.cc
index f079a10e..f79d65a0 100644
--- a/video_engine/vie_channel_group.cc
+++ b/video_engine/vie_channel_group.cc
@@ -11,6 +11,7 @@
#include "webrtc/video_engine/vie_channel_group.h"
#include "webrtc/common.h"
+#include "webrtc/experiments.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
@@ -31,13 +32,14 @@ static const uint32_t kTimeOffsetSwitchThreshold = 30;
class WrappingBitrateEstimator : public RemoteBitrateEstimator {
public:
WrappingBitrateEstimator(int engine_id, RemoteBitrateObserver* observer,
- Clock* clock, ProcessThread* process_thread)
+ Clock* clock, ProcessThread* process_thread,
+ const Config& config)
: observer_(observer),
clock_(clock),
process_thread_(process_thread),
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
engine_id_(engine_id),
- min_bitrate_bps_(30000),
+ min_bitrate_bps_(config.Get<RemoteBitrateEstimatorMinRate>().min_rate),
rbe_(RemoteBitrateEstimatorFactory().Create(observer_, clock_,
min_bitrate_bps_)),
using_absolute_send_time_(false),
@@ -131,15 +133,23 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator {
} // namespace
ChannelGroup::ChannelGroup(int engine_id, ProcessThread* process_thread,
- const Config& config)
+ const Config* config)
: remb_(new VieRemb()),
bitrate_controller_(BitrateController::CreateBitrateController(true)),
call_stats_(new CallStats()),
- remote_bitrate_estimator_(new WrappingBitrateEstimator(engine_id,
- remb_.get(), Clock::GetRealTimeClock(),
- process_thread)),
encoder_state_feedback_(new EncoderStateFeedback()),
+ config_(config),
+ own_config_(),
process_thread_(process_thread) {
+ if (!config) {
+ own_config_.reset(new Config);
+ config_ = own_config_.get();
+ }
+ assert(config_); // Must have a valid config pointer here.
+ remote_bitrate_estimator_.reset(
+ new WrappingBitrateEstimator(engine_id, remb_.get(),
+ Clock::GetRealTimeClock(), process_thread,
+ *config_)),
call_stats_->RegisterStatsObserver(remote_bitrate_estimator_.get());
process_thread->RegisterModule(call_stats_.get());
}
diff --git a/video_engine/vie_channel_group.h b/video_engine/vie_channel_group.h
index 95a042ef..036967f2 100644
--- a/video_engine/vie_channel_group.h
+++ b/video_engine/vie_channel_group.h
@@ -32,7 +32,7 @@ class VieRemb;
class ChannelGroup {
public:
ChannelGroup(int engine_id, ProcessThread* process_thread,
- const Config& config);
+ const Config* config);
~ChannelGroup();
void AddChannel(int channel_id);
@@ -57,6 +57,9 @@ class ChannelGroup {
scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
scoped_ptr<EncoderStateFeedback> encoder_state_feedback_;
ChannelSet channels_;
+ const Config* config_;
+ // Placeholder for the case where this owns the config.
+ scoped_ptr<Config> own_config_;
// Registered at construct time and assumed to outlive this class.
ProcessThread* process_thread_;
diff --git a/video_engine/vie_channel_manager.cc b/video_engine/vie_channel_manager.cc
index b62e2829..37e46928 100644
--- a/video_engine/vie_channel_manager.cc
+++ b/video_engine/vie_channel_manager.cc
@@ -10,6 +10,7 @@
#include "webrtc/video_engine/vie_channel_manager.h"
+#include "webrtc/common.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
#include "webrtc/modules/utility/interface/process_thread.h"
@@ -37,7 +38,7 @@ ViEChannelManager::ViEChannelManager(
voice_sync_interface_(NULL),
voice_engine_(NULL),
module_process_thread_(NULL),
- config_(config) {
+ engine_config_(config) {
WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id),
"ViEChannelManager::ViEChannelManager(engine_id: %d)",
engine_id);
@@ -79,7 +80,8 @@ void ViEChannelManager::SetModuleProcessThread(
module_process_thread_ = module_process_thread;
}
-int ViEChannelManager::CreateChannel(int* channel_id) {
+int ViEChannelManager::CreateChannel(int* channel_id,
+ const Config* channel_group_config) {
CriticalSectionScoped cs(channel_id_critsect_);
// Get a new channel id.
@@ -90,11 +92,11 @@ int ViEChannelManager::CreateChannel(int* channel_id) {
// Create a new channel group and add this channel.
ChannelGroup* group = new ChannelGroup(engine_id_, module_process_thread_,
- config_);
+ channel_group_config);
BitrateController* bitrate_controller = group->GetBitrateController();
ViEEncoder* vie_encoder = new ViEEncoder(engine_id_, new_channel_id,
number_of_cores_,
- config_,
+ engine_config_,
*module_process_thread_,
bitrate_controller);
@@ -163,7 +165,7 @@ int ViEChannelManager::CreateChannel(int* channel_id,
if (sender) {
// We need to create a new ViEEncoder.
vie_encoder = new ViEEncoder(engine_id_, new_channel_id, number_of_cores_,
- config_,
+ engine_config_,
*module_process_thread_,
bitrate_controller);
if (!(vie_encoder->Init() &&
@@ -402,7 +404,7 @@ bool ViEChannelManager::CreateChannelObject(
ViEChannel* vie_channel = new ViEChannel(channel_id, engine_id_,
number_of_cores_,
- config_,
+ engine_config_,
*module_process_thread_,
intra_frame_observer,
bandwidth_observer,
diff --git a/video_engine/vie_channel_manager.h b/video_engine/vie_channel_manager.h
index db9eb113..83250980 100644
--- a/video_engine/vie_channel_manager.h
+++ b/video_engine/vie_channel_manager.h
@@ -50,7 +50,8 @@ class ViEChannelManager: private ViEManagerBase {
void SetModuleProcessThread(ProcessThread* module_process_thread);
// Creates a new channel. 'channel_id' will be the id of the created channel.
- int CreateChannel(int* channel_id);
+ int CreateChannel(int* channel_id,
+ const Config* config);
// Creates a new channel grouped with |original_channel|. The new channel
// will get its own |ViEEncoder| if |sender| is set to true. It will be a
@@ -131,7 +132,7 @@ class ViEChannelManager: private ViEManagerBase {
VoiceEngine* voice_engine_;
ProcessThread* module_process_thread_;
- const Config& config_;
+ const Config& engine_config_;
};
class ViEChannelManagerScoped: private ViEManagerScopedBase {