Revert "Remove sent framerate and bitrate calculations from MediaOptimization."

This reverts commit af721b72cc1bdc5d945629ad78fbea701b6f82b9.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Remove sent framerate and bitrate calculations from MediaOptimization.
> 
> Add RateTracker for sent framerate and bitrate in SendStatisticsProxy.
> 
> Store sent frame info in map to solve potential issue where sent framerate statistics could be
> incorrect.
> 
> Bug: webrtc:8375
> Change-Id: I4a6e3956013438a711b8c2e73a8cd90c52dd1210
> Reviewed-on: https://webrtc-review.googlesource.com/7880
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Commit-Queue: Åsa Persson <asapersson@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#20225}

TBR=asapersson@webrtc.org,sprang@webrtc.org

Change-Id: Ic914f03ff7065ac410ae06b6f82b56a935399b66
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8375
Reviewed-on: https://webrtc-review.googlesource.com/8480
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20248}
This commit is contained in:
Åsa Persson
2017-10-11 12:59:01 +00:00
committed by Commit Bot
parent 18945c35c2
commit ca0ed63c19
8 changed files with 171 additions and 120 deletions

View File

@ -57,12 +57,22 @@ class MediaOptimization {
// InputFrameRate 0 = no frame rate estimate available.
uint32_t InputFrameRate();
uint32_t SentFrameRate();
uint32_t SentBitRate();
private:
enum { kFrameCountHistorySize = 90 };
enum { kFrameHistoryWinMs = 2000 };
enum { kBitrateAverageWinMs = 1000 };
struct EncodedFrameSample;
typedef std::list<EncodedFrameSample> FrameSampleList;
void UpdateIncomingFrameRate() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
void PurgeOldFrameSamples(int64_t threshold_ms)
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
void UpdateSentFramerate() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
void ProcessIncomingFrameRate(int64_t now)
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
@ -78,6 +88,8 @@ class MediaOptimization {
uint32_t InputFrameRateInternal() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
uint32_t SentFrameRateInternal() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
// Protect all members.
rtc::CriticalSection crit_sect_;
@ -89,6 +101,9 @@ class MediaOptimization {
float incoming_frame_rate_ RTC_GUARDED_BY(crit_sect_);
int64_t incoming_frame_times_[kFrameCountHistorySize] RTC_GUARDED_BY(
crit_sect_);
std::list<EncodedFrameSample> encoded_frame_samples_
RTC_GUARDED_BY(crit_sect_);
uint32_t avg_sent_framerate_ RTC_GUARDED_BY(crit_sect_);
};
} // namespace media_optimization
} // namespace webrtc