diff --git a/test/configurable_frame_size_encoder.cc b/test/configurable_frame_size_encoder.cc index f037b9824d..071845f24a 100644 --- a/test/configurable_frame_size_encoder.cc +++ b/test/configurable_frame_size_encoder.cc @@ -54,7 +54,9 @@ int32_t ConfigurableFrameSizeEncoder::Encode( CodecSpecificInfo specific{}; specific.codecType = codec_type_; callback_->OnEncodedImage(encodedImage, &specific, fragmentation); - + if (post_encode_callback_) { + (*post_encode_callback_)(); + } return WEBRTC_VIDEO_CODEC_OK; } @@ -89,5 +91,10 @@ void ConfigurableFrameSizeEncoder::SetCodecType(VideoCodecType codec_type) { codec_type_ = codec_type; } +void ConfigurableFrameSizeEncoder::RegisterPostEncodeCallback( + std::function post_encode_callback) { + post_encode_callback_ = std::move(post_encode_callback); +} + } // namespace test } // namespace webrtc diff --git a/test/configurable_frame_size_encoder.h b/test/configurable_frame_size_encoder.h index 1dc9e48f47..03dc149018 100644 --- a/test/configurable_frame_size_encoder.h +++ b/test/configurable_frame_size_encoder.h @@ -46,8 +46,13 @@ class ConfigurableFrameSizeEncoder : public VideoEncoder { void SetCodecType(VideoCodecType codec_type_); + void RegisterPostEncodeCallback( + std::function post_encode_callback); + private: EncodedImageCallback* callback_; + absl::optional> post_encode_callback_; + const size_t max_frame_size_; size_t current_frame_size_; std::unique_ptr buffer_; diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc index 0e3ca72186..76bd227f1b 100644 --- a/video/video_send_stream_tests.cc +++ b/video/video_send_stream_tests.cc @@ -17,7 +17,6 @@ #include "call/fake_network_pipe.h" #include "call/rtp_transport_controller_send.h" #include "call/simulated_network.h" -#include "common_video/include/frame_callback.h" #include "modules/rtp_rtcp/include/rtp_header_parser.h" #include "modules/rtp_rtcp/include/rtp_rtcp.h" #include "modules/rtp_rtcp/source/rtcp_sender.h" @@ -964,8 +963,7 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format, // Observer that verifies that the expected number of packets and bytes // arrive for each frame size, from start_size to stop_size. - class FrameFragmentationTest : public test::SendTest, - public EncodedFrameObserver { + class FrameFragmentationTest : public test::SendTest { public: FrameFragmentationTest(size_t max_packet_size, size_t start_size, @@ -1101,7 +1099,7 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format, } } - void EncodedFrameCallback(const EncodedFrame& encoded_frame) override { + void UpdateConfiguration() { rtc::CritScope lock(&mutex_); // Increase frame size for next encoded frame, in the context of the // encoder thread. @@ -1132,7 +1130,7 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format, send_config->encoder_settings.encoder_factory = &encoder_factory_; send_config->rtp.max_packet_size = kMaxPacketSize; - send_config->post_encode_callback = this; + encoder_.RegisterPostEncodeCallback([this]() { UpdateConfiguration(); }); // Make sure there is at least one extension header, to make the RTP // header larger than the base length of 12 bytes.