Pass webrtc::Environment when constructing video encoders in video/ tests
Bug: webrtc:15860 Change-Id: I44725bddfb5c80d94ad29406c2b0cab013595ce3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/343762 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41954}
This commit is contained in:
parent
426b5e7ea1
commit
be9d13a305
@ -121,6 +121,18 @@ std::vector<SdpVideoFormat> SupportedH264DecoderCodecs() {
|
|||||||
return supportedCodecs;
|
return supportedCodecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
H264EncoderSettings H264EncoderSettings::Parse(const SdpVideoFormat& format) {
|
||||||
|
if (auto it = format.parameters.find(cricket::kH264FmtpPacketizationMode);
|
||||||
|
it != format.parameters.end()) {
|
||||||
|
if (it->second == "0") {
|
||||||
|
return {.packetization_mode = H264PacketizationMode::SingleNalUnit};
|
||||||
|
} else if (it->second == "1") {
|
||||||
|
return {.packetization_mode = H264PacketizationMode::NonInterleaved};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
absl::Nonnull<std::unique_ptr<VideoEncoder>> CreateH264Encoder(
|
absl::Nonnull<std::unique_ptr<VideoEncoder>> CreateH264Encoder(
|
||||||
const Environment& env,
|
const Environment& env,
|
||||||
H264EncoderSettings settings) {
|
H264EncoderSettings settings) {
|
||||||
|
|||||||
@ -64,6 +64,10 @@ class RTC_EXPORT H264Encoder : public VideoEncoder {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct H264EncoderSettings {
|
struct H264EncoderSettings {
|
||||||
|
// Use factory function rather than constructor to allow to create
|
||||||
|
// `H264EncoderSettings` with designated initializers.
|
||||||
|
static H264EncoderSettings Parse(const SdpVideoFormat& format);
|
||||||
|
|
||||||
H264PacketizationMode packetization_mode =
|
H264PacketizationMode packetization_mode =
|
||||||
H264PacketizationMode::NonInterleaved;
|
H264PacketizationMode::NonInterleaved;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -123,7 +123,9 @@ class CodecObserver : public test::EndToEndTest,
|
|||||||
|
|
||||||
TEST_F(CodecEndToEndTest, SendsAndReceivesVP8) {
|
TEST_F(CodecEndToEndTest, SendsAndReceivesVP8) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
test::FunctionVideoDecoderFactory decoder_factory(
|
test::FunctionVideoDecoderFactory decoder_factory(
|
||||||
[](const Environment& env, const SdpVideoFormat& format) {
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
return CreateVp8Decoder(env);
|
return CreateVp8Decoder(env);
|
||||||
@ -135,7 +137,9 @@ TEST_F(CodecEndToEndTest, SendsAndReceivesVP8) {
|
|||||||
|
|
||||||
TEST_F(CodecEndToEndTest, SendsAndReceivesVP8Rotation90) {
|
TEST_F(CodecEndToEndTest, SendsAndReceivesVP8Rotation90) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
test::FunctionVideoDecoderFactory decoder_factory(
|
test::FunctionVideoDecoderFactory decoder_factory(
|
||||||
[](const Environment& env, const SdpVideoFormat& format) {
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
return CreateVp8Decoder(env);
|
return CreateVp8Decoder(env);
|
||||||
@ -148,7 +152,9 @@ TEST_F(CodecEndToEndTest, SendsAndReceivesVP8Rotation90) {
|
|||||||
#if defined(RTC_ENABLE_VP9)
|
#if defined(RTC_ENABLE_VP9)
|
||||||
TEST_F(CodecEndToEndTest, SendsAndReceivesVP9) {
|
TEST_F(CodecEndToEndTest, SendsAndReceivesVP9) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP9Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp9Encoder(env);
|
||||||
|
});
|
||||||
test::FunctionVideoDecoderFactory decoder_factory(
|
test::FunctionVideoDecoderFactory decoder_factory(
|
||||||
[]() { return VP9Decoder::Create(); });
|
[]() { return VP9Decoder::Create(); });
|
||||||
CodecObserver test(500, kVideoRotation_0, absl::nullopt, "VP9",
|
CodecObserver test(500, kVideoRotation_0, absl::nullopt, "VP9",
|
||||||
@ -158,7 +164,9 @@ TEST_F(CodecEndToEndTest, SendsAndReceivesVP9) {
|
|||||||
|
|
||||||
TEST_F(CodecEndToEndTest, SendsAndReceivesVP9VideoRotation90) {
|
TEST_F(CodecEndToEndTest, SendsAndReceivesVP9VideoRotation90) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP9Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp9Encoder(env);
|
||||||
|
});
|
||||||
test::FunctionVideoDecoderFactory decoder_factory(
|
test::FunctionVideoDecoderFactory decoder_factory(
|
||||||
[]() { return VP9Decoder::Create(); });
|
[]() { return VP9Decoder::Create(); });
|
||||||
CodecObserver test(5, kVideoRotation_90, absl::nullopt, "VP9",
|
CodecObserver test(5, kVideoRotation_90, absl::nullopt, "VP9",
|
||||||
@ -168,7 +176,9 @@ TEST_F(CodecEndToEndTest, SendsAndReceivesVP9VideoRotation90) {
|
|||||||
|
|
||||||
TEST_F(CodecEndToEndTest, SendsAndReceivesVP9ExplicitColorSpace) {
|
TEST_F(CodecEndToEndTest, SendsAndReceivesVP9ExplicitColorSpace) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP9Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp9Encoder(env);
|
||||||
|
});
|
||||||
test::FunctionVideoDecoderFactory decoder_factory(
|
test::FunctionVideoDecoderFactory decoder_factory(
|
||||||
[]() { return VP9Decoder::Create(); });
|
[]() { return VP9Decoder::Create(); });
|
||||||
CodecObserver test(5, kVideoRotation_90,
|
CodecObserver test(5, kVideoRotation_90,
|
||||||
@ -180,7 +190,9 @@ TEST_F(CodecEndToEndTest, SendsAndReceivesVP9ExplicitColorSpace) {
|
|||||||
TEST_F(CodecEndToEndTest,
|
TEST_F(CodecEndToEndTest,
|
||||||
SendsAndReceivesVP9ExplicitColorSpaceWithHdrMetadata) {
|
SendsAndReceivesVP9ExplicitColorSpaceWithHdrMetadata) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP9Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp9Encoder(env);
|
||||||
|
});
|
||||||
test::FunctionVideoDecoderFactory decoder_factory(
|
test::FunctionVideoDecoderFactory decoder_factory(
|
||||||
[]() { return VP9Decoder::Create(); });
|
[]() { return VP9Decoder::Create(); });
|
||||||
CodecObserver test(5, kVideoRotation_90,
|
CodecObserver test(5, kVideoRotation_90,
|
||||||
@ -212,7 +224,9 @@ INSTANTIATE_TEST_SUITE_P(
|
|||||||
|
|
||||||
TEST_P(EndToEndTestH264, SendsAndReceivesH264) {
|
TEST_P(EndToEndTestH264, SendsAndReceivesH264) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return H264Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateH264Encoder(env);
|
||||||
|
});
|
||||||
test::FunctionVideoDecoderFactory decoder_factory(
|
test::FunctionVideoDecoderFactory decoder_factory(
|
||||||
[]() { return H264Decoder::Create(); });
|
[]() { return H264Decoder::Create(); });
|
||||||
CodecObserver test(500, kVideoRotation_0, absl::nullopt, "H264",
|
CodecObserver test(500, kVideoRotation_0, absl::nullopt, "H264",
|
||||||
@ -222,7 +236,9 @@ TEST_P(EndToEndTestH264, SendsAndReceivesH264) {
|
|||||||
|
|
||||||
TEST_P(EndToEndTestH264, SendsAndReceivesH264VideoRotation90) {
|
TEST_P(EndToEndTestH264, SendsAndReceivesH264VideoRotation90) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return H264Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateH264Encoder(env);
|
||||||
|
});
|
||||||
test::FunctionVideoDecoderFactory decoder_factory(
|
test::FunctionVideoDecoderFactory decoder_factory(
|
||||||
[]() { return H264Decoder::Create(); });
|
[]() { return H264Decoder::Create(); });
|
||||||
CodecObserver test(5, kVideoRotation_90, absl::nullopt, "H264",
|
CodecObserver test(5, kVideoRotation_90, absl::nullopt, "H264",
|
||||||
@ -231,11 +247,12 @@ TEST_P(EndToEndTestH264, SendsAndReceivesH264VideoRotation90) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(EndToEndTestH264, SendsAndReceivesH264PacketizationMode0) {
|
TEST_P(EndToEndTestH264, SendsAndReceivesH264PacketizationMode0) {
|
||||||
cricket::VideoCodec codec =
|
SdpVideoFormat codec(cricket::kH264CodecName);
|
||||||
cricket::CreateVideoCodec(cricket::kH264CodecName);
|
codec.parameters[cricket::kH264FmtpPacketizationMode] = "0";
|
||||||
codec.SetParam(cricket::kH264FmtpPacketizationMode, "0");
|
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[codec]() { return H264Encoder::Create(codec); });
|
[codec](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateH264Encoder(env, H264EncoderSettings::Parse(codec));
|
||||||
|
});
|
||||||
test::FunctionVideoDecoderFactory decoder_factory(
|
test::FunctionVideoDecoderFactory decoder_factory(
|
||||||
[]() { return H264Decoder::Create(); });
|
[]() { return H264Decoder::Create(); });
|
||||||
CodecObserver test(500, kVideoRotation_0, absl::nullopt, "H264",
|
CodecObserver test(500, kVideoRotation_0, absl::nullopt, "H264",
|
||||||
@ -244,11 +261,12 @@ TEST_P(EndToEndTestH264, SendsAndReceivesH264PacketizationMode0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(EndToEndTestH264, SendsAndReceivesH264PacketizationMode1) {
|
TEST_P(EndToEndTestH264, SendsAndReceivesH264PacketizationMode1) {
|
||||||
cricket::VideoCodec codec =
|
SdpVideoFormat codec(cricket::kH264CodecName);
|
||||||
cricket::CreateVideoCodec(cricket::kH264CodecName);
|
codec.parameters[cricket::kH264FmtpPacketizationMode] = "1";
|
||||||
codec.SetParam(cricket::kH264FmtpPacketizationMode, "1");
|
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[codec]() { return H264Encoder::Create(codec); });
|
[codec](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateH264Encoder(env, H264EncoderSettings::Parse(codec));
|
||||||
|
});
|
||||||
test::FunctionVideoDecoderFactory decoder_factory(
|
test::FunctionVideoDecoderFactory decoder_factory(
|
||||||
[]() { return H264Decoder::Create(); });
|
[]() { return H264Decoder::Create(); });
|
||||||
CodecObserver test(500, kVideoRotation_0, absl::nullopt, "H264",
|
CodecObserver test(500, kVideoRotation_0, absl::nullopt, "H264",
|
||||||
|
|||||||
@ -55,7 +55,10 @@ TEST_F(FecEndToEndTest, ReceivesUlpfec) {
|
|||||||
public:
|
public:
|
||||||
UlpfecRenderObserver()
|
UlpfecRenderObserver()
|
||||||
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
|
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
|
||||||
encoder_factory_([]() { return VP8Encoder::Create(); }),
|
encoder_factory_(
|
||||||
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
}),
|
||||||
random_(0xcafef00d1),
|
random_(0xcafef00d1),
|
||||||
num_packets_sent_(0) {}
|
num_packets_sent_(0) {}
|
||||||
|
|
||||||
@ -372,7 +375,10 @@ TEST_F(FecEndToEndTest, ReceivedUlpfecPacketsNotNacked) {
|
|||||||
ulpfec_sequence_number_(0),
|
ulpfec_sequence_number_(0),
|
||||||
has_last_sequence_number_(false),
|
has_last_sequence_number_(false),
|
||||||
last_sequence_number_(0),
|
last_sequence_number_(0),
|
||||||
encoder_factory_([]() { return VP8Encoder::Create(); }) {}
|
encoder_factory_(
|
||||||
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
}) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||||
|
|||||||
@ -31,7 +31,10 @@ class DecryptedFrameObserver : public test::EndToEndTest,
|
|||||||
public:
|
public:
|
||||||
DecryptedFrameObserver()
|
DecryptedFrameObserver()
|
||||||
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
|
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
|
||||||
encoder_factory_([] { return VP8Encoder::Create(); }) {}
|
encoder_factory_(
|
||||||
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
}) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ModifyVideoConfigs(
|
void ModifyVideoConfigs(
|
||||||
|
|||||||
@ -50,7 +50,10 @@ void HistogramTest::VerifyHistogramStats(bool use_rtx,
|
|||||||
use_fec_(use_fec),
|
use_fec_(use_fec),
|
||||||
screenshare_(screenshare),
|
screenshare_(screenshare),
|
||||||
// This test uses NACK, so to send FEC we can't use a fake encoder.
|
// This test uses NACK, so to send FEC we can't use a fake encoder.
|
||||||
encoder_factory_([]() { return VP8Encoder::Create(); }),
|
encoder_factory_(
|
||||||
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
}),
|
||||||
num_frames_received_(0) {}
|
num_frames_received_(0) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -202,13 +202,13 @@ void MultiCodecReceiveTest::RunTestWithCodecs(
|
|||||||
[](const Environment& env,
|
[](const Environment& env,
|
||||||
const SdpVideoFormat& format) -> std::unique_ptr<VideoEncoder> {
|
const SdpVideoFormat& format) -> std::unique_ptr<VideoEncoder> {
|
||||||
if (format.name == "VP8") {
|
if (format.name == "VP8") {
|
||||||
return VP8Encoder::Create();
|
return CreateVp8Encoder(env);
|
||||||
}
|
}
|
||||||
if (format.name == "VP9") {
|
if (format.name == "VP9") {
|
||||||
return VP9Encoder::Create();
|
return CreateVp9Encoder(env);
|
||||||
}
|
}
|
||||||
if (format.name == "H264") {
|
if (format.name == "H264") {
|
||||||
return H264Encoder::Create();
|
return CreateH264Encoder(env);
|
||||||
}
|
}
|
||||||
RTC_DCHECK_NOTREACHED() << format.name;
|
RTC_DCHECK_NOTREACHED() << format.name;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@ -58,7 +58,9 @@ void MultiStreamTester::RunTest() {
|
|||||||
VideoReceiveStreamInterface* receive_streams[kNumStreams];
|
VideoReceiveStreamInterface* receive_streams[kNumStreams];
|
||||||
test::FrameGeneratorCapturer* frame_generators[kNumStreams];
|
test::FrameGeneratorCapturer* frame_generators[kNumStreams];
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
std::unique_ptr<VideoBitrateAllocatorFactory> bitrate_allocator_factory =
|
std::unique_ptr<VideoBitrateAllocatorFactory> bitrate_allocator_factory =
|
||||||
CreateBuiltinVideoBitrateAllocatorFactory();
|
CreateBuiltinVideoBitrateAllocatorFactory();
|
||||||
InternalDecoderFactory decoder_factory;
|
InternalDecoderFactory decoder_factory;
|
||||||
|
|||||||
@ -372,7 +372,10 @@ void RetransmissionEndToEndTest::DecodesRetransmittedFrame(bool enable_rtx,
|
|||||||
enable_rtx ? test::VideoTestConstants::kSendRtxSsrcs[0]
|
enable_rtx ? test::VideoTestConstants::kSendRtxSsrcs[0]
|
||||||
: test::VideoTestConstants::kVideoSendSsrcs[0]),
|
: test::VideoTestConstants::kVideoSendSsrcs[0]),
|
||||||
retransmission_payload_type_(GetPayloadType(enable_rtx, enable_red)),
|
retransmission_payload_type_(GetPayloadType(enable_rtx, enable_red)),
|
||||||
encoder_factory_([]() { return VP8Encoder::Create(); }),
|
encoder_factory_(
|
||||||
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
}),
|
||||||
marker_bits_observed_(0),
|
marker_bits_observed_(0),
|
||||||
retransmitted_timestamp_(0) {}
|
retransmitted_timestamp_(0) {}
|
||||||
|
|
||||||
|
|||||||
@ -467,7 +467,9 @@ TEST_F(RtpRtcpEndToEndTest, DISABLED_TestFlexfecRtpStatePreservation) {
|
|||||||
static constexpr int kFrameRate = 15;
|
static constexpr int kFrameRate = 15;
|
||||||
|
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
|
|
||||||
SendTask(task_queue(), [&]() {
|
SendTask(task_queue(), [&]() {
|
||||||
CreateCalls();
|
CreateCalls();
|
||||||
|
|||||||
@ -363,7 +363,9 @@ void PictureIdTest::TestPictureIdIncreaseAfterRecreateStreams(
|
|||||||
|
|
||||||
TEST_P(PictureIdTest, ContinuousAfterReconfigureVp8) {
|
TEST_P(PictureIdTest, ContinuousAfterReconfigureVp8) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
SetupEncoder(&encoder_factory, "VP8");
|
SetupEncoder(&encoder_factory, "VP8");
|
||||||
TestPictureIdContinuousAfterReconfigure({1, 3, 3, 1, 1});
|
TestPictureIdContinuousAfterReconfigure({1, 3, 3, 1, 1});
|
||||||
}
|
}
|
||||||
@ -371,14 +373,18 @@ TEST_P(PictureIdTest, ContinuousAfterReconfigureVp8) {
|
|||||||
// TODO(bugs.webrtc.org/14985): Investigate and reenable.
|
// TODO(bugs.webrtc.org/14985): Investigate and reenable.
|
||||||
TEST_P(PictureIdTest, DISABLED_IncreasingAfterRecreateStreamVp8) {
|
TEST_P(PictureIdTest, DISABLED_IncreasingAfterRecreateStreamVp8) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
SetupEncoder(&encoder_factory, "VP8");
|
SetupEncoder(&encoder_factory, "VP8");
|
||||||
TestPictureIdIncreaseAfterRecreateStreams({1, 3, 3, 1, 1});
|
TestPictureIdIncreaseAfterRecreateStreams({1, 3, 3, 1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(PictureIdTest, ContinuousAfterStreamCountChangeVp8) {
|
TEST_P(PictureIdTest, ContinuousAfterStreamCountChangeVp8) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
// Make sure that the picture id is not reset if the stream count goes
|
// Make sure that the picture id is not reset if the stream count goes
|
||||||
// down and then up.
|
// down and then up.
|
||||||
SetupEncoder(&encoder_factory, "VP8");
|
SetupEncoder(&encoder_factory, "VP8");
|
||||||
@ -428,7 +434,9 @@ TEST_P(PictureIdTest, ContinuousAfterStreamCountChangeSimulcastEncoderAdapter) {
|
|||||||
// TODO(bugs.webrtc.org/14985): Investigate and reenable.
|
// TODO(bugs.webrtc.org/14985): Investigate and reenable.
|
||||||
TEST_P(PictureIdTest, DISABLED_IncreasingAfterRecreateStreamVp9) {
|
TEST_P(PictureIdTest, DISABLED_IncreasingAfterRecreateStreamVp9) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP9Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp9Encoder(env);
|
||||||
|
});
|
||||||
SetupEncoder(&encoder_factory, "VP9");
|
SetupEncoder(&encoder_factory, "VP9");
|
||||||
TestPictureIdIncreaseAfterRecreateStreams({1, 1});
|
TestPictureIdIncreaseAfterRecreateStreams({1, 1});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,11 +90,11 @@ class ScalingObserver : public test::SendTest {
|
|||||||
[](const Environment& env,
|
[](const Environment& env,
|
||||||
const SdpVideoFormat& format) -> std::unique_ptr<VideoEncoder> {
|
const SdpVideoFormat& format) -> std::unique_ptr<VideoEncoder> {
|
||||||
if (format.name == "VP8")
|
if (format.name == "VP8")
|
||||||
return VP8Encoder::Create();
|
return CreateVp8Encoder(env);
|
||||||
if (format.name == "VP9")
|
if (format.name == "VP9")
|
||||||
return VP9Encoder::Create();
|
return CreateVp9Encoder(env);
|
||||||
if (format.name == "H264")
|
if (format.name == "H264")
|
||||||
return H264Encoder::Create();
|
return CreateH264Encoder(env);
|
||||||
RTC_DCHECK_NOTREACHED() << format.name;
|
RTC_DCHECK_NOTREACHED() << format.name;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -669,14 +669,18 @@ class UlpfecObserver : public test::EndToEndTest {
|
|||||||
|
|
||||||
TEST_F(VideoSendStreamTest, SupportsUlpfecWithExtensions) {
|
TEST_F(VideoSendStreamTest, SupportsUlpfecWithExtensions) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
UlpfecObserver test(true, false, true, true, "VP8", &encoder_factory);
|
UlpfecObserver test(true, false, true, true, "VP8", &encoder_factory);
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoSendStreamTest, SupportsUlpfecWithoutExtensions) {
|
TEST_F(VideoSendStreamTest, SupportsUlpfecWithoutExtensions) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
UlpfecObserver test(false, false, true, true, "VP8", &encoder_factory);
|
UlpfecObserver test(false, false, true, true, "VP8", &encoder_factory);
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
}
|
}
|
||||||
@ -692,7 +696,9 @@ class VideoSendStreamWithoutUlpfecTest : public test::CallTest {
|
|||||||
|
|
||||||
TEST_F(VideoSendStreamWithoutUlpfecTest, NoUlpfecIfDisabledThroughFieldTrial) {
|
TEST_F(VideoSendStreamWithoutUlpfecTest, NoUlpfecIfDisabledThroughFieldTrial) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
UlpfecObserver test(false, false, false, false, "VP8", &encoder_factory,
|
UlpfecObserver test(false, false, false, false, "VP8", &encoder_factory,
|
||||||
kReducedTimeout);
|
kReducedTimeout);
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
@ -722,7 +728,9 @@ TEST_F(VideoSendStreamTest, DoesUtilizeUlpfecForH264WithoutNackEnabled) {
|
|||||||
|
|
||||||
TEST_F(VideoSendStreamTest, DoesUtilizeUlpfecForVp8WithNackEnabled) {
|
TEST_F(VideoSendStreamTest, DoesUtilizeUlpfecForVp8WithNackEnabled) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
UlpfecObserver test(false, true, true, true, "VP8", &encoder_factory);
|
UlpfecObserver test(false, true, true, true, "VP8", &encoder_factory);
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
}
|
}
|
||||||
@ -730,7 +738,9 @@ TEST_F(VideoSendStreamTest, DoesUtilizeUlpfecForVp8WithNackEnabled) {
|
|||||||
#if defined(RTC_ENABLE_VP9)
|
#if defined(RTC_ENABLE_VP9)
|
||||||
TEST_F(VideoSendStreamTest, DoesUtilizeUlpfecForVp9WithNackEnabled) {
|
TEST_F(VideoSendStreamTest, DoesUtilizeUlpfecForVp9WithNackEnabled) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP9Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp9Encoder(env);
|
||||||
|
});
|
||||||
// Use kLongTimeout timeout because the test is flaky with kDefaultTimeout.
|
// Use kLongTimeout timeout because the test is flaky with kDefaultTimeout.
|
||||||
UlpfecObserver test(false, true, true, true, "VP9", &encoder_factory,
|
UlpfecObserver test(false, true, true, true, "VP9", &encoder_factory,
|
||||||
test::VideoTestConstants::kLongTimeout);
|
test::VideoTestConstants::kLongTimeout);
|
||||||
@ -865,28 +875,36 @@ class FlexfecObserver : public test::EndToEndTest {
|
|||||||
|
|
||||||
TEST_F(VideoSendStreamTest, SupportsFlexfecVp8) {
|
TEST_F(VideoSendStreamTest, SupportsFlexfecVp8) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
FlexfecObserver test(false, false, "VP8", &encoder_factory, 1);
|
FlexfecObserver test(false, false, "VP8", &encoder_factory, 1);
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoSendStreamTest, SupportsFlexfecSimulcastVp8) {
|
TEST_F(VideoSendStreamTest, SupportsFlexfecSimulcastVp8) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
FlexfecObserver test(false, false, "VP8", &encoder_factory, 2);
|
FlexfecObserver test(false, false, "VP8", &encoder_factory, 2);
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoSendStreamTest, SupportsFlexfecWithNackVp8) {
|
TEST_F(VideoSendStreamTest, SupportsFlexfecWithNackVp8) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
FlexfecObserver test(false, true, "VP8", &encoder_factory, 1);
|
FlexfecObserver test(false, true, "VP8", &encoder_factory, 1);
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoSendStreamTest, SupportsFlexfecWithRtpExtensionsVp8) {
|
TEST_F(VideoSendStreamTest, SupportsFlexfecWithRtpExtensionsVp8) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
FlexfecObserver test(true, false, "VP8", &encoder_factory, 1);
|
FlexfecObserver test(true, false, "VP8", &encoder_factory, 1);
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
}
|
}
|
||||||
@ -894,14 +912,18 @@ TEST_F(VideoSendStreamTest, SupportsFlexfecWithRtpExtensionsVp8) {
|
|||||||
#if defined(RTC_ENABLE_VP9)
|
#if defined(RTC_ENABLE_VP9)
|
||||||
TEST_F(VideoSendStreamTest, SupportsFlexfecVp9) {
|
TEST_F(VideoSendStreamTest, SupportsFlexfecVp9) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP9Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp9Encoder(env);
|
||||||
|
});
|
||||||
FlexfecObserver test(false, false, "VP9", &encoder_factory, 1);
|
FlexfecObserver test(false, false, "VP9", &encoder_factory, 1);
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoSendStreamTest, SupportsFlexfecWithNackVp9) {
|
TEST_F(VideoSendStreamTest, SupportsFlexfecWithNackVp9) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP9Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp9Encoder(env);
|
||||||
|
});
|
||||||
FlexfecObserver test(false, true, "VP9", &encoder_factory, 1);
|
FlexfecObserver test(false, true, "VP9", &encoder_factory, 1);
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
}
|
}
|
||||||
@ -2992,7 +3014,10 @@ class Vp9HeaderObserver : public test::SendTest {
|
|||||||
public:
|
public:
|
||||||
explicit Vp9HeaderObserver(const Vp9TestParams& params)
|
explicit Vp9HeaderObserver(const Vp9TestParams& params)
|
||||||
: SendTest(test::VideoTestConstants::kLongTimeout),
|
: SendTest(test::VideoTestConstants::kLongTimeout),
|
||||||
encoder_factory_([]() { return VP9Encoder::Create(); }),
|
encoder_factory_(
|
||||||
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp9Encoder(env);
|
||||||
|
}),
|
||||||
params_(params),
|
params_(params),
|
||||||
vp9_settings_(VideoEncoder::GetDefaultVp9Settings()) {}
|
vp9_settings_(VideoEncoder::GetDefaultVp9Settings()) {}
|
||||||
|
|
||||||
@ -4258,7 +4283,9 @@ TEST_F(VideoSendStreamTest, TestTemporalLayersVp8SimulcastWithDifferentNumTls) {
|
|||||||
|
|
||||||
TEST_F(VideoSendStreamTest, TestTemporalLayersVp8SimulcastWithoutSimAdapter) {
|
TEST_F(VideoSendStreamTest, TestTemporalLayersVp8SimulcastWithoutSimAdapter) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
|
|
||||||
TestTemporalLayers(&encoder_factory, "VP8",
|
TestTemporalLayers(&encoder_factory, "VP8",
|
||||||
/*num_temporal_layers=*/{2, 2},
|
/*num_temporal_layers=*/{2, 2},
|
||||||
@ -4308,7 +4335,9 @@ TEST_F(VideoSendStreamTest, TestScalabilityModeVp8SimulcastWithDifferentMode) {
|
|||||||
|
|
||||||
TEST_F(VideoSendStreamTest, TestScalabilityModeVp8SimulcastWithoutSimAdapter) {
|
TEST_F(VideoSendStreamTest, TestScalabilityModeVp8SimulcastWithoutSimAdapter) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP8Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp8Encoder(env);
|
||||||
|
});
|
||||||
|
|
||||||
TestTemporalLayers(&encoder_factory, "VP8",
|
TestTemporalLayers(&encoder_factory, "VP8",
|
||||||
/*num_temporal_layers=*/{},
|
/*num_temporal_layers=*/{},
|
||||||
@ -4317,7 +4346,9 @@ TEST_F(VideoSendStreamTest, TestScalabilityModeVp8SimulcastWithoutSimAdapter) {
|
|||||||
|
|
||||||
TEST_F(VideoSendStreamTest, TestTemporalLayersVp9) {
|
TEST_F(VideoSendStreamTest, TestTemporalLayersVp9) {
|
||||||
test::FunctionVideoEncoderFactory encoder_factory(
|
test::FunctionVideoEncoderFactory encoder_factory(
|
||||||
[]() { return VP9Encoder::Create(); });
|
[](const Environment& env, const SdpVideoFormat& format) {
|
||||||
|
return CreateVp9Encoder(env);
|
||||||
|
});
|
||||||
|
|
||||||
TestTemporalLayers(&encoder_factory, "VP9",
|
TestTemporalLayers(&encoder_factory, "VP9",
|
||||||
/*num_temporal_layers=*/{2},
|
/*num_temporal_layers=*/{2},
|
||||||
|
|||||||
@ -8956,19 +8956,20 @@ class VideoStreamEncoderWithRealEncoderTest
|
|||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
VideoStreamEncoderTest::SetUp();
|
VideoStreamEncoderTest::SetUp();
|
||||||
|
Environment env = CreateEnvironment(&field_trials_);
|
||||||
std::unique_ptr<VideoEncoder> encoder;
|
std::unique_ptr<VideoEncoder> encoder;
|
||||||
switch (codec_type_) {
|
switch (codec_type_) {
|
||||||
case kVideoCodecVP8:
|
case kVideoCodecVP8:
|
||||||
encoder = VP8Encoder::Create();
|
encoder = CreateVp8Encoder(env);
|
||||||
break;
|
break;
|
||||||
case kVideoCodecVP9:
|
case kVideoCodecVP9:
|
||||||
encoder = VP9Encoder::Create();
|
encoder = CreateVp9Encoder(env);
|
||||||
break;
|
break;
|
||||||
case kVideoCodecAV1:
|
case kVideoCodecAV1:
|
||||||
encoder = CreateLibaomAv1Encoder();
|
encoder = CreateLibaomAv1Encoder(env);
|
||||||
break;
|
break;
|
||||||
case kVideoCodecH264:
|
case kVideoCodecH264:
|
||||||
encoder = H264Encoder::Create();
|
encoder = CreateH264Encoder(env);
|
||||||
break;
|
break;
|
||||||
case kVideoCodecH265:
|
case kVideoCodecH265:
|
||||||
// TODO(bugs.webrtc.org/13485): Use a fake encoder
|
// TODO(bugs.webrtc.org/13485): Use a fake encoder
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user