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@4027 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
1673481ed7
commit
29b2219914
@ -39,17 +39,8 @@ class RemoteBitrateObserver {
|
||||
|
||||
class RemoteBitrateEstimator : public CallStatsObserver, public Module {
|
||||
public:
|
||||
enum EstimationMode {
|
||||
kMultiStreamEstimation,
|
||||
kSingleStreamEstimation
|
||||
};
|
||||
|
||||
virtual ~RemoteBitrateEstimator() {}
|
||||
|
||||
static RemoteBitrateEstimator* Create(const OverUseDetectorOptions& options,
|
||||
EstimationMode mode,
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock);
|
||||
|
||||
// Stores an RTCP SR (NTP, RTP timestamp) tuple for a specific SSRC to be used
|
||||
// in future RTP timestamp to NTP time conversions. As soon as any SSRC has
|
||||
@ -80,6 +71,24 @@ class RemoteBitrateEstimator : public CallStatsObserver, public Module {
|
||||
static const int kStreamTimeOutMs = 2000;
|
||||
};
|
||||
|
||||
struct RemoteBitrateEstimatorFactory {
|
||||
RemoteBitrateEstimatorFactory() {}
|
||||
virtual ~RemoteBitrateEstimatorFactory() {}
|
||||
|
||||
virtual RemoteBitrateEstimator* Create(
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock) const;
|
||||
};
|
||||
|
||||
struct MultiStreamRemoteBitrateEstimatorFactory
|
||||
: RemoteBitrateEstimatorFactory {
|
||||
MultiStreamRemoteBitrateEstimatorFactory() {}
|
||||
virtual ~MultiStreamRemoteBitrateEstimatorFactory() {}
|
||||
|
||||
virtual RemoteBitrateEstimator* Create(
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock) const;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR_H_
|
||||
|
@ -36,9 +36,7 @@
|
||||
'bitrate_estimator.h',
|
||||
'overuse_detector.cc',
|
||||
'overuse_detector.h',
|
||||
'remote_bitrate_estimator_multi_stream.h',
|
||||
'remote_bitrate_estimator_multi_stream.cc',
|
||||
'remote_bitrate_estimator_single_stream.h',
|
||||
'remote_bitrate_estimator_single_stream.cc',
|
||||
'remote_rate_control.cc',
|
||||
'remote_rate_control.h',
|
||||
|
@ -8,36 +8,91 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_multi_stream.h"
|
||||
#include <map>
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/bitrate_estimator.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/rtp_to_ntp.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/remote_rate_control.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/constructor_magic.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/system_wrappers/interface/tick_util.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
class RemoteBitrateEstimatorMultiStream : public RemoteBitrateEstimator {
|
||||
public:
|
||||
RemoteBitrateEstimatorMultiStream(RemoteBitrateObserver* observer,
|
||||
Clock* clock);
|
||||
|
||||
RemoteBitrateEstimator* RemoteBitrateEstimator::Create(
|
||||
const OverUseDetectorOptions& options,
|
||||
EstimationMode mode,
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock) {
|
||||
switch (mode) {
|
||||
case kMultiStreamEstimation:
|
||||
return new RemoteBitrateEstimatorMultiStream(options, observer, clock);
|
||||
case kSingleStreamEstimation:
|
||||
return new RemoteBitrateEstimatorSingleStream(options, observer, clock);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
~RemoteBitrateEstimatorMultiStream() {}
|
||||
|
||||
// Stores an RTCP SR (NTP, RTP timestamp) tuple for a specific SSRC to be used
|
||||
// in future RTP timestamp to NTP time conversions. As soon as any SSRC has
|
||||
// two tuples the RemoteBitrateEstimator will switch to multi-stream mode.
|
||||
void IncomingRtcp(unsigned int ssrc, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
uint32_t rtp_timestamp);
|
||||
|
||||
// Called for each incoming packet. The first SSRC will immediately be used
|
||||
// for over-use detection. Subsequent SSRCs will only be used when at least
|
||||
// two RTCP SR reports with the same SSRC have been received. Updates the
|
||||
// incoming payload bitrate estimate and the over-use detector.
|
||||
// If an over-use is detected the remote bitrate estimate will be updated.
|
||||
// Note that |payload_size| is the packet size excluding headers.
|
||||
void IncomingPacket(unsigned int ssrc,
|
||||
int payload_size,
|
||||
int64_t arrival_time,
|
||||
uint32_t rtp_timestamp);
|
||||
|
||||
// Triggers a new estimate calculation.
|
||||
// Implements the Module interface.
|
||||
virtual int32_t Process();
|
||||
virtual int32_t TimeUntilNextProcess();
|
||||
// Set the current round-trip time experienced by the stream.
|
||||
// Implements the StatsObserver interface.
|
||||
virtual void OnRttUpdate(uint32_t rtt);
|
||||
|
||||
// Removes all data for |ssrc|.
|
||||
void RemoveStream(unsigned int ssrc);
|
||||
|
||||
// Returns true if a valid estimate exists and sets |bitrate_bps| to the
|
||||
// estimated payload bitrate in bits per second. |ssrcs| is the list of ssrcs
|
||||
// currently being received and of which the bitrate estimate is based upon.
|
||||
bool LatestEstimate(std::vector<unsigned int>* ssrcs,
|
||||
unsigned int* bitrate_bps) const;
|
||||
|
||||
private:
|
||||
typedef std::map<unsigned int, synchronization::RtcpList> StreamMap;
|
||||
|
||||
// Triggers a new estimate calculation.
|
||||
void UpdateEstimate(int64_t time_now);
|
||||
|
||||
void GetSsrcs(std::vector<unsigned int>* ssrcs) const;
|
||||
|
||||
Clock* clock_;
|
||||
RemoteRateControl remote_rate_;
|
||||
OveruseDetector overuse_detector_;
|
||||
BitRateStats incoming_bitrate_;
|
||||
RemoteBitrateObserver* observer_;
|
||||
StreamMap streams_;
|
||||
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
||||
unsigned int initial_ssrc_;
|
||||
bool multi_stream_;
|
||||
int32_t last_process_time_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RemoteBitrateEstimatorMultiStream);
|
||||
};
|
||||
|
||||
RemoteBitrateEstimatorMultiStream::RemoteBitrateEstimatorMultiStream(
|
||||
const OverUseDetectorOptions& options,
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock)
|
||||
: clock_(clock),
|
||||
remote_rate_(),
|
||||
overuse_detector_(options),
|
||||
overuse_detector_(OverUseDetectorOptions()),
|
||||
incoming_bitrate_(),
|
||||
observer_(observer),
|
||||
streams_(),
|
||||
@ -203,5 +258,11 @@ void RemoteBitrateEstimatorMultiStream::GetSsrcs(
|
||||
(*ssrcs)[i] = it->first;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
RemoteBitrateEstimator* MultiStreamRemoteBitrateEstimatorFactory::Create(
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock) const {
|
||||
return new RemoteBitrateEstimatorMultiStream(observer, clock);
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
// This class estimates the incoming available bandwidth.
|
||||
|
||||
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR_IMPL_H_
|
||||
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR_IMPL_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "modules/remote_bitrate_estimator/bitrate_estimator.h"
|
||||
#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
||||
#include "modules/remote_bitrate_estimator/include/rtp_to_ntp.h"
|
||||
#include "modules/remote_bitrate_estimator/overuse_detector.h"
|
||||
#include "modules/remote_bitrate_estimator/remote_rate_control.h"
|
||||
#include "system_wrappers/interface/constructor_magic.h"
|
||||
#include "system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class Clock;
|
||||
|
||||
class RemoteBitrateEstimatorMultiStream : public RemoteBitrateEstimator {
|
||||
public:
|
||||
RemoteBitrateEstimatorMultiStream(const OverUseDetectorOptions& options,
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock);
|
||||
|
||||
~RemoteBitrateEstimatorMultiStream() {}
|
||||
|
||||
// Stores an RTCP SR (NTP, RTP timestamp) tuple for a specific SSRC to be used
|
||||
// in future RTP timestamp to NTP time conversions. As soon as any SSRC has
|
||||
// two tuples the RemoteBitrateEstimator will switch to multi-stream mode.
|
||||
void IncomingRtcp(unsigned int ssrc, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
uint32_t rtp_timestamp);
|
||||
|
||||
// Called for each incoming packet. The first SSRC will immediately be used
|
||||
// for over-use detection. Subsequent SSRCs will only be used when at least
|
||||
// two RTCP SR reports with the same SSRC have been received. Updates the
|
||||
// incoming payload bitrate estimate and the over-use detector.
|
||||
// If an over-use is detected the remote bitrate estimate will be updated.
|
||||
// Note that |payload_size| is the packet size excluding headers.
|
||||
void IncomingPacket(unsigned int ssrc,
|
||||
int payload_size,
|
||||
int64_t arrival_time,
|
||||
uint32_t rtp_timestamp);
|
||||
|
||||
// Triggers a new estimate calculation.
|
||||
// Implements the Module interface.
|
||||
virtual int32_t Process();
|
||||
virtual int32_t TimeUntilNextProcess();
|
||||
// Set the current round-trip time experienced by the stream.
|
||||
// Implements the StatsObserver interface.
|
||||
virtual void OnRttUpdate(uint32_t rtt);
|
||||
|
||||
// Removes all data for |ssrc|.
|
||||
void RemoveStream(unsigned int ssrc);
|
||||
|
||||
// Returns true if a valid estimate exists and sets |bitrate_bps| to the
|
||||
// estimated payload bitrate in bits per second. |ssrcs| is the list of ssrcs
|
||||
// currently being received and of which the bitrate estimate is based upon.
|
||||
bool LatestEstimate(std::vector<unsigned int>* ssrcs,
|
||||
unsigned int* bitrate_bps) const;
|
||||
|
||||
private:
|
||||
typedef std::map<unsigned int, synchronization::RtcpList> StreamMap;
|
||||
|
||||
// Triggers a new estimate calculation.
|
||||
void UpdateEstimate(int64_t time_now);
|
||||
|
||||
void GetSsrcs(std::vector<unsigned int>* ssrcs) const;
|
||||
|
||||
Clock* clock_;
|
||||
RemoteRateControl remote_rate_;
|
||||
OveruseDetector overuse_detector_;
|
||||
BitRateStats incoming_bitrate_;
|
||||
RemoteBitrateObserver* observer_;
|
||||
StreamMap streams_;
|
||||
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
||||
unsigned int initial_ssrc_;
|
||||
bool multi_stream_;
|
||||
int32_t last_process_time_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RemoteBitrateEstimatorMultiStream);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR_IMPL_H_
|
@ -8,18 +8,75 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h"
|
||||
#include <map>
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/bitrate_estimator.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/remote_rate_control.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator {
|
||||
public:
|
||||
RemoteBitrateEstimatorSingleStream(RemoteBitrateObserver* observer,
|
||||
Clock* clock);
|
||||
|
||||
void IncomingRtcp(unsigned int ssrc, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
uint32_t rtp_timestamp) {}
|
||||
|
||||
// Called for each incoming packet. If this is a new SSRC, a new
|
||||
// BitrateControl will be created. Updates the incoming payload bitrate
|
||||
// estimate and the over-use detector. If an over-use is detected the
|
||||
// remote bitrate estimate will be updated. Note that |payload_size| is the
|
||||
// packet size excluding headers.
|
||||
void IncomingPacket(unsigned int ssrc,
|
||||
int payload_size,
|
||||
int64_t arrival_time,
|
||||
uint32_t rtp_timestamp);
|
||||
|
||||
// Triggers a new estimate calculation.
|
||||
// Implements the Module interface.
|
||||
virtual int32_t Process();
|
||||
virtual int32_t TimeUntilNextProcess();
|
||||
// Set the current round-trip time experienced by the stream.
|
||||
// Implements the StatsObserver interface.
|
||||
virtual void OnRttUpdate(uint32_t rtt);
|
||||
|
||||
// Removes all data for |ssrc|.
|
||||
void RemoveStream(unsigned int ssrc);
|
||||
|
||||
// Returns true if a valid estimate exists and sets |bitrate_bps| to the
|
||||
// estimated payload bitrate in bits per second. |ssrcs| is the list of ssrcs
|
||||
// currently being received and of which the bitrate estimate is based upon.
|
||||
bool LatestEstimate(std::vector<unsigned int>* ssrcs,
|
||||
unsigned int* bitrate_bps) const;
|
||||
|
||||
private:
|
||||
typedef std::map<unsigned int, OveruseDetector> SsrcOveruseDetectorMap;
|
||||
|
||||
// Triggers a new estimate calculation.
|
||||
void UpdateEstimate(int64_t time_now);
|
||||
|
||||
void GetSsrcs(std::vector<unsigned int>* ssrcs) const;
|
||||
|
||||
Clock* clock_;
|
||||
SsrcOveruseDetectorMap overuse_detectors_;
|
||||
BitRateStats incoming_bitrate_;
|
||||
RemoteRateControl remote_rate_;
|
||||
RemoteBitrateObserver* observer_;
|
||||
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
||||
int64_t last_process_time_;
|
||||
};
|
||||
|
||||
RemoteBitrateEstimatorSingleStream::RemoteBitrateEstimatorSingleStream(
|
||||
const OverUseDetectorOptions& options,
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock)
|
||||
: options_(options),
|
||||
clock_(clock),
|
||||
: clock_(clock),
|
||||
observer_(observer),
|
||||
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
last_process_time_(-1) {
|
||||
@ -42,7 +99,7 @@ void RemoteBitrateEstimatorSingleStream::IncomingPacket(
|
||||
// group.
|
||||
std::pair<SsrcOveruseDetectorMap::iterator, bool> insert_result =
|
||||
overuse_detectors_.insert(std::make_pair(ssrc, OveruseDetector(
|
||||
options_)));
|
||||
OverUseDetectorOptions())));
|
||||
it = insert_result.first;
|
||||
}
|
||||
OveruseDetector* overuse_detector = &it->second;
|
||||
@ -159,5 +216,11 @@ void RemoteBitrateEstimatorSingleStream::GetSsrcs(
|
||||
(*ssrcs)[i] = it->first;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
RemoteBitrateEstimator* RemoteBitrateEstimatorFactory::Create(
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock) const {
|
||||
return new RemoteBitrateEstimatorSingleStream(observer, clock);
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
// This class estimates the incoming available bandwidth.
|
||||
|
||||
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR_SINGLE_STREAM_H_
|
||||
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR_SINGLE_STREAM_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/bitrate_estimator.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/remote_rate_control.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class Clock;
|
||||
|
||||
class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator {
|
||||
public:
|
||||
RemoteBitrateEstimatorSingleStream(const OverUseDetectorOptions& options,
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock);
|
||||
|
||||
virtual ~RemoteBitrateEstimatorSingleStream() {}
|
||||
|
||||
void IncomingRtcp(unsigned int ssrc, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
uint32_t rtp_timestamp) {}
|
||||
|
||||
// Called for each incoming packet. If this is a new SSRC, a new
|
||||
// BitrateControl will be created. Updates the incoming payload bitrate
|
||||
// estimate and the over-use detector. If an over-use is detected the
|
||||
// remote bitrate estimate will be updated. Note that |payload_size| is the
|
||||
// packet size excluding headers.
|
||||
void IncomingPacket(unsigned int ssrc,
|
||||
int payload_size,
|
||||
int64_t arrival_time,
|
||||
uint32_t rtp_timestamp);
|
||||
|
||||
// Triggers a new estimate calculation.
|
||||
// Implements the Module interface.
|
||||
virtual int32_t Process();
|
||||
virtual int32_t TimeUntilNextProcess();
|
||||
// Set the current round-trip time experienced by the stream.
|
||||
// Implements the StatsObserver interface.
|
||||
virtual void OnRttUpdate(uint32_t rtt);
|
||||
|
||||
// Removes all data for |ssrc|.
|
||||
void RemoveStream(unsigned int ssrc);
|
||||
|
||||
// Returns true if a valid estimate exists and sets |bitrate_bps| to the
|
||||
// estimated payload bitrate in bits per second. |ssrcs| is the list of ssrcs
|
||||
// currently being received and of which the bitrate estimate is based upon.
|
||||
bool LatestEstimate(std::vector<unsigned int>* ssrcs,
|
||||
unsigned int* bitrate_bps) const;
|
||||
|
||||
private:
|
||||
typedef std::map<unsigned int, OveruseDetector> SsrcOveruseDetectorMap;
|
||||
|
||||
// Triggers a new estimate calculation.
|
||||
void UpdateEstimate(int64_t time_now);
|
||||
|
||||
void GetSsrcs(std::vector<unsigned int>* ssrcs) const;
|
||||
|
||||
const OverUseDetectorOptions& options_;
|
||||
Clock* clock_;
|
||||
SsrcOveruseDetectorMap overuse_detectors_;
|
||||
BitRateStats incoming_bitrate_;
|
||||
RemoteRateControl remote_rate_;
|
||||
RemoteBitrateObserver* observer_;
|
||||
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
||||
int64_t last_process_time_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_REMOTE_BITRATE_ESTIMATOR_SINGLE_STREAM_H_
|
@ -195,9 +195,7 @@ RemoteBitrateEstimatorTest::RemoteBitrateEstimatorTest(bool align_streams)
|
||||
void RemoteBitrateEstimatorTest::SetUp() {
|
||||
bitrate_observer_.reset(new testing::TestBitrateObserver);
|
||||
bitrate_estimator_.reset(
|
||||
RemoteBitrateEstimator::Create(
|
||||
overuse_detector_options_,
|
||||
RemoteBitrateEstimator::kSingleStreamEstimation,
|
||||
RemoteBitrateEstimatorFactory().Create(
|
||||
bitrate_observer_.get(),
|
||||
&clock_));
|
||||
stream_generator_.reset(new testing::StreamGenerator(
|
||||
|
@ -62,11 +62,10 @@ class RtcpFormatRembTest : public ::testing::Test {
|
||||
: over_use_detector_options_(),
|
||||
system_clock_(Clock::GetRealTimeClock()),
|
||||
remote_bitrate_observer_(),
|
||||
remote_bitrate_estimator_(RemoteBitrateEstimator::Create(
|
||||
over_use_detector_options_,
|
||||
RemoteBitrateEstimator::kSingleStreamEstimation,
|
||||
&remote_bitrate_observer_,
|
||||
system_clock_)) {}
|
||||
remote_bitrate_estimator_(
|
||||
RemoteBitrateEstimatorFactory().Create(
|
||||
&remote_bitrate_observer_,
|
||||
system_clock_)) {}
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
|
||||
|
@ -171,9 +171,7 @@ class RtcpReceiverTest : public ::testing::Test {
|
||||
system_clock_(1335900000),
|
||||
remote_bitrate_observer_(),
|
||||
remote_bitrate_estimator_(
|
||||
RemoteBitrateEstimator::Create(
|
||||
over_use_detector_options_,
|
||||
RemoteBitrateEstimator::kSingleStreamEstimation,
|
||||
RemoteBitrateEstimatorFactory().Create(
|
||||
&remote_bitrate_observer_,
|
||||
&system_clock_)) {
|
||||
test_transport_ = new TestTransport();
|
||||
|
@ -277,9 +277,7 @@ class RtcpSenderTest : public ::testing::Test {
|
||||
system_clock_(Clock::GetRealTimeClock()),
|
||||
remote_bitrate_observer_(),
|
||||
remote_bitrate_estimator_(
|
||||
RemoteBitrateEstimator::Create(
|
||||
over_use_detector_options_,
|
||||
RemoteBitrateEstimator::kSingleStreamEstimation,
|
||||
RemoteBitrateEstimatorFactory().Create(
|
||||
&remote_bitrate_observer_,
|
||||
system_clock_)) {
|
||||
test_transport_ = new TestTransport();
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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_);
|
||||
|
@ -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_;
|
||||
};
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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_)),
|
||||
|
Loading…
Reference in New Issue
Block a user