#include "third_party/blink/renderer/platform/peerconnection/stats_collecting_encoder.h"
#include <optional>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/test/task_environment.h"
#include "testing/gmock/include/gmock/gmock.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_bitrate_allocation.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_encoder.h"
#include "third_party/webrtc/modules/video_coding/include/video_error_codes.h"
namespace blink {
namespace {
constexpr float kMinEncodingTimeMs = …;
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 FakeVideoFrameBuffer : public webrtc::VideoFrameBuffer { … };
webrtc::VideoFrame CreateMockFrame(int width, int height, uint32_t timestamp) { … }
class MockEncoder : public webrtc::VideoEncoder { … };
class FakeEncodedImageCallback : public webrtc::EncodedImageCallback { … };
class StatsCollectingEncoderTest : public ::testing::Test { … };
TEST_F(StatsCollectingEncoderTest, StoreProcessingStatsCallbackHdSw) { … }
TEST_F(StatsCollectingEncoderTest, StoreProcessingStatsCallbackFullHdHw) { … }
TEST_F(StatsCollectingEncoderTest,
StoreProcessingStatsCallbackFullHdSwSpatialLayers) { … }
TEST_F(StatsCollectingEncoderTest,
CollectionStopsIfThereAreMultipleEncodersActive) { … }
TEST_F(StatsCollectingEncoderTest, CollectionStartsAgainIfOneEncoderIsActive) { … }
TEST_F(StatsCollectingEncoderTest, NoCollectionAfter40000Frames) { … }
TEST_F(StatsCollectingEncoderTest, MethodCallsForwardedToInternalEncoder) { … }
}
}