Fix framerate sent to account for actually sent frames.
TESTS=trybots BUG=1481 Review URL: https://webrtc-codereview.appspot.com/1195005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3682 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -17,6 +17,8 @@
|
||||
#include "media_opt_util.h"
|
||||
#include "qm_select.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class Clock;
|
||||
@ -28,12 +30,16 @@ namespace media_optimization {
|
||||
enum { kBitrateMaxFrameSamples = 60 };
|
||||
enum { kBitrateAverageWinMs = 1000 };
|
||||
|
||||
struct VCMEncodedFrameSample
|
||||
{
|
||||
VCMEncodedFrameSample() : _sizeBytes(-1), _timeCompleteMs(-1) {}
|
||||
struct VCMEncodedFrameSample {
|
||||
VCMEncodedFrameSample(int size_bytes, uint32_t timestamp,
|
||||
int64_t time_complete_ms)
|
||||
: size_bytes(size_bytes),
|
||||
timestamp(timestamp),
|
||||
time_complete_ms(time_complete_ms) {}
|
||||
|
||||
WebRtc_Word64 _sizeBytes;
|
||||
WebRtc_Word64 _timeCompleteMs;
|
||||
uint32_t size_bytes;
|
||||
uint32_t timestamp;
|
||||
int64_t time_complete_ms;
|
||||
};
|
||||
|
||||
class VCMMediaOptimization
|
||||
@ -87,11 +93,11 @@ public:
|
||||
/*
|
||||
* Get actual sent frame rate
|
||||
*/
|
||||
float SentFrameRate();
|
||||
uint32_t SentFrameRate();
|
||||
/*
|
||||
* Get actual sent bit rate
|
||||
*/
|
||||
float SentBitRate();
|
||||
uint32_t SentBitRate();
|
||||
/*
|
||||
* Get maximum allowed bit rate
|
||||
*/
|
||||
@ -99,7 +105,8 @@ public:
|
||||
/*
|
||||
* Inform Media Optimization of encoding output: Length and frame type
|
||||
*/
|
||||
WebRtc_Word32 UpdateWithEncodedData(WebRtc_Word32 encodedLength,
|
||||
WebRtc_Word32 UpdateWithEncodedData(int encodedLength,
|
||||
uint32_t timestamp,
|
||||
FrameType encodedFrameType);
|
||||
/*
|
||||
* Register a protection callback to be used to inform the user about the
|
||||
@ -128,7 +135,7 @@ public:
|
||||
/**
|
||||
* Update content metric Data
|
||||
*/
|
||||
void updateContentData(const VideoContentMetrics* contentMetrics);
|
||||
void UpdateContentData(const VideoContentMetrics* contentMetrics);
|
||||
|
||||
/**
|
||||
* Compute new Quality Mode
|
||||
@ -136,6 +143,7 @@ public:
|
||||
WebRtc_Word32 SelectQuality();
|
||||
|
||||
private:
|
||||
typedef std::list<VCMEncodedFrameSample> FrameSampleList;
|
||||
|
||||
/*
|
||||
* Update protection callback with protection settings
|
||||
@ -145,7 +153,10 @@ private:
|
||||
uint32_t* nack_overhead_rate_bps,
|
||||
uint32_t* fec_overhead_rate_bps);
|
||||
|
||||
void UpdateBitRateEstimate(WebRtc_Word64 encodedLength, WebRtc_Word64 nowMs);
|
||||
void PurgeOldFrameSamples(int64_t now_ms);
|
||||
void UpdateSentBitrate(int64_t nowMs);
|
||||
void UpdateSentFramerate();
|
||||
|
||||
/*
|
||||
* verify if QM settings differ from default, i.e. if an update is required
|
||||
* Compute actual values, as will be sent to the encoder
|
||||
@ -155,7 +166,7 @@ private:
|
||||
* check if we should make a QM change
|
||||
* will return 1 if yes, 0 otherwise
|
||||
*/
|
||||
bool checkStatusForQMchange();
|
||||
bool CheckStatusForQMchange();
|
||||
|
||||
void ProcessIncomingFrameRate(WebRtc_Word64 now);
|
||||
|
||||
@ -188,8 +199,9 @@ private:
|
||||
VCMProtectionCallback* _videoProtectionCallback;
|
||||
VCMQMSettingsCallback* _videoQMSettingsCallback;
|
||||
|
||||
VCMEncodedFrameSample _encodedFrameSamples[kBitrateMaxFrameSamples];
|
||||
float _avgSentBitRateBps;
|
||||
std::list<VCMEncodedFrameSample> _encodedFrameSamples;
|
||||
uint32_t _avgSentBitRateBps;
|
||||
uint32_t _avgSentFramerate;
|
||||
|
||||
WebRtc_UWord32 _keyFrameCnt;
|
||||
WebRtc_UWord32 _deltaFrameCnt;
|
||||
|
||||
Reference in New Issue
Block a user