Pass Environment when creating VideoDecoder in VideoReceiveStream2

Bug: webrtc:15791
Change-Id: Ic646d6303bab1d28057258707aaa3c3e75ac9454
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/335820
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41613}
This commit is contained in:
Danil Chapovalov 2024-01-23 13:02:46 +01:00 committed by WebRTC LUCI CQ
parent ac58a334f7
commit 0817380a56
2 changed files with 7 additions and 9 deletions

View File

@ -519,7 +519,7 @@ void VideoReceiveStream2::CreateAndRegisterExternalDecoder(
TRACE_EVENT0("webrtc",
"VideoReceiveStream2::CreateAndRegisterExternalDecoder");
std::unique_ptr<VideoDecoder> video_decoder =
config_.decoder_factory->CreateVideoDecoder(decoder.video_format);
config_.decoder_factory->Create(env_, decoder.video_format);
// If we still have no valid decoder, we have to create a "Null" decoder
// that ignores all calls. The reason we can get into this state is that the
// old decoder factory interface doesn't have a way to query supported

View File

@ -205,10 +205,9 @@ class VideoReceiveStream2Test : public ::testing::TestWithParam<bool> {
time_controller_.GetMainThread()),
h264_decoder_factory_(&mock_decoder_) {
// By default, mock decoder factory is backed by VideoDecoderProxyFactory.
ON_CALL(mock_h264_decoder_factory_, CreateVideoDecoder)
.WillByDefault(
Invoke(&h264_decoder_factory_,
&test::VideoDecoderProxyFactory::CreateVideoDecoder));
ON_CALL(mock_h264_decoder_factory_, Create)
.WillByDefault(Invoke(&h264_decoder_factory_,
&test::VideoDecoderProxyFactory::Create));
// By default, mock decode will wrap the fake decoder.
ON_CALL(mock_decoder_, Configure)
@ -459,7 +458,7 @@ TEST_P(VideoReceiveStream2Test, LazyDecoderCreation) {
rtppacket.SetTimestamp(0);
// No decoders are created by default.
EXPECT_CALL(mock_h264_decoder_factory_, CreateVideoDecoder(_)).Times(0);
EXPECT_CALL(mock_h264_decoder_factory_, Create).Times(0);
video_receive_stream_->Start();
time_controller_.AdvanceTime(TimeDelta::Zero());
@ -467,9 +466,8 @@ TEST_P(VideoReceiveStream2Test, LazyDecoderCreation) {
testing::Mock::VerifyAndClearExpectations(&mock_h264_decoder_factory_));
// Verify that the decoder is created when we receive payload data and tries
// to decode a frame.
EXPECT_CALL(
mock_h264_decoder_factory_,
CreateVideoDecoder(Field(&SdpVideoFormat::name, testing::Eq("H264"))));
EXPECT_CALL(mock_h264_decoder_factory_,
Create(_, Field(&SdpVideoFormat::name, Eq("H264"))));
EXPECT_CALL(mock_decoder_, Configure);
EXPECT_CALL(mock_decoder_, RegisterDecodeCompleteCallback);
EXPECT_CALL(mock_decoder_, Decode(_, _));