| Index: webrtc/modules/video_coding/codecs/test/stats.h
|
| diff --git a/webrtc/modules/video_coding/codecs/test/stats.h b/webrtc/modules/video_coding/codecs/test/stats.h
|
| index 1a9b18767f328134f02989394e573c96620a4231..a0bd1129801757c4ad75ea2e870b814a95d0e0cd 100644
|
| --- a/webrtc/modules/video_coding/codecs/test/stats.h
|
| +++ b/webrtc/modules/video_coding/codecs/test/stats.h
|
| @@ -18,48 +18,55 @@
|
| namespace webrtc {
|
| namespace test {
|
|
|
| -// Contains statistics of a single processed frame.
|
| +// Statistics for one processed frame.
|
| struct FrameStatistic {
|
| - bool encoding_successful = false;
|
| - bool decoding_successful = false;
|
| + explicit FrameStatistic(int frame_number) : frame_number(frame_number) {}
|
| + const int frame_number = 0;
|
| +
|
| + // Encoding.
|
| + int64_t encode_start_ns = 0;
|
| int encode_return_code = 0;
|
| + bool encoding_successful = false;
|
| + int encode_time_us = 0;
|
| + int bitrate_kbps = 0;
|
| + size_t encoded_frame_size_bytes = 0;
|
| + webrtc::FrameType frame_type = kVideoFrameDelta;
|
| +
|
| + // Decoding.
|
| + int64_t decode_start_ns = 0;
|
| int decode_return_code = 0;
|
| - int encode_time_in_us = 0;
|
| - int decode_time_in_us = 0;
|
| + bool decoding_successful = false;
|
| + int decode_time_us = 0;
|
| + int decoded_width = 0;
|
| + int decoded_height = 0;
|
| +
|
| + // Quantization.
|
| int qp = -1;
|
| - int frame_number = 0;
|
| +
|
| // How many packets were discarded of the encoded frame data (if any).
|
| int packets_dropped = 0;
|
| size_t total_packets = 0;
|
| -
|
| - // Current bit rate. Calculated out of the size divided with the time
|
| - // interval per frame.
|
| - int bit_rate_in_kbps = 0;
|
| -
|
| - // Copied from EncodedImage.
|
| - size_t encoded_frame_length_in_bytes = 0;
|
| - webrtc::FrameType frame_type = kVideoFrameDelta;
|
| + size_t manipulated_length = 0;
|
| };
|
|
|
| -// Handles statistics from a single video processing run.
|
| -// Contains calculation methods for interesting metrics from these stats.
|
| +// Statistics for a sequence of processed frames. This class is not thread safe.
|
| class Stats {
|
| public:
|
| - typedef std::vector<FrameStatistic>::iterator FrameStatisticsIterator;
|
| + Stats() = default;
|
| + ~Stats() = default;
|
| +
|
| + // Creates a FrameStatistic for the next frame to be processed.
|
| + FrameStatistic* AddFrame();
|
|
|
| - Stats();
|
| - virtual ~Stats();
|
| + // Returns the FrameStatistic corresponding to |frame_number|.
|
| + FrameStatistic* GetFrame(int frame_number);
|
|
|
| - // Add a new statistic data object.
|
| - // The |frame_number| must be incrementing and start at zero in order to use
|
| - // it as an index for the FrameStatistic vector.
|
| - // Returns the newly created statistic object.
|
| - FrameStatistic& NewFrame(int frame_number);
|
| + size_t size() const;
|
|
|
| - // Prints a summary of all the statistics that have been gathered during the
|
| - // processing.
|
| - void PrintSummary();
|
| + // TODO(brandtr): Add output as CSV.
|
| + void PrintSummary() const;
|
|
|
| + private:
|
| std::vector<FrameStatistic> stats_;
|
| };
|
|
|
|
|