From 046bc448d500998729ce8b946a3274a704f7064a Mon Sep 17 00:00:00 2001 From: "jiayl@webrtc.org" Date: Wed, 29 May 2013 16:33:46 +0000 Subject: [PATCH] Fixes the frameRate stats by grouping the frames by timestamp. R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1536004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4138 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../video_coding/main/source/media_optimization.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/video_coding/main/source/media_optimization.cc b/webrtc/modules/video_coding/main/source/media_optimization.cc index 24cf316221..0ba272dbc8 100644 --- a/webrtc/modules/video_coding/main/source/media_optimization.cc +++ b/webrtc/modules/video_coding/main/source/media_optimization.cc @@ -382,8 +382,17 @@ VCMMediaOptimization::UpdateWithEncodedData(int encodedLength, { const int64_t now_ms = _clock->TimeInMilliseconds(); PurgeOldFrameSamples(now_ms); - _encodedFrameSamples.push_back(VCMEncodedFrameSample( - encodedLength, timestamp, now_ms)); + if (_encodedFrameSamples.size() > 0 && + _encodedFrameSamples.back().timestamp == timestamp) { + // Frames having the same timestamp are generated from the same input + // frame. We don't want to double count them, but only increment the + // size_bytes. + _encodedFrameSamples.back().size_bytes += encodedLength; + _encodedFrameSamples.back().time_complete_ms = now_ms; + } else { + _encodedFrameSamples.push_back(VCMEncodedFrameSample( + encodedLength, timestamp, now_ms)); + } UpdateSentBitrate(now_ms); UpdateSentFramerate(); if(encodedLength > 0)