| 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..cc453fab17cf539d5b5bf2dcea081a860a0d09af 100644
|
| --- a/modules/video_coding/codecs/test/videoprocessor.cc
|
| +++ b/modules/video_coding/codecs/test/videoprocessor.cc
|
| @@ -12,6 +12,7 @@
|
|
|
| #include <string.h>
|
|
|
| +#include <algorithm>
|
| #include <limits>
|
| #include <memory>
|
| #include <utility>
|
| @@ -19,6 +20,7 @@
|
|
|
| #include "api/video/i420_buffer.h"
|
| #include "common_types.h" // NOLINT(build/include)
|
| +#include "common_video/h264/h264_common.h"
|
| #include "modules/video_coding/codecs/vp8/simulcast_rate_allocator.h"
|
| #include "modules/video_coding/include/video_codec_initializer.h"
|
| #include "modules/video_coding/utility/default_video_bitrate_allocator.h"
|
| @@ -108,6 +110,24 @@ 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) {
|
| + 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);
|
| +
|
| + RTC_CHECK(!nalu_indices.empty());
|
| +
|
| + size_t max_length = 0;
|
| + for (const webrtc::H264::NaluIndex& index : nalu_indices)
|
| + max_length = std::max(max_length, index.payload_size);
|
| +
|
| + return rtc::Optional<size_t>(max_length);
|
| +}
|
| +
|
| 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 +371,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) {
|
|
|