Index: webrtc/modules/video_coding/codecs/test/videoprocessor.h |
diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor.h b/webrtc/modules/video_coding/codecs/test/videoprocessor.h |
index bae877e4686805c2b12f9a71a6f0ca25e3812ed3..4a3fa114c56bab46e7bcb21128ded2642517a566 100644 |
--- a/webrtc/modules/video_coding/codecs/test/videoprocessor.h |
+++ b/webrtc/modules/video_coding/codecs/test/videoprocessor.h |
@@ -11,6 +11,7 @@ |
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |
+#include <map> |
#include <memory> |
#include <string> |
#include <vector> |
@@ -113,12 +114,6 @@ struct TestConfig { |
// If HW or SW codec should be used. |
bool hw_codec = false; |
- |
- // In batch mode, the VideoProcessor is fed all the frames for processing |
- // before any metrics are calculated. This is useful for pipelining HW codecs, |
- // for which some calculated metrics otherwise would be incorrect. The |
- // downside with batch mode is that mid-test rate allocation is not supported. |
- bool batch_mode = false; |
}; |
// Handles encoding/decoding of video using the VideoEncoder/VideoDecoder |
@@ -165,18 +160,18 @@ class VideoProcessor { |
// Updates the encoder with target rates. Must be called at least once. |
void SetRates(int bitrate_kbps, int framerate_fps); |
- |
// TODO(brandtr): Get rid of these functions by moving the corresponding QP |
// fields to the Stats object. |
int GetQpFromEncoder(int frame_number) const; |
int GetQpFromBitstream(int frame_number) const; |
+ // Returns the number of dropped frames. |
+ std::vector<int> NumberDroppedFramesPerRateUpdate() const; |
- // Return the number of dropped frames. |
- int NumberDroppedFrames(); |
+ // Returns the number of spatial resizes. |
+ std::vector<int> NumberSpatialResizesPerRateUpdate() const; |
- // Return the number of spatial resizes. |
- int NumberSpatialResizes(); |
+ int LastDecodedFrameNumber() const; |
private: |
// Container that holds per-frame information that needs to be stored between |
@@ -296,14 +291,7 @@ class VideoProcessor { |
// Invoked by the callback adapter when a frame has completed decoding. |
void FrameDecoded(const webrtc::VideoFrame& image); |
- // Use the frame number as the basis for timestamp to identify frames. Let the |
- // first timestamp be non-zero, to not make the IvfFileWriter believe that we |
- // want to use capture timestamps in the IVF files. |
- uint32_t FrameNumberToTimestamp(int frame_number) const; |
- int TimestampToFrameNumber(uint32_t timestamp) const; |
- |
bool initialized_ GUARDED_BY(sequence_checker_); |
- |
TestConfig config_ GUARDED_BY(sequence_checker_); |
webrtc::VideoEncoder* const encoder_; |
@@ -336,6 +324,11 @@ class VideoProcessor { |
int last_encoded_frame_num_ GUARDED_BY(sequence_checker_); |
int last_decoded_frame_num_ GUARDED_BY(sequence_checker_); |
+ // Store an RTP timestamp -> frame number map, since the timestamps are |
+ // based off of the frame rate, which can change mid-test. |
+ std::map<uint32_t, int> rtp_timestamp_to_frame_num_ |
+ GUARDED_BY(sequence_checker_); |
+ |
// Keep track of if we have excluded the first key frame from packet loss. |
bool first_key_frame_has_been_excluded_ GUARDED_BY(sequence_checker_); |
@@ -345,8 +338,9 @@ class VideoProcessor { |
// Statistics. |
Stats* stats_; |
- int num_dropped_frames_ GUARDED_BY(sequence_checker_); |
- int num_spatial_resizes_ GUARDED_BY(sequence_checker_); |
+ std::vector<int> num_dropped_frames_ GUARDED_BY(sequence_checker_); |
+ std::vector<int> num_spatial_resizes_ GUARDED_BY(sequence_checker_); |
+ int rate_update_index_ GUARDED_BY(sequence_checker_); |
rtc::SequencedTaskChecker sequence_checker_; |