#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/peerconnection/video_encoder_state_observer_impl.h"
#include <queue>
#include "base/functional/bind.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "media/base/video_codecs.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/peerconnection/video_encoder_state_observer.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "third_party/webrtc/api/video/encoded_image.h"
#include "third_party/webrtc/api/video/video_content_type.h"
#include "third_party/webrtc/api/video/video_frame_type.h"
#include "third_party/webrtc/modules/video_coding/svc/scalability_mode_util.h"
namespace blink {
namespace {
constexpr int kWidth = …;
constexpr int kHeight = …;
webrtc::VideoCodec BasicVideoCodec(webrtc::VideoCodecType codec_type,
int width,
int height) { … }
void FillSimulcastStreams(webrtc::VideoCodec& video_codec,
unsigned int num_simulcast_streams,
unsigned int num_temporal_layers) { … }
webrtc::VideoCodec VP8VideoCodec(unsigned int num_simulcast_streams,
unsigned int num_temporal_layers,
int top_layer_width = kWidth,
int top_layer_height = kHeight) { … }
webrtc::VideoCodec CreateStreamCodec(const webrtc::VideoCodec& codec,
int stream_idx,
bool is_highest_quality_stream) { … }
void FillSpatialLayers(webrtc::VideoCodec& video_codec,
unsigned int num_spatial_layers,
unsigned int num_temporal_layers) { … }
webrtc::VideoCodec VP9kSVCVideoCodec(unsigned int num_spatial_layers,
unsigned int num_temporal_layers,
int top_layer_width = kWidth,
int top_layer_height = kHeight) { … }
template <typename T>
int PixelRate(const T& config) { … }
std::tuple<size_t, size_t, size_t> GetActiveIndexInfo(
const Vector<bool>& active_layers) { … }
}
class VideoEncoderStateObserverImplTest : public ::testing::Test { … };
TEST_F(VideoEncoderStateObserverImplTest,
FindHighestActiveEncoding_CreateAndDestroy_VP8Vanilla_SingleEncoder) { … }
TEST_F(VideoEncoderStateObserverImplTest,
FindHighestActiveEncoding_CreateAndDestroy_VP8Simulcast_SingleEncoder) { … }
TEST_F(
VideoEncoderStateObserverImplTest,
FindHighestActiveEncoding_CreateAndDestroy_VP8Simulcast_MultipleEncoders) { … }
TEST_F(VideoEncoderStateObserverImplTest,
FindHighestActiveEncoding_CreateAndDestroy_VP9kSVC_SingleEncoder) { … }
TEST_F(VideoEncoderStateObserverImplTest,
FindHighestActiveEncoding_ActivateLayers_VP9kSVC_SingleEncoder) { … }
TEST_F(VideoEncoderStateObserverImplTest,
FindHighestActiveEncoding_ActivateLayers_VP8Simulcast_MultipleEncoders) { … }
TEST_F(VideoEncoderStateObserverImplTest,
OnEncodedImage_VP8Simulcast_SingleEncoder) { … }
TEST_F(VideoEncoderStateObserverImplTest,
OnEncodedImage_VP8Simulcast_MultipleEncoders) { … }
TEST_F(VideoEncoderStateObserverImplTest,
OnEncodedImage_VP9kSVC_SingleEncoder) { … }
TEST_F(VideoEncoderStateObserverImplTest,
DynamicLayerChange_OnEncodedImage_VP9kSVC_SingleEncoder) { … }
}