- Reset capture deltas at resolution change.
- Applied smoothing of capture jitter. - Adjusted thresholds. R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2070005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4817 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -18,32 +18,50 @@
|
||||
namespace webrtc {
|
||||
|
||||
class Clock;
|
||||
class CriticalSectionWrapper;
|
||||
class CpuOveruseObserver;
|
||||
class CriticalSectionWrapper;
|
||||
class VCMExpFilter;
|
||||
|
||||
// TODO(pbos): Move this somewhere appropriate
|
||||
// Limits on standard deviation for under/overuse.
|
||||
#ifdef WEBRTC_LINUX
|
||||
const float kOveruseStdDevMs = 15.0f;
|
||||
const float kNormalUseStdDevMs = 7.0f;
|
||||
#elif WEBRTC_MAC
|
||||
const float kOveruseStdDevMs = 22.0f;
|
||||
const float kNormalUseStdDevMs = 12.0f;
|
||||
#else
|
||||
const float kOveruseStdDevMs = 17.0f;
|
||||
const float kNormalUseStdDevMs = 10.0f;
|
||||
#endif
|
||||
|
||||
// TODO(pbos): Move this somewhere appropriate.
|
||||
class Statistics {
|
||||
public:
|
||||
Statistics();
|
||||
|
||||
void AddSample(double sample);
|
||||
void AddSample(float sample_ms);
|
||||
void Reset();
|
||||
|
||||
double Mean() const;
|
||||
double Variance() const;
|
||||
double StdDev() const;
|
||||
uint64_t Samples() const;
|
||||
float Mean() const;
|
||||
float StdDev() const;
|
||||
uint64_t Count() const;
|
||||
|
||||
private:
|
||||
double sum_;
|
||||
double sum_squared_;
|
||||
float InitialMean() const;
|
||||
float InitialVariance() const;
|
||||
|
||||
float sum_;
|
||||
uint64_t count_;
|
||||
scoped_ptr<VCMExpFilter> filtered_samples_;
|
||||
scoped_ptr<VCMExpFilter> filtered_variance_;
|
||||
};
|
||||
|
||||
// Use to detect system overuse based on jitter in incoming frames.
|
||||
class OveruseFrameDetector : public Module {
|
||||
public:
|
||||
explicit OveruseFrameDetector(Clock* clock);
|
||||
explicit OveruseFrameDetector(Clock* clock,
|
||||
float normaluse_stddev_ms,
|
||||
float overuse_stddev_ms);
|
||||
~OveruseFrameDetector();
|
||||
|
||||
// Registers an observer receiving overuse and underuse callbacks. Set
|
||||
@@ -51,7 +69,7 @@ class OveruseFrameDetector : public Module {
|
||||
void SetObserver(CpuOveruseObserver* observer);
|
||||
|
||||
// Called for each captured frame.
|
||||
void FrameCaptured();
|
||||
void FrameCaptured(int width, int height);
|
||||
|
||||
// Implements Module.
|
||||
virtual int32_t TimeUntilNextProcess() OVERRIDE;
|
||||
@@ -64,6 +82,10 @@ class OveruseFrameDetector : public Module {
|
||||
// Protecting all members.
|
||||
scoped_ptr<CriticalSectionWrapper> crit_;
|
||||
|
||||
// Limits on standard deviation for under/overuse.
|
||||
const float normaluse_stddev_ms_;
|
||||
const float overuse_stddev_ms_;
|
||||
|
||||
// Observer getting overuse reports.
|
||||
CpuOveruseObserver* observer_;
|
||||
|
||||
@@ -80,6 +102,9 @@ class OveruseFrameDetector : public Module {
|
||||
bool in_quick_rampup_;
|
||||
int current_rampup_delay_ms_;
|
||||
|
||||
// Number of pixels of last captured frame.
|
||||
int num_pixels_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user