summaryrefslogtreecommitdiff
path: root/video_engine
diff options
context:
space:
mode:
authorandresp@webrtc.org <andresp@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-05-14 12:10:58 +0000
committerandresp@webrtc.org <andresp@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-05-14 12:10:58 +0000
commit0425392858172d13eb65a1143a12c2787cea4b1b (patch)
treee8bacf2c09f1030d648e4788ad046100131b6df0 /video_engine
parent5ba433cad0d4ab117ce24862c4f0cd30015ab096 (diff)
downloadwebrtc-0425392858172d13eb65a1143a12c2787cea4b1b.tar.gz
Adding a factory to remote bitrate estimator and allow it to be set via config.
Additionally: - clean api to set remote bitrate estimator mode. - clean api to set over use detector options. R=mflodman@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1448006 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4027 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'video_engine')
-rw-r--r--video_engine/include/vie_rtp_rtcp.h4
-rw-r--r--video_engine/test/auto_test/source/vie_autotest_loopback.cc28
-rw-r--r--video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc10
-rw-r--r--video_engine/test/auto_test/source/vie_autotest_simulcast.cc27
-rw-r--r--video_engine/vie_channel_group.cc29
-rw-r--r--video_engine/vie_channel_group.h5
-rw-r--r--video_engine/vie_channel_manager.cc25
-rw-r--r--video_engine/vie_channel_manager.h23
-rw-r--r--video_engine/vie_rtp_rtcp_impl.cc9
-rw-r--r--video_engine/vie_rtp_rtcp_impl.h1
-rw-r--r--video_engine/vie_shared_data.cc1
11 files changed, 26 insertions, 136 deletions
diff --git a/video_engine/include/vie_rtp_rtcp.h b/video_engine/include/vie_rtp_rtcp.h
index b1fd90c5..cff180b3 100644
--- a/video_engine/include/vie_rtp_rtcp.h
+++ b/video_engine/include/vie_rtp_rtcp.h
@@ -232,10 +232,6 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP {
bool sender,
bool receiver) = 0;
- // Sets the bandwidth estimation mode. This can only be changed before
- // adding a channel.
- virtual int SetBandwidthEstimationMode(BandwidthEstimationMode mode) = 0;
-
// Enables RTP timestamp extension offset described in RFC 5450. This call
// must be done before ViECodec::SetSendCodec is called.
virtual int SetSendTimestampOffsetStatus(int video_channel,
diff --git a/video_engine/test/auto_test/source/vie_autotest_loopback.cc b/video_engine/test/auto_test/source/vie_autotest_loopback.cc
index 29162491..6bfe3f95 100644
--- a/video_engine/test/auto_test/source/vie_autotest_loopback.cc
+++ b/video_engine/test/auto_test/source/vie_autotest_loopback.cc
@@ -100,33 +100,6 @@ int VideoEngineSampleCode(void* window1, void* window2)
return -1;
}
- printf("Bandwidth estimation modes:\n");
- printf("1. Single-stream bandwidth estimation\n");
- printf("2. Multi-stream bandwidth estimation\n");
- printf("Choose bandwidth estimation mode (default is 1): ");
- std::string str;
- std::getline(std::cin, str);
- int bwe_mode_choice = atoi(str.c_str());
- webrtc::BandwidthEstimationMode bwe_mode;
- switch (bwe_mode_choice) {
- case 1:
- bwe_mode = webrtc::kViESingleStreamEstimation;
- break;
- case 2:
- bwe_mode = webrtc::kViEMultiStreamEstimation;
- break;
- default:
- bwe_mode = webrtc::kViESingleStreamEstimation;
- break;
- }
-
- error = ptrViERtpRtcp->SetBandwidthEstimationMode(bwe_mode);
- if (error == -1)
- {
- printf("ERROR in ViERTP_RTCP::SetBandwidthEstimationMode\n");
- return -1;
- }
-
int videoChannel = -1;
error = ptrViEBase->CreateChannel(videoChannel);
if (error == -1)
@@ -375,6 +348,7 @@ int VideoEngineSampleCode(void* window1, void* window2)
}
// Set spatial resolution option
+ std::string str;
std::cout << std::endl;
std::cout << "Enter frame size option (default is CIF):" << std::endl;
std::cout << "1. QCIF (176X144) " << std::endl;
diff --git a/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc b/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc
index 6ec57dfd..c0832cdc 100644
--- a/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc
+++ b/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc
@@ -536,19 +536,9 @@ void ViEAutoTest::ViERtpRtcpAPITest()
// Create VIE
TbInterfaces ViE("ViERtpRtcpAPITest");
- // Verify that we can set the bandwidth estimation mode, as that API only
- // is valid to call before creating channels.
- EXPECT_EQ(0, ViE.rtp_rtcp->SetBandwidthEstimationMode(
- webrtc::kViESingleStreamEstimation));
-
// Create a video channel
TbVideoChannel tbChannel(ViE, webrtc::kVideoCodecVP8);
- EXPECT_EQ(-1, ViE.rtp_rtcp->SetBandwidthEstimationMode(
- webrtc::kViESingleStreamEstimation));
- EXPECT_EQ(-1, ViE.rtp_rtcp->SetBandwidthEstimationMode(
- webrtc::kViEMultiStreamEstimation));
-
// Create a capture device
TbCaptureDevice tbCapture(ViE);
tbCapture.ConnectTo(tbChannel.videoChannel);
diff --git a/video_engine/test/auto_test/source/vie_autotest_simulcast.cc b/video_engine/test/auto_test/source/vie_autotest_simulcast.cc
index 5c01cbf9..1363c352 100644
--- a/video_engine/test/auto_test/source/vie_autotest_simulcast.cc
+++ b/video_engine/test/auto_test/source/vie_autotest_simulcast.cc
@@ -145,32 +145,6 @@ int VideoEngineSimulcastTest(void* window1, void* window2) {
return -1;
}
- printf("Bandwidth estimation modes:\n");
- printf("1. Single-stream bandwidth estimation\n");
- printf("2. Multi-stream bandwidth estimation\n");
- printf("Choose bandwidth estimation mode (default is 1): ");
- std::string str;
- std::getline(std::cin, str);
- int bwe_mode_choice = atoi(str.c_str());
- webrtc::BandwidthEstimationMode bwe_mode;
- switch (bwe_mode_choice) {
- case 1:
- bwe_mode = webrtc::kViESingleStreamEstimation;
- break;
- case 2:
- bwe_mode = webrtc::kViEMultiStreamEstimation;
- break;
- default:
- bwe_mode = webrtc::kViESingleStreamEstimation;
- break;
- }
-
- error = vie_rtp_rtcp->SetBandwidthEstimationMode(bwe_mode);
- if (error == -1) {
- printf("ERROR in ViERTP_RTCP::SetBandwidthEstimationMode\n");
- return -1;
- }
-
int video_channel = -1;
error = vie_base->CreateChannel(video_channel);
if (error == -1) {
@@ -392,6 +366,7 @@ int VideoEngineSimulcastTest(void* window1, void* window2) {
}
// Set start bit rate.
+ std::string str;
std::cout << std::endl;
std::cout << "Choose start rate (in kbps). Press enter for default: ";
std::getline(std::cin, str);
diff --git a/video_engine/vie_channel_group.cc b/video_engine/vie_channel_group.cc
index 1a78659f..1b4484fa 100644
--- a/video_engine/vie_channel_group.cc
+++ b/video_engine/vie_channel_group.cc
@@ -8,29 +8,30 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "video_engine/vie_channel_group.h"
+#include "webrtc/video_engine/vie_channel_group.h"
-#include "modules/bitrate_controller/include/bitrate_controller.h"
-#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
-#include "modules/rtp_rtcp/interface/rtp_rtcp.h"
-#include "modules/utility/interface/process_thread.h"
-#include "video_engine/call_stats.h"
-#include "video_engine/encoder_state_feedback.h"
-#include "video_engine/vie_channel.h"
-#include "video_engine/vie_encoder.h"
-#include "video_engine/vie_remb.h"
+#include "webrtc/common.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"
+#include "webrtc/modules/utility/interface/process_thread.h"
+#include "webrtc/video_engine/call_stats.h"
+#include "webrtc/video_engine/encoder_state_feedback.h"
+#include "webrtc/video_engine/vie_channel.h"
+#include "webrtc/video_engine/vie_encoder.h"
+#include "webrtc/video_engine/vie_remb.h"
namespace webrtc {
ChannelGroup::ChannelGroup(ProcessThread* process_thread,
- const OverUseDetectorOptions& options,
- RemoteBitrateEstimator::EstimationMode mode,
const Config& config)
: remb_(new VieRemb()),
bitrate_controller_(BitrateController::CreateBitrateController()),
call_stats_(new CallStats()),
- remote_bitrate_estimator_(RemoteBitrateEstimator::Create(
- options, mode, remb_.get(), Clock::GetRealTimeClock())),
+ remote_bitrate_estimator_(
+ config.Get<RemoteBitrateEstimatorFactory>().Create(
+ remb_.get(),
+ Clock::GetRealTimeClock())),
encoder_state_feedback_(new EncoderStateFeedback()),
process_thread_(process_thread) {
call_stats_->RegisterStatsObserver(remote_bitrate_estimator_.get());
diff --git a/video_engine/vie_channel_group.h b/video_engine/vie_channel_group.h
index 6a313680..7d4fc2b8 100644
--- a/video_engine/vie_channel_group.h
+++ b/video_engine/vie_channel_group.h
@@ -13,7 +13,6 @@
#include <set>
-#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "system_wrappers/interface/scoped_ptr.h"
namespace webrtc {
@@ -22,8 +21,8 @@ class BitrateController;
class CallStats;
class Config;
class EncoderStateFeedback;
-struct OverUseDetectorOptions;
class ProcessThread;
+class RemoteBitrateEstimator;
class ViEChannel;
class ViEEncoder;
class VieRemb;
@@ -33,8 +32,6 @@ class VieRemb;
class ChannelGroup {
public:
ChannelGroup(ProcessThread* process_thread,
- const OverUseDetectorOptions& options,
- RemoteBitrateEstimator::EstimationMode mode,
const Config& config);
~ChannelGroup();
diff --git a/video_engine/vie_channel_manager.cc b/video_engine/vie_channel_manager.cc
index 874b16f8..7f74afd1 100644
--- a/video_engine/vie_channel_manager.cc
+++ b/video_engine/vie_channel_manager.cc
@@ -29,7 +29,6 @@ namespace webrtc {
ViEChannelManager::ViEChannelManager(
int engine_id,
int number_of_cores,
- const OverUseDetectorOptions& options,
const Config& config)
: channel_id_critsect_(CriticalSectionWrapper::CreateCriticalSection()),
engine_id_(engine_id),
@@ -39,8 +38,6 @@ ViEChannelManager::ViEChannelManager(
voice_sync_interface_(NULL),
voice_engine_(NULL),
module_process_thread_(NULL),
- over_use_detector_options_(options),
- bwe_mode_(RemoteBitrateEstimator::kSingleStreamEstimation),
config_(config) {
WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id),
"ViEChannelManager::ViEChannelManager(engine_id: %d)",
@@ -94,8 +91,6 @@ int ViEChannelManager::CreateChannel(int* channel_id) {
// Create a new channel group and add this channel.
ChannelGroup* group = new ChannelGroup(module_process_thread_,
- over_use_detector_options_,
- bwe_mode_,
config_);
BitrateController* bitrate_controller = group->GetBitrateController();
ViEEncoder* vie_encoder = new ViEEncoder(engine_id_, new_channel_id,
@@ -372,26 +367,6 @@ bool ViEChannelManager::SetRembStatus(int channel_id, bool sender,
return group->SetChannelRembStatus(channel_id, sender, receiver, channel);
}
-bool ViEChannelManager::SetBandwidthEstimationMode(
- BandwidthEstimationMode mode) {
- CriticalSectionScoped cs(channel_id_critsect_);
- if (channel_groups_.size() > 0) {
- return false;
- }
- switch (mode) {
- case kViEMultiStreamEstimation:
- bwe_mode_ = RemoteBitrateEstimator::kMultiStreamEstimation;
- break;
- case kViESingleStreamEstimation:
- bwe_mode_ = RemoteBitrateEstimator::kSingleStreamEstimation;
- break;
- default:
- assert(false);
- return false;
- }
- return true;
-}
-
void ViEChannelManager::UpdateSsrcs(int channel_id,
const std::list<unsigned int>& ssrcs) {
CriticalSectionScoped cs(channel_id_critsect_);
diff --git a/video_engine/vie_channel_manager.h b/video_engine/vie_channel_manager.h
index a093b85b..19932136 100644
--- a/video_engine/vie_channel_manager.h
+++ b/video_engine/vie_channel_manager.h
@@ -14,14 +14,14 @@
#include <list>
#include <map>
-#include "engine_configurations.h" // NOLINT
-#include "system_wrappers/interface/scoped_ptr.h"
-#include "typedefs.h" // NOLINT
-#include "video_engine/include/vie_rtp_rtcp.h"
-#include "video_engine/vie_channel_group.h"
-#include "video_engine/vie_defines.h"
-#include "video_engine/vie_manager_base.h"
-#include "video_engine/vie_remb.h"
+#include "webrtc/engine_configurations.h"
+#include "webrtc/system_wrappers/interface/scoped_ptr.h"
+#include "webrtc/typedefs.h"
+#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
+#include "webrtc/video_engine/vie_channel_group.h"
+#include "webrtc/video_engine/vie_defines.h"
+#include "webrtc/video_engine/vie_manager_base.h"
+#include "webrtc/video_engine/vie_remb.h"
namespace webrtc {
@@ -45,7 +45,6 @@ class ViEChannelManager: private ViEManagerBase {
public:
ViEChannelManager(int engine_id,
int number_of_cores,
- const OverUseDetectorOptions& options,
const Config& config);
~ViEChannelManager();
@@ -76,10 +75,6 @@ class ViEChannelManager: private ViEManagerBase {
// Adds a channel to include when sending REMB.
bool SetRembStatus(int channel_id, bool sender, bool receiver);
- // Sets the bandwidth estimation mode. This can only be changed before
- // adding a channel.
- bool SetBandwidthEstimationMode(BandwidthEstimationMode mode);
-
// Updates the SSRCs for a channel. If one of the SSRCs already is registered,
// it will simply be ignored and no error is returned.
void UpdateSsrcs(int channel_id, const std::list<unsigned int>& ssrcs);
@@ -137,8 +132,6 @@ class ViEChannelManager: private ViEManagerBase {
VoiceEngine* voice_engine_;
ProcessThread* module_process_thread_;
- const OverUseDetectorOptions& over_use_detector_options_;
- RemoteBitrateEstimator::EstimationMode bwe_mode_;
const Config& config_;
};
diff --git a/video_engine/vie_rtp_rtcp_impl.cc b/video_engine/vie_rtp_rtcp_impl.cc
index 5a4d5288..a58f8a02 100644
--- a/video_engine/vie_rtp_rtcp_impl.cc
+++ b/video_engine/vie_rtp_rtcp_impl.cc
@@ -718,15 +718,6 @@ int ViERTP_RTCPImpl::SetRembStatus(int video_channel, bool sender,
return 0;
}
-int ViERTP_RTCPImpl::SetBandwidthEstimationMode(BandwidthEstimationMode mode) {
- WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(),
- "ViERTP_RTCPImpl::SetBandwidthEstimationMode(%d)", mode);
- if (!shared_data_->channel_manager()->SetBandwidthEstimationMode(mode)) {
- return -1;
- }
- return 0;
-}
-
int ViERTP_RTCPImpl::SetSendTimestampOffsetStatus(int video_channel,
bool enable,
int id) {
diff --git a/video_engine/vie_rtp_rtcp_impl.h b/video_engine/vie_rtp_rtcp_impl.h
index 257974ce..f41c3367 100644
--- a/video_engine/vie_rtp_rtcp_impl.h
+++ b/video_engine/vie_rtp_rtcp_impl.h
@@ -76,7 +76,6 @@ class ViERTP_RTCPImpl
const ViEKeyFrameRequestMethod method);
virtual int SetTMMBRStatus(const int video_channel, const bool enable);
virtual int SetRembStatus(int video_channel, bool sender, bool receiver);
- virtual int SetBandwidthEstimationMode(BandwidthEstimationMode mode);
virtual int SetSendTimestampOffsetStatus(int video_channel,
bool enable,
int id);
diff --git a/video_engine/vie_shared_data.cc b/video_engine/vie_shared_data.cc
index 4e6ebcc0..bdcc0ef2 100644
--- a/video_engine/vie_shared_data.cc
+++ b/video_engine/vie_shared_data.cc
@@ -28,7 +28,6 @@ ViESharedData::ViESharedData(const Config& config)
number_cores_(CpuInfo::DetectNumberOfCores()),
over_use_detector_options_(),
channel_manager_(*new ViEChannelManager(instance_id_, number_cores_,
- over_use_detector_options_,
config)),
input_manager_(*new ViEInputManager(instance_id_, config)),
render_manager_(*new ViERenderManager(instance_id_)),