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@5455 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
c7c7a531f3
commit
41907748cb
@ -21,5 +21,12 @@ struct PaddingStrategy {
|
|||||||
|
|
||||||
const bool redundant_payloads;
|
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
|
} // namespace webrtc
|
||||||
#endif // WEBRTC_EXPERIMENTS_H_
|
#endif // WEBRTC_EXPERIMENTS_H_
|
||||||
|
@ -154,9 +154,15 @@ int ViEBaseImpl::CpuOveruseMeasures(int video_channel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ViEBaseImpl::CreateChannel(int& video_channel) { // NOLINT
|
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()),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_.instance_id()),
|
||||||
"%s", __FUNCTION__);
|
"%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()),
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_.instance_id()),
|
||||||
"%s: Could not create channel", __FUNCTION__);
|
"%s: Could not create channel", __FUNCTION__);
|
||||||
video_channel = -1;
|
video_channel = -1;
|
||||||
|
@ -39,6 +39,8 @@ class ViEBaseImpl
|
|||||||
int* encode_usage_percent,
|
int* encode_usage_percent,
|
||||||
int* capture_queue_delay_ms_per_s);
|
int* capture_queue_delay_ms_per_s);
|
||||||
virtual int CreateChannel(int& video_channel); // NOLINT
|
virtual int CreateChannel(int& video_channel); // NOLINT
|
||||||
|
virtual int CreateChannel(int& video_channel, // NOLINT
|
||||||
|
const Config* config);
|
||||||
virtual int CreateChannel(int& video_channel, // NOLINT
|
virtual int CreateChannel(int& video_channel, // NOLINT
|
||||||
int original_channel);
|
int original_channel);
|
||||||
virtual int CreateReceiveChannel(int& video_channel, // NOLINT
|
virtual int CreateReceiveChannel(int& video_channel, // NOLINT
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "webrtc/video_engine/vie_channel_group.h"
|
#include "webrtc/video_engine/vie_channel_group.h"
|
||||||
|
|
||||||
#include "webrtc/common.h"
|
#include "webrtc/common.h"
|
||||||
|
#include "webrtc/experiments.h"
|
||||||
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
|
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
|
||||||
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||||
@ -31,13 +32,14 @@ static const uint32_t kTimeOffsetSwitchThreshold = 30;
|
|||||||
class WrappingBitrateEstimator : public RemoteBitrateEstimator {
|
class WrappingBitrateEstimator : public RemoteBitrateEstimator {
|
||||||
public:
|
public:
|
||||||
WrappingBitrateEstimator(int engine_id, RemoteBitrateObserver* observer,
|
WrappingBitrateEstimator(int engine_id, RemoteBitrateObserver* observer,
|
||||||
Clock* clock, ProcessThread* process_thread)
|
Clock* clock, ProcessThread* process_thread,
|
||||||
|
const Config& config)
|
||||||
: observer_(observer),
|
: observer_(observer),
|
||||||
clock_(clock),
|
clock_(clock),
|
||||||
process_thread_(process_thread),
|
process_thread_(process_thread),
|
||||||
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
engine_id_(engine_id),
|
engine_id_(engine_id),
|
||||||
min_bitrate_bps_(30000),
|
min_bitrate_bps_(config.Get<RemoteBitrateEstimatorMinRate>().min_rate),
|
||||||
rbe_(RemoteBitrateEstimatorFactory().Create(observer_, clock_,
|
rbe_(RemoteBitrateEstimatorFactory().Create(observer_, clock_,
|
||||||
min_bitrate_bps_)),
|
min_bitrate_bps_)),
|
||||||
using_absolute_send_time_(false),
|
using_absolute_send_time_(false),
|
||||||
@ -131,15 +133,23 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ChannelGroup::ChannelGroup(int engine_id, ProcessThread* process_thread,
|
ChannelGroup::ChannelGroup(int engine_id, ProcessThread* process_thread,
|
||||||
const Config& config)
|
const Config* config)
|
||||||
: remb_(new VieRemb()),
|
: remb_(new VieRemb()),
|
||||||
bitrate_controller_(BitrateController::CreateBitrateController(true)),
|
bitrate_controller_(BitrateController::CreateBitrateController(true)),
|
||||||
call_stats_(new CallStats()),
|
call_stats_(new CallStats()),
|
||||||
remote_bitrate_estimator_(new WrappingBitrateEstimator(engine_id,
|
|
||||||
remb_.get(), Clock::GetRealTimeClock(),
|
|
||||||
process_thread)),
|
|
||||||
encoder_state_feedback_(new EncoderStateFeedback()),
|
encoder_state_feedback_(new EncoderStateFeedback()),
|
||||||
|
config_(config),
|
||||||
|
own_config_(),
|
||||||
process_thread_(process_thread) {
|
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());
|
call_stats_->RegisterStatsObserver(remote_bitrate_estimator_.get());
|
||||||
process_thread->RegisterModule(call_stats_.get());
|
process_thread->RegisterModule(call_stats_.get());
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class VieRemb;
|
|||||||
class ChannelGroup {
|
class ChannelGroup {
|
||||||
public:
|
public:
|
||||||
ChannelGroup(int engine_id, ProcessThread* process_thread,
|
ChannelGroup(int engine_id, ProcessThread* process_thread,
|
||||||
const Config& config);
|
const Config* config);
|
||||||
~ChannelGroup();
|
~ChannelGroup();
|
||||||
|
|
||||||
void AddChannel(int channel_id);
|
void AddChannel(int channel_id);
|
||||||
@ -57,6 +57,9 @@ class ChannelGroup {
|
|||||||
scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
|
scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
|
||||||
scoped_ptr<EncoderStateFeedback> encoder_state_feedback_;
|
scoped_ptr<EncoderStateFeedback> encoder_state_feedback_;
|
||||||
ChannelSet channels_;
|
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.
|
// Registered at construct time and assumed to outlive this class.
|
||||||
ProcessThread* process_thread_;
|
ProcessThread* process_thread_;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "webrtc/video_engine/vie_channel_manager.h"
|
#include "webrtc/video_engine/vie_channel_manager.h"
|
||||||
|
|
||||||
|
#include "webrtc/common.h"
|
||||||
#include "webrtc/engine_configurations.h"
|
#include "webrtc/engine_configurations.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||||
#include "webrtc/modules/utility/interface/process_thread.h"
|
#include "webrtc/modules/utility/interface/process_thread.h"
|
||||||
@ -37,7 +38,7 @@ ViEChannelManager::ViEChannelManager(
|
|||||||
voice_sync_interface_(NULL),
|
voice_sync_interface_(NULL),
|
||||||
voice_engine_(NULL),
|
voice_engine_(NULL),
|
||||||
module_process_thread_(NULL),
|
module_process_thread_(NULL),
|
||||||
config_(config) {
|
engine_config_(config) {
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id),
|
WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id),
|
||||||
"ViEChannelManager::ViEChannelManager(engine_id: %d)",
|
"ViEChannelManager::ViEChannelManager(engine_id: %d)",
|
||||||
engine_id);
|
engine_id);
|
||||||
@ -79,7 +80,8 @@ void ViEChannelManager::SetModuleProcessThread(
|
|||||||
module_process_thread_ = module_process_thread;
|
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_);
|
CriticalSectionScoped cs(channel_id_critsect_);
|
||||||
|
|
||||||
// Get a new channel id.
|
// Get a new channel id.
|
||||||
@ -90,11 +92,11 @@ int ViEChannelManager::CreateChannel(int* channel_id) {
|
|||||||
|
|
||||||
// Create a new channel group and add this channel.
|
// Create a new channel group and add this channel.
|
||||||
ChannelGroup* group = new ChannelGroup(engine_id_, module_process_thread_,
|
ChannelGroup* group = new ChannelGroup(engine_id_, module_process_thread_,
|
||||||
config_);
|
channel_group_config);
|
||||||
BitrateController* bitrate_controller = group->GetBitrateController();
|
BitrateController* bitrate_controller = group->GetBitrateController();
|
||||||
ViEEncoder* vie_encoder = new ViEEncoder(engine_id_, new_channel_id,
|
ViEEncoder* vie_encoder = new ViEEncoder(engine_id_, new_channel_id,
|
||||||
number_of_cores_,
|
number_of_cores_,
|
||||||
config_,
|
engine_config_,
|
||||||
*module_process_thread_,
|
*module_process_thread_,
|
||||||
bitrate_controller);
|
bitrate_controller);
|
||||||
|
|
||||||
@ -163,7 +165,7 @@ int ViEChannelManager::CreateChannel(int* channel_id,
|
|||||||
if (sender) {
|
if (sender) {
|
||||||
// We need to create a new ViEEncoder.
|
// We need to create a new ViEEncoder.
|
||||||
vie_encoder = new ViEEncoder(engine_id_, new_channel_id, number_of_cores_,
|
vie_encoder = new ViEEncoder(engine_id_, new_channel_id, number_of_cores_,
|
||||||
config_,
|
engine_config_,
|
||||||
*module_process_thread_,
|
*module_process_thread_,
|
||||||
bitrate_controller);
|
bitrate_controller);
|
||||||
if (!(vie_encoder->Init() &&
|
if (!(vie_encoder->Init() &&
|
||||||
@ -402,7 +404,7 @@ bool ViEChannelManager::CreateChannelObject(
|
|||||||
|
|
||||||
ViEChannel* vie_channel = new ViEChannel(channel_id, engine_id_,
|
ViEChannel* vie_channel = new ViEChannel(channel_id, engine_id_,
|
||||||
number_of_cores_,
|
number_of_cores_,
|
||||||
config_,
|
engine_config_,
|
||||||
*module_process_thread_,
|
*module_process_thread_,
|
||||||
intra_frame_observer,
|
intra_frame_observer,
|
||||||
bandwidth_observer,
|
bandwidth_observer,
|
||||||
|
@ -50,7 +50,8 @@ class ViEChannelManager: private ViEManagerBase {
|
|||||||
void SetModuleProcessThread(ProcessThread* module_process_thread);
|
void SetModuleProcessThread(ProcessThread* module_process_thread);
|
||||||
|
|
||||||
// Creates a new channel. 'channel_id' will be the id of the created channel.
|
// 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
|
// 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
|
// 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_;
|
VoiceEngine* voice_engine_;
|
||||||
ProcessThread* module_process_thread_;
|
ProcessThread* module_process_thread_;
|
||||||
const Config& config_;
|
const Config& engine_config_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ViEChannelManagerScoped: private ViEManagerScopedBase {
|
class ViEChannelManagerScoped: private ViEManagerScopedBase {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user