#include "third_party/blink/renderer/platform/peerconnection/stats_collecting_decoder.h"
#include <optional>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/test/task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/webrtc/api/make_ref_counted.h"
#include "third_party/webrtc/api/video/i420_buffer.h"
#include "third_party/webrtc/api/video/video_frame.h"
#include "third_party/webrtc/api/video/video_frame_buffer.h"
#include "third_party/webrtc/api/video_codecs/video_decoder.h"
#include "third_party/webrtc/modules/video_coding/include/video_error_codes.h"
namespace blink {
namespace {
constexpr float kMinDecodingTimeMs = …;
constexpr float kExpectedP99ProcessingTimeMs = …;
constexpr float kP99ToleranceMs = …;
const webrtc::SdpVideoFormat kFormatVp9{ … };
constexpr media::VideoCodecProfile kCodecProfile = …;
constexpr int kHdWidth = …;
constexpr int kHdHeight = …;
constexpr int kFullHdWidth = …;
constexpr int kFullHdHeight = …;
constexpr int kFramerate = …;
constexpr int kFramesPerMinute = …;
constexpr int kKeyframeInterval = …;
class MockVideoFrameBuffer : public webrtc::VideoFrameBuffer { … };
webrtc::VideoFrame CreateMockFrame(int width, int height, uint32_t timestamp) { … }
class MockDecoder : public webrtc::VideoDecoder { … };
class MockDecodedImageCallback : public webrtc::DecodedImageCallback { … };
class StatsCollectingDecoderTest : public ::testing::Test { … };
TEST_F(StatsCollectingDecoderTest, StoreProcessingStatsCallbackHdSw) { … }
TEST_F(StatsCollectingDecoderTest, StoreProcessingStatsCallbackFullHdHw) { … }
TEST_F(StatsCollectingDecoderTest,
CollectionStopsIfThereAreMultipleDecodersActive) { … }
TEST_F(StatsCollectingDecoderTest, CollectionStartsAgainIfOneDecoderIsActive) { … }
TEST_F(StatsCollectingDecoderTest, NoCollectionAfter40000Frames) { … }
}
}