Chromium Code Reviews| Index: modules/video_coding/codecs/test/videoprocessor.cc |
| diff --git a/modules/video_coding/codecs/test/videoprocessor.cc b/modules/video_coding/codecs/test/videoprocessor.cc |
| index af5b4b35b5e75465823f89dbf0aaa5416568db21..d2a5b5df4f6f19f2c8ef9bd23215935d7300f534 100644 |
| --- a/modules/video_coding/codecs/test/videoprocessor.cc |
| +++ b/modules/video_coding/codecs/test/videoprocessor.cc |
| @@ -16,6 +16,7 @@ |
| #include <memory> |
| #include <utility> |
| #include <vector> |
| +#include <algorithm> |
|
brandtr
2017/09/26 09:19:13
Also sort the include order here.
ssilkin
2017/09/26 11:07:04
Done.
|
| #include "api/video/i420_buffer.h" |
| #include "common_types.h" // NOLINT(build/include) |
| @@ -108,6 +109,22 @@ void VerifyQpParser(const EncodedImage& encoded_frame, |
| EXPECT_EQ(encoded_frame.qp_, qp) << "Encoder QP != parsed bitstream QP."; |
| } |
| +rtc::Optional<size_t> GetMaxNaluLength(const EncodedImage& encoded_frame, |
| + const TestConfig& config) { |
|
brandtr
2017/09/26 09:19:13
To fix the indentation, you can run 'git cl format
ssilkin
2017/09/26 11:07:04
Great. I didn't know about that command.
|
| + if (config.codec_settings.codecType != kVideoCodecH264) |
| + return rtc::Optional<size_t>(); |
| + |
| + std::vector<webrtc::H264::NaluIndex> nalu_indices = |
| + webrtc::H264::FindNaluIndices(encoded_frame._buffer, |
| + encoded_frame._length); |
| + |
| + size_t maxLength = 0; |
|
brandtr
2017/09/26 09:19:13
We typically use snake_case for naming local varia
ssilkin
2017/09/26 11:07:04
Done.
|
| + for (const webrtc::H264::NaluIndex& index : nalu_indices) |
| + maxLength = std::max(maxLength, index.payload_size); |
| + |
| + return rtc::Optional<size_t>(maxLength); |
| +} |
| + |
| int GetElapsedTimeMicroseconds(int64_t start_ns, int64_t stop_ns) { |
| int64_t diff_us = (stop_ns - start_ns) / rtc::kNumNanosecsPerMicrosec; |
| RTC_DCHECK_GE(diff_us, std::numeric_limits<int>::min()); |
| @@ -351,6 +368,8 @@ void VideoProcessor::FrameEncoded(webrtc::VideoCodecType codec, |
| encoded_image._length / config_.networking_config.packet_size_in_bytes + |
| 1; |
| + frame_stat->max_nalu_length = GetMaxNaluLength(encoded_image, config_); |
| + |
| // Simulate packet loss. |
| bool exclude_this_frame = false; |
| if (encoded_image._frameType == kVideoFrameKey) { |