diff --git a/api/BUILD.gn b/api/BUILD.gn index 4d6622f2c7..7e74c1a164 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -544,18 +544,6 @@ if (rtc_include_tests) { ] } - rtc_source_set("mock_video_bitrate_allocator_factory") { - testonly = true - sources = [ - "test/mock_video_bitrate_allocator_factory.h", - ] - - deps = [ - "../api/video:video_bitrate_allocator_factory", - "../test:test_support", - ] - } - rtc_source_set("mock_video_codec_factory") { testonly = true sources = [ diff --git a/api/test/mock_video_bitrate_allocator_factory.h b/api/test/mock_video_bitrate_allocator_factory.h deleted file mode 100644 index 0cae061ab7..0000000000 --- a/api/test/mock_video_bitrate_allocator_factory.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef API_TEST_MOCK_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_ -#define API_TEST_MOCK_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_ - -#include - -#include "api/video/video_bitrate_allocator_factory.h" -#include "test/gmock.h" - -namespace webrtc { - -class MockVideoBitrateAllocatorFactory - : public webrtc::VideoBitrateAllocatorFactory { - public: - virtual std::unique_ptr CreateVideoBitrateAllocator( - const VideoCodec& codec) { - return std::unique_ptr( - CreateVideoBitrateAllocatorProxy(codec)); - } - ~MockVideoBitrateAllocatorFactory() { Die(); } - MOCK_METHOD1(CreateVideoBitrateAllocatorProxy, - VideoBitrateAllocator*(const VideoCodec&)); - MOCK_METHOD0(Die, void()); -}; - -} // namespace webrtc - -#endif // API_TEST_MOCK_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_ diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn index b184dd1ab2..e3c4136148 100644 --- a/api/video/BUILD.gn +++ b/api/video/BUILD.gn @@ -174,7 +174,6 @@ rtc_source_set("video_stream_encoder") { ] deps = [ - ":video_bitrate_allocator_factory", ":video_frame", # For rtpparameters.h @@ -205,22 +204,3 @@ rtc_source_set("video_stream_encoder_create") { "//third_party/abseil-cpp/absl/memory", ] } - -rtc_static_library("builtin_video_bitrate_allocator_factory") { - visibility = [ "*" ] - sources = [ - "builtin_video_bitrate_allocator_factory.cc", - "builtin_video_bitrate_allocator_factory.h", - ] - - deps = [ - ":video_bitrate_allocation", - ":video_bitrate_allocator_factory", - "../../media:rtc_media_base", - "../../modules/video_coding:video_coding_utility", - "../../modules/video_coding:webrtc_vp9_helpers", - "../../rtc_base:ptr_util", - "../../rtc_base/system:fallthrough", - "//third_party/abseil-cpp/absl/memory", - ] -} diff --git a/api/video/video_stream_encoder_settings.h b/api/video/video_stream_encoder_settings.h index 37c1de7015..b67f33c982 100644 --- a/api/video/video_stream_encoder_settings.h +++ b/api/video/video_stream_encoder_settings.h @@ -11,7 +11,6 @@ #ifndef API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_ #define API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_ -#include "api/video/video_bitrate_allocator_factory.h" #include "api/video_codecs/video_encoder_factory.h" namespace webrtc { @@ -25,9 +24,6 @@ struct VideoStreamEncoderSettings { // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection). VideoEncoderFactory* encoder_factory = nullptr; - - // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection). - VideoBitrateAllocatorFactory* bitrate_allocator_factory = nullptr; }; } // namespace webrtc diff --git a/call/BUILD.gn b/call/BUILD.gn index 7e84dff4dc..0b65c3c60a 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -386,7 +386,6 @@ if (rtc_include_tests) { "..:webrtc_common", "../api:simulated_network_api", "../api/audio_codecs:builtin_audio_encoder_factory", - "../api/video:builtin_video_bitrate_allocator_factory", "../api/video:video_bitrate_allocation", "../api/video_codecs:video_codecs_api", "../logging:rtc_event_log_api", diff --git a/call/bitrate_estimator_tests.cc b/call/bitrate_estimator_tests.cc index 56b7c626a3..bab73e4814 100644 --- a/call/bitrate_estimator_tests.cc +++ b/call/bitrate_estimator_tests.cc @@ -126,8 +126,6 @@ class BitrateEstimatorTest : public test::CallTest { video_send_config.rtp.ssrcs.push_back(kVideoSendSsrcs[0]); video_send_config.encoder_settings.encoder_factory = &fake_encoder_factory_; - video_send_config.encoder_settings.bitrate_allocator_factory = - bitrate_allocator_factory_.get(); video_send_config.rtp.payload_name = "FAKE"; video_send_config.rtp.payload_type = kFakeVideoSendPayloadType; SetVideoSendConfig(video_send_config); diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc index f66527b604..acc6af0ed0 100644 --- a/call/call_perf_tests.cc +++ b/call/call_perf_tests.cc @@ -16,7 +16,6 @@ #include "absl/memory/memory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" #include "api/test/simulated_network.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video/video_bitrate_allocation.h" #include "api/video_codecs/video_encoder_config.h" #include "call/call.h" @@ -731,9 +730,7 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) { last_set_bitrate_kbps_(0), send_stream_(nullptr), frame_generator_(nullptr), - encoder_factory_(this), - bitrate_allocator_factory_( - CreateBuiltinVideoBitrateAllocatorFactory()) {} + encoder_factory_(this) {} int32_t InitEncode(const VideoCodec* config, int32_t number_of_cores, @@ -780,8 +777,6 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) { std::vector* receive_configs, VideoEncoderConfig* encoder_config) override { send_config->encoder_settings.encoder_factory = &encoder_factory_; - send_config->encoder_settings.bitrate_allocator_factory = - bitrate_allocator_factory_.get(); encoder_config->max_bitrate_bps = 2 * kReconfigureThresholdKbps * 1000; encoder_config->video_stream_factory = new rtc::RefCountedObject(); @@ -817,7 +812,6 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) { VideoSendStream* send_stream_; test::FrameGeneratorCapturer* frame_generator_; test::VideoEncoderProxyFactory encoder_factory_; - std::unique_ptr bitrate_allocator_factory_; VideoEncoderConfig encoder_config_; } test; diff --git a/examples/BUILD.gn b/examples/BUILD.gn index 6ad1b7f621..cd931b4beb 100644 --- a/examples/BUILD.gn +++ b/examples/BUILD.gn @@ -503,7 +503,6 @@ if (is_ios || (is_mac && target_cpu != "x86")) { "../api:libjingle_peerconnection_api", "../api/audio_codecs:builtin_audio_decoder_factory", "../api/audio_codecs:builtin_audio_encoder_factory", - "../api/video:builtin_video_bitrate_allocator_factory", "../logging:rtc_event_log_impl_base", "../media:rtc_audio_video", "../modules/audio_processing:audio_processing", diff --git a/examples/androidnativeapi/BUILD.gn b/examples/androidnativeapi/BUILD.gn index f63616a611..5568eb11dd 100644 --- a/examples/androidnativeapi/BUILD.gn +++ b/examples/androidnativeapi/BUILD.gn @@ -49,7 +49,6 @@ if (is_android) { "//api:libjingle_peerconnection_api", "//api/audio_codecs:builtin_audio_decoder_factory", "//api/audio_codecs:builtin_audio_encoder_factory", - "//api/video:builtin_video_bitrate_allocator_factory", "//logging:rtc_event_log_impl_base", "//media:rtc_audio_video", "//media:rtc_internal_video_codecs", diff --git a/examples/androidnativeapi/jni/androidcallclient.cc b/examples/androidnativeapi/jni/androidcallclient.cc index 747b3d9009..005f369a6d 100644 --- a/examples/androidnativeapi/jni/androidcallclient.cc +++ b/examples/androidnativeapi/jni/androidcallclient.cc @@ -16,7 +16,6 @@ #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" #include "api/peerconnectioninterface.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "examples/androidnativeapi/generated_jni/jni/CallClient_jni.h" #include "media/engine/internaldecoderfactory.h" #include "media/engine/internalencoderfactory.h" @@ -160,7 +159,6 @@ void AndroidCallClient::CreatePeerConnectionFactory() { webrtc::CreateBuiltinAudioDecoderFactory(), absl::make_unique(), absl::make_unique(), - webrtc::CreateBuiltinVideoBitrateAllocatorFactory(), nullptr /* audio_mixer */, webrtc::AudioProcessingBuilder().Create()); RTC_LOG(LS_INFO) << "Media engine created: " << media_engine.get(); diff --git a/examples/objcnativeapi/objc/objccallclient.mm b/examples/objcnativeapi/objc/objccallclient.mm index c7b2af4212..c384da3ef8 100644 --- a/examples/objcnativeapi/objc/objccallclient.mm +++ b/examples/objcnativeapi/objc/objccallclient.mm @@ -21,7 +21,6 @@ #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" #include "api/peerconnectioninterface.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "media/engine/webrtcmediaengine.h" #include "modules/audio_processing/include/audio_processing.h" #include "sdk/objc/native/api/video_capturer.h" @@ -117,16 +116,12 @@ void ObjCCallClient::CreatePeerConnectionFactory() { std::unique_ptr videoEncoderFactory = webrtc::ObjCToNativeVideoEncoderFactory([[RTCDefaultVideoEncoderFactory alloc] init]); - std::unique_ptr videoBitrateAllocatorFactory = - webrtc::CreateBuiltinVideoBitrateAllocatorFactory(); - std::unique_ptr media_engine = cricket::WebRtcMediaEngineFactory::Create(nullptr /* adm */, webrtc::CreateBuiltinAudioEncoderFactory(), webrtc::CreateBuiltinAudioDecoderFactory(), std::move(videoEncoderFactory), std::move(videoDecoderFactory), - std::move(videoBitrateAllocatorFactory), nullptr /* audio_mixer */, webrtc::AudioProcessingBuilder().Create()); RTC_LOG(LS_INFO) << "Media engine created: " << media_engine.get(); diff --git a/media/BUILD.gn b/media/BUILD.gn index bcebd3d65a..8eaa23ce02 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -278,7 +278,6 @@ rtc_static_library("rtc_audio_video") { defines = [] libs = [] deps = [ - "../api/video:video_bitrate_allocator_factory", "../modules/audio_processing/aec_dump:aec_dump", "../modules/video_coding:video_codec_interface", "../modules/video_coding:video_coding", @@ -627,13 +626,10 @@ if (rtc_include_tests) { ":rtc_vp9_profile", "../api:create_simulcast_test_fixture_api", "../api:libjingle_peerconnection_api", - "../api:mock_video_bitrate_allocator", - "../api:mock_video_bitrate_allocator_factory", "../api:mock_video_codec_factory", "../api:simulcast_test_fixture_api", "../api/audio_codecs:builtin_audio_decoder_factory", "../api/audio_codecs:builtin_audio_encoder_factory", - "../api/video:builtin_video_bitrate_allocator_factory", "../api/video:video_bitrate_allocation", "../api/video:video_frame", "../api/video_codecs:builtin_video_decoder_factory", diff --git a/media/engine/fakewebrtccall.cc b/media/engine/fakewebrtccall.cc index 8cb4e9d192..ce99b9c103 100644 --- a/media/engine/fakewebrtccall.cc +++ b/media/engine/fakewebrtccall.cc @@ -123,7 +123,6 @@ FakeVideoSendStream::FakeVideoSendStream( source_(nullptr), num_swapped_frames_(0) { RTC_DCHECK(config.encoder_settings.encoder_factory != nullptr); - RTC_DCHECK(config.encoder_settings.bitrate_allocator_factory != nullptr); ReconfigureVideoEncoder(std::move(encoder_config)); } diff --git a/media/engine/webrtcmediaengine.cc b/media/engine/webrtcmediaengine.cc index 87b9d2cfbc..e60c592a3f 100644 --- a/media/engine/webrtcmediaengine.cc +++ b/media/engine/webrtcmediaengine.cc @@ -15,7 +15,6 @@ #include #include -#include "api/video/video_bitrate_allocator_factory.h" #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_encoder_factory.h" #include "media/engine/webrtcvoiceengine.h" @@ -39,19 +38,15 @@ MediaEngineInterface* CreateWebRtcMediaEngine( audio_decoder_factory, WebRtcVideoEncoderFactory* video_encoder_factory, WebRtcVideoDecoderFactory* video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory, rtc::scoped_refptr audio_mixer, rtc::scoped_refptr audio_processing) { #ifdef HAVE_WEBRTC_VIDEO typedef WebRtcVideoEngine VideoEngine; std::tuple, - std::unique_ptr, - std::unique_ptr> + std::unique_ptr> video_args( (std::unique_ptr(video_encoder_factory)), - (std::unique_ptr(video_decoder_factory)), - (std::move(video_bitrate_allocator_factory))); + (std::unique_ptr(video_decoder_factory))); #else typedef NullWebRtcVideoEngine VideoEngine; std::tuple<> video_args; @@ -71,13 +66,11 @@ MediaEngineInterface* WebRtcMediaEngineFactory::Create( const rtc::scoped_refptr& audio_decoder_factory, WebRtcVideoEncoderFactory* video_encoder_factory, - WebRtcVideoDecoderFactory* video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory) { - return CreateWebRtcMediaEngine( - adm, audio_encoder_factory, audio_decoder_factory, video_encoder_factory, - video_decoder_factory, std::move(video_bitrate_allocator_factory), - nullptr, webrtc::AudioProcessingBuilder().Create()); + WebRtcVideoDecoderFactory* video_decoder_factory) { + return CreateWebRtcMediaEngine(adm, audio_encoder_factory, + audio_decoder_factory, video_encoder_factory, + video_decoder_factory, nullptr, + webrtc::AudioProcessingBuilder().Create()); } MediaEngineInterface* WebRtcMediaEngineFactory::Create( @@ -88,14 +81,11 @@ MediaEngineInterface* WebRtcMediaEngineFactory::Create( audio_decoder_factory, WebRtcVideoEncoderFactory* video_encoder_factory, WebRtcVideoDecoderFactory* video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory, rtc::scoped_refptr audio_mixer, rtc::scoped_refptr audio_processing) { return CreateWebRtcMediaEngine( adm, audio_encoder_factory, audio_decoder_factory, video_encoder_factory, - video_decoder_factory, std::move(video_bitrate_allocator_factory), - audio_mixer, audio_processing); + video_decoder_factory, audio_mixer, audio_processing); } #endif @@ -105,18 +95,14 @@ std::unique_ptr WebRtcMediaEngineFactory::Create( rtc::scoped_refptr audio_decoder_factory, std::unique_ptr video_encoder_factory, std::unique_ptr video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory, rtc::scoped_refptr audio_mixer, rtc::scoped_refptr audio_processing) { #ifdef HAVE_WEBRTC_VIDEO typedef WebRtcVideoEngine VideoEngine; std::tuple, - std::unique_ptr, - std::unique_ptr> + std::unique_ptr> video_args(std::move(video_encoder_factory), - std::move(video_decoder_factory), - std::move(video_bitrate_allocator_factory)); + std::move(video_decoder_factory)); #else typedef NullWebRtcVideoEngine VideoEngine; std::tuple<> video_args; diff --git a/media/engine/webrtcmediaengine.h b/media/engine/webrtcmediaengine.h index 1032003bc3..d82eccf9dc 100644 --- a/media/engine/webrtcmediaengine.h +++ b/media/engine/webrtcmediaengine.h @@ -25,7 +25,6 @@ class AudioMixer; class AudioProcessing; class VideoDecoderFactory; class VideoEncoderFactory; -class VideoBitrateAllocatorFactory; } // namespace webrtc namespace cricket { class WebRtcVideoDecoderFactory; @@ -50,9 +49,7 @@ class WebRtcMediaEngineFactory { const rtc::scoped_refptr& audio_decoder_factory, WebRtcVideoEncoderFactory* video_encoder_factory, - WebRtcVideoDecoderFactory* video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory); + WebRtcVideoDecoderFactory* video_decoder_factory); static MediaEngineInterface* Create( webrtc::AudioDeviceModule* adm, const rtc::scoped_refptr& @@ -61,8 +58,6 @@ class WebRtcMediaEngineFactory { audio_decoder_factory, WebRtcVideoEncoderFactory* video_encoder_factory, WebRtcVideoDecoderFactory* video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory, rtc::scoped_refptr audio_mixer, rtc::scoped_refptr apm); #endif @@ -76,8 +71,6 @@ class WebRtcMediaEngineFactory { rtc::scoped_refptr audio_decoder_factory, std::unique_ptr video_encoder_factory, std::unique_ptr video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory, rtc::scoped_refptr audio_mixer, rtc::scoped_refptr audio_processing); }; diff --git a/media/engine/webrtcmediaengine_unittest.cc b/media/engine/webrtcmediaengine_unittest.cc index 9a6a3722a6..4fa9a6b5ee 100644 --- a/media/engine/webrtcmediaengine_unittest.cc +++ b/media/engine/webrtcmediaengine_unittest.cc @@ -12,7 +12,6 @@ #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video_codecs/builtin_video_decoder_factory.h" #include "api/video_codecs/builtin_video_encoder_factory.h" #include "media/engine/webrtcmediaengine.h" @@ -245,9 +244,8 @@ TEST(WebRtcMediaEngineFactoryTest, CreateWithBuiltinDecoders) { nullptr /* adm */, webrtc::CreateBuiltinAudioEncoderFactory(), webrtc::CreateBuiltinAudioDecoderFactory(), webrtc::CreateBuiltinVideoEncoderFactory(), - webrtc::CreateBuiltinVideoDecoderFactory(), - webrtc::CreateBuiltinVideoBitrateAllocatorFactory(), - nullptr /* audio_mixer */, webrtc::AudioProcessingBuilder().Create())); + webrtc::CreateBuiltinVideoDecoderFactory(), nullptr /* audio_mixer */, + webrtc::AudioProcessingBuilder().Create())); EXPECT_TRUE(engine); } diff --git a/media/engine/webrtcvideoengine.cc b/media/engine/webrtcvideoengine.cc index 16e105cbc3..d0f12c04f8 100644 --- a/media/engine/webrtcvideoengine.cc +++ b/media/engine/webrtcvideoengine.cc @@ -437,26 +437,20 @@ void DefaultUnsignalledSsrcHandler::SetDefaultSink( #if defined(USE_BUILTIN_SW_CODECS) WebRtcVideoEngine::WebRtcVideoEngine( std::unique_ptr external_video_encoder_factory, - std::unique_ptr external_video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory) + std::unique_ptr external_video_decoder_factory) : decoder_factory_(ConvertVideoDecoderFactory( std::move(external_video_decoder_factory))), encoder_factory_(ConvertVideoEncoderFactory( - std::move(external_video_encoder_factory))), - bitrate_allocator_factory_(std::move(video_bitrate_allocator_factory)) { + std::move(external_video_encoder_factory))) { RTC_LOG(LS_INFO) << "WebRtcVideoEngine::WebRtcVideoEngine()"; } #endif WebRtcVideoEngine::WebRtcVideoEngine( std::unique_ptr video_encoder_factory, - std::unique_ptr video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory) + std::unique_ptr video_decoder_factory) : decoder_factory_(std::move(video_decoder_factory)), - encoder_factory_(std::move(video_encoder_factory)), - bitrate_allocator_factory_(std::move(video_bitrate_allocator_factory)) { + encoder_factory_(std::move(video_encoder_factory)) { RTC_LOG(LS_INFO) << "WebRtcVideoEngine::WebRtcVideoEngine()"; } @@ -471,8 +465,7 @@ WebRtcVideoChannel* WebRtcVideoEngine::CreateChannel( const webrtc::CryptoOptions& crypto_options) { RTC_LOG(LS_INFO) << "CreateChannel. Options: " << options.ToString(); return new WebRtcVideoChannel(call, config, options, crypto_options, - encoder_factory_.get(), decoder_factory_.get(), - bitrate_allocator_factory_.get()); + encoder_factory_.get(), decoder_factory_.get()); } std::vector WebRtcVideoEngine::codecs() const { @@ -523,15 +516,13 @@ WebRtcVideoChannel::WebRtcVideoChannel( const VideoOptions& options, const webrtc::CryptoOptions& crypto_options, webrtc::VideoEncoderFactory* encoder_factory, - webrtc::VideoDecoderFactory* decoder_factory, - webrtc::VideoBitrateAllocatorFactory* bitrate_allocator_factory) + webrtc::VideoDecoderFactory* decoder_factory) : VideoMediaChannel(config), call_(call), unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), video_config_(config.video), encoder_factory_(encoder_factory), decoder_factory_(decoder_factory), - bitrate_allocator_factory_(bitrate_allocator_factory), preferred_dscp_(rtc::DSCP_DEFAULT), default_send_options_(options), last_stats_log_ms_(-1), @@ -1078,8 +1069,6 @@ bool WebRtcVideoChannel::AddSendStream(const StreamParams& sp) { config.encoder_settings.experiment_cpu_load_estimator = video_config_.experiment_cpu_load_estimator; config.encoder_settings.encoder_factory = encoder_factory_; - config.encoder_settings.bitrate_allocator_factory = - bitrate_allocator_factory_; config.crypto_options = crypto_options_; config.rtp.extmap_allow_mixed = ExtmapAllowMixed(); diff --git a/media/engine/webrtcvideoengine.h b/media/engine/webrtcvideoengine.h index f2ef903203..083fc9f41d 100644 --- a/media/engine/webrtcvideoengine.h +++ b/media/engine/webrtcvideoengine.h @@ -19,7 +19,6 @@ #include "absl/types/optional.h" #include "api/call/transport.h" -#include "api/video/video_bitrate_allocator_factory.h" #include "api/video/video_frame.h" #include "api/video/video_sink_interface.h" #include "api/video/video_source_interface.h" @@ -85,18 +84,15 @@ class WebRtcVideoEngine { // Internal SW video codecs will be added on top of the external codecs. WebRtcVideoEngine( std::unique_ptr external_video_encoder_factory, - std::unique_ptr external_video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory); + std::unique_ptr + external_video_decoder_factory); #endif // These video codec factories represents all video codecs, i.e. both software // and external hardware codecs. WebRtcVideoEngine( std::unique_ptr video_encoder_factory, - std::unique_ptr video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory); + std::unique_ptr video_decoder_factory); virtual ~WebRtcVideoEngine(); @@ -112,20 +108,16 @@ class WebRtcVideoEngine { private: const std::unique_ptr decoder_factory_; const std::unique_ptr encoder_factory_; - const std::unique_ptr - bitrate_allocator_factory_; }; class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport { public: - WebRtcVideoChannel( - webrtc::Call* call, - const MediaConfig& config, - const VideoOptions& options, - const webrtc::CryptoOptions& crypto_options, - webrtc::VideoEncoderFactory* encoder_factory, - webrtc::VideoDecoderFactory* decoder_factory, - webrtc::VideoBitrateAllocatorFactory* bitrate_allocator_factory); + WebRtcVideoChannel(webrtc::Call* call, + const MediaConfig& config, + const VideoOptions& options, + const webrtc::CryptoOptions& crypto_options, + webrtc::VideoEncoderFactory* encoder_factory, + webrtc::VideoDecoderFactory* decoder_factory); ~WebRtcVideoChannel() override; // VideoMediaChannel implementation @@ -499,7 +491,6 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport { webrtc::VideoEncoderFactory* const encoder_factory_; webrtc::VideoDecoderFactory* const decoder_factory_; - webrtc::VideoBitrateAllocatorFactory* const bitrate_allocator_factory_; std::vector recv_codecs_; std::vector recv_rtp_extensions_; // See reason for keeping track of the FlexFEC payload type separately in diff --git a/media/engine/webrtcvideoengine_unittest.cc b/media/engine/webrtcvideoengine_unittest.cc index 9044bc6e66..36a0e14a38 100644 --- a/media/engine/webrtcvideoengine_unittest.cc +++ b/media/engine/webrtcvideoengine_unittest.cc @@ -16,12 +16,9 @@ #include "absl/strings/match.h" #include "api/rtpparameters.h" -#include "api/test/mock_video_bitrate_allocator.h" -#include "api/test/mock_video_bitrate_allocator_factory.h" #include "api/test/mock_video_decoder_factory.h" #include "api/test/mock_video_encoder_factory.h" #include "api/units/time_delta.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video/video_bitrate_allocation.h" #include "api/video_codecs/builtin_video_decoder_factory.h" #include "api/video_codecs/builtin_video_encoder_factory.h" @@ -217,8 +214,7 @@ class WebRtcVideoEngineTest : public ::testing::Test { engine_(std::unique_ptr( encoder_factory_), std::unique_ptr( - decoder_factory_), - webrtc::CreateBuiltinVideoBitrateAllocatorFactory()) { + decoder_factory_)) { // Ensure fake clock doesn't return 0, which will cause some initializations // fail inside RTP senders. fake_clock_.AdvanceTimeMicros(1); @@ -1013,10 +1009,8 @@ TEST_F(WebRtcVideoEngineTest, GetSourcesWithNonExistingSsrc) { TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, NullFactories) { std::unique_ptr encoder_factory; std::unique_ptr decoder_factory; - std::unique_ptr rate_allocator_factory; WebRtcVideoEngine engine(std::move(encoder_factory), - std::move(decoder_factory), - std::move(rate_allocator_factory)); + std::move(decoder_factory)); EXPECT_EQ(0u, engine.codecs().size()); } @@ -1026,18 +1020,13 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, EmptyFactories) { new webrtc::MockVideoEncoderFactory(); webrtc::MockVideoDecoderFactory* decoder_factory = new webrtc::MockVideoDecoderFactory(); - webrtc::MockVideoBitrateAllocatorFactory* rate_allocator_factory = - new webrtc::MockVideoBitrateAllocatorFactory(); WebRtcVideoEngine engine( (std::unique_ptr(encoder_factory)), - (std::unique_ptr(decoder_factory)), - (std::unique_ptr( - rate_allocator_factory))); + (std::unique_ptr(decoder_factory))); EXPECT_CALL(*encoder_factory, GetSupportedFormats()); EXPECT_EQ(0u, engine.codecs().size()); EXPECT_CALL(*encoder_factory, Die()); EXPECT_CALL(*decoder_factory, Die()); - EXPECT_CALL(*rate_allocator_factory, Die()); } // Test full behavior in the video engine when video codec factories of the new @@ -1050,17 +1039,9 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, Vp8) { new webrtc::MockVideoEncoderFactory(); webrtc::MockVideoDecoderFactory* decoder_factory = new webrtc::MockVideoDecoderFactory(); - webrtc::MockVideoBitrateAllocatorFactory* rate_allocator_factory = - new webrtc::MockVideoBitrateAllocatorFactory(); - EXPECT_CALL(*rate_allocator_factory, - CreateVideoBitrateAllocatorProxy(Field( - &webrtc::VideoCodec::codecType, webrtc::kVideoCodecVP8))) - .WillOnce(testing::Return(new webrtc::MockVideoBitrateAllocator())); WebRtcVideoEngine engine( (std::unique_ptr(encoder_factory)), - (std::unique_ptr(decoder_factory)), - (std::unique_ptr( - rate_allocator_factory))); + (std::unique_ptr(decoder_factory))); const webrtc::SdpVideoFormat vp8_format("VP8"); const std::vector supported_formats = {vp8_format}; EXPECT_CALL(*encoder_factory, GetSupportedFormats()) @@ -1156,7 +1137,6 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, Vp8) { // Remove streams previously added to free the encoder and decoder instance. EXPECT_CALL(*encoder_factory, Die()); EXPECT_CALL(*decoder_factory, Die()); - EXPECT_CALL(*rate_allocator_factory, Die()); EXPECT_TRUE(send_channel->RemoveSendStream(send_ssrc)); EXPECT_TRUE(recv_channel->RemoveRecvStream(recv_ssrc)); } @@ -1165,16 +1145,12 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, Vp8) { TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, NullDecoder) { // |engine| take ownership of the factories. webrtc::MockVideoEncoderFactory* encoder_factory = - new webrtc::MockVideoEncoderFactory(); + new testing::StrictMock(); webrtc::MockVideoDecoderFactory* decoder_factory = - new webrtc::MockVideoDecoderFactory(); - webrtc::MockVideoBitrateAllocatorFactory* rate_allocator_factory = - new webrtc::MockVideoBitrateAllocatorFactory(); + new testing::StrictMock(); WebRtcVideoEngine engine( (std::unique_ptr(encoder_factory)), - (std::unique_ptr(decoder_factory)), - (std::unique_ptr( - rate_allocator_factory))); + (std::unique_ptr(decoder_factory))); const webrtc::SdpVideoFormat vp8_format("VP8"); const std::vector supported_formats = {vp8_format}; EXPECT_CALL(*encoder_factory, GetSupportedFormats()) @@ -1267,8 +1243,7 @@ class WebRtcVideoChannelBaseTest : public testing::Test { protected: WebRtcVideoChannelBaseTest() : engine_(webrtc::CreateBuiltinVideoEncoderFactory(), - webrtc::CreateBuiltinVideoDecoderFactory(), - webrtc::CreateBuiltinVideoBitrateAllocatorFactory()) {} + webrtc::CreateBuiltinVideoDecoderFactory()) {} virtual void SetUp() { // One testcase calls SetUp in a loop, only create call_ once. @@ -6785,14 +6760,10 @@ class WebRtcVideoChannelSimulcastTest : public testing::Test { : fake_call_(), encoder_factory_(new cricket::FakeWebRtcVideoEncoderFactory), decoder_factory_(new cricket::FakeWebRtcVideoDecoderFactory), - mock_rate_allocator_factory_( - new webrtc::MockVideoBitrateAllocatorFactory), engine_(std::unique_ptr( encoder_factory_), std::unique_ptr( - decoder_factory_), - std::unique_ptr( - mock_rate_allocator_factory_)), + decoder_factory_)), last_ssrc_(0) {} void SetUp() override { @@ -6949,7 +6920,6 @@ class WebRtcVideoChannelSimulcastTest : public testing::Test { FakeCall fake_call_; cricket::FakeWebRtcVideoEncoderFactory* encoder_factory_; cricket::FakeWebRtcVideoDecoderFactory* decoder_factory_; - webrtc::MockVideoBitrateAllocatorFactory* mock_rate_allocator_factory_; WebRtcVideoEngine engine_; std::unique_ptr channel_; uint32_t last_ssrc_; diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index 246fed2852..b92f775ddc 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -158,7 +158,6 @@ rtc_static_library("video_coding") { "..:module_api_public", "../..:webrtc_common", "../../api:fec_controller_api", - "../../api/video:builtin_video_bitrate_allocator_factory", "../../api/video:encoded_frame", "../../api/video:video_bitrate_allocator", "../../api/video:video_frame", @@ -643,7 +642,6 @@ if (rtc_include_tests) { ":webrtc_vp9_helpers", "../..:webrtc_common", "../../api:videocodec_test_fixture_api", - "../../api/video:builtin_video_bitrate_allocator_factory", "../../api/video:video_bitrate_allocator", "../../api/video:video_frame", "../../api/video:video_frame_i420", @@ -897,9 +895,7 @@ if (rtc_include_tests) { "../../api:simulcast_test_fixture_api", "../../api:videocodec_test_fixture_api", "../../api/test/video:function_video_factory", - "../../api/video:builtin_video_bitrate_allocator_factory", "../../api/video:video_bitrate_allocator", - "../../api/video:video_bitrate_allocator_factory", "../../api/video:video_frame", "../../api/video:video_frame_i420", "../../api/video_codecs:create_vp8_temporal_layers", diff --git a/modules/video_coding/codecs/test/videoprocessor.cc b/modules/video_coding/codecs/test/videoprocessor.cc index 69582660f9..5e980cdcf1 100644 --- a/modules/video_coding/codecs/test/videoprocessor.cc +++ b/modules/video_coding/codecs/test/videoprocessor.cc @@ -14,7 +14,6 @@ #include #include -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video/i420_buffer.h" #include "common_types.h" // NOLINT(build/include) #include "common_video/h264/h264_common.h" @@ -174,9 +173,8 @@ VideoProcessor::VideoProcessor(webrtc::VideoEncoder* encoder, stats_(stats), encoder_(encoder), decoders_(decoders), - bitrate_allocator_( - CreateBuiltinVideoBitrateAllocatorFactory() - ->CreateVideoBitrateAllocator(config_.codec_settings)), + bitrate_allocator_(VideoCodecInitializer::CreateBitrateAllocator( + config_.codec_settings)), framerate_fps_(0), encode_callback_(this), input_frame_reader_(input_frame_reader), diff --git a/modules/video_coding/include/video_codec_initializer.h b/modules/video_coding/include/video_codec_initializer.h index e979f9c867..ee70810f62 100644 --- a/modules/video_coding/include/video_codec_initializer.h +++ b/modules/video_coding/include/video_codec_initializer.h @@ -30,9 +30,15 @@ class VideoCodecInitializer { // type used. For instance, VP8 will create an allocator than can handle // simulcast and temporal layering. // GetBitrateAllocator is called implicitly from here, no need to call again. - static bool SetupCodec(const VideoEncoderConfig& config, - const std::vector& streams, - VideoCodec* codec); + static bool SetupCodec( + const VideoEncoderConfig& config, + const std::vector& streams, + VideoCodec* codec, + std::unique_ptr* bitrate_allocator); + + // Create a bitrate allocator for the specified codec. + static std::unique_ptr CreateBitrateAllocator( + const VideoCodec& codec); private: static VideoCodec VideoEncoderConfigToVideoCodec( diff --git a/modules/video_coding/video_codec_initializer.cc b/modules/video_coding/video_codec_initializer.cc index 86a5ab2a48..e7125ce278 100644 --- a/modules/video_coding/video_codec_initializer.cc +++ b/modules/video_coding/video_codec_initializer.cc @@ -24,13 +24,15 @@ namespace webrtc { -bool VideoCodecInitializer::SetupCodec(const VideoEncoderConfig& config, - const std::vector& streams, - VideoCodec* codec) { +bool VideoCodecInitializer::SetupCodec( + const VideoEncoderConfig& config, + const std::vector& streams, + VideoCodec* codec, + std::unique_ptr* bitrate_allocator) { if (config.codec_type == kVideoCodecMultiplex) { VideoEncoderConfig associated_config = config.Copy(); associated_config.codec_type = kVideoCodecVP9; - if (!SetupCodec(associated_config, streams, codec)) { + if (!SetupCodec(associated_config, streams, codec, bitrate_allocator)) { RTC_LOG(LS_ERROR) << "Failed to create stereo encoder configuration."; return false; } @@ -39,9 +41,31 @@ bool VideoCodecInitializer::SetupCodec(const VideoEncoderConfig& config, } *codec = VideoEncoderConfigToVideoCodec(config, streams); + *bitrate_allocator = CreateBitrateAllocator(*codec); + return true; } +std::unique_ptr +VideoCodecInitializer::CreateBitrateAllocator(const VideoCodec& codec) { + std::unique_ptr rate_allocator; + + switch (codec.codecType) { + case kVideoCodecVP8: + RTC_FALLTHROUGH(); + case kVideoCodecH264: + rate_allocator.reset(new SimulcastRateAllocator(codec)); + break; + case kVideoCodecVP9: + rate_allocator.reset(new SvcRateAllocator(codec)); + break; + default: + rate_allocator.reset(new DefaultVideoBitrateAllocator(codec)); + } + + return rate_allocator; +} + // TODO(sprang): Split this up and separate the codec specific parts. VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec( const VideoEncoderConfig& config, diff --git a/modules/video_coding/video_codec_initializer_unittest.cc b/modules/video_coding/video_codec_initializer_unittest.cc index ceff1ebaf7..335ca6b332 100644 --- a/modules/video_coding/video_codec_initializer_unittest.cc +++ b/modules/video_coding/video_codec_initializer_unittest.cc @@ -9,13 +9,12 @@ */ #include "modules/video_coding/include/video_codec_initializer.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" +#include "api/video/video_bitrate_allocator.h" #include "api/video_codecs/create_vp8_temporal_layers.h" #include "api/video_codecs/video_encoder.h" #include "api/video_codecs/vp8_temporal_layers.h" #include "common_types.h" // NOLINT(build/include) #include "modules/video_coding/codecs/vp9/include/vp9_globals.h" -#include "rtc_base/checks.h" #include "rtc_base/refcountedobject.h" #include "test/gtest.h" @@ -76,13 +75,12 @@ class VideoCodecInitializerTest : public ::testing::Test { bool InitializeCodec() { codec_out_ = VideoCodec(); + bitrate_allocator_out_.reset(); temporal_layers_.clear(); - if (!VideoCodecInitializer::SetupCodec(config_, streams_, &codec_out_)) { + if (!VideoCodecInitializer::SetupCodec(config_, streams_, &codec_out_, + &bitrate_allocator_out_)) { return false; } - bitrate_allocator_ = CreateBuiltinVideoBitrateAllocatorFactory() - ->CreateVideoBitrateAllocator(codec_out_); - RTC_CHECK(bitrate_allocator_); if (codec_out_.codecType == VideoCodecType::kVideoCodecMultiplex) return true; @@ -128,7 +126,7 @@ class VideoCodecInitializerTest : public ::testing::Test { // Output. VideoCodec codec_out_; - std::unique_ptr bitrate_allocator_; + std::unique_ptr bitrate_allocator_out_; std::vector> temporal_layers_; }; @@ -137,8 +135,9 @@ TEST_F(VideoCodecInitializerTest, SingleStreamVp8Screenshare) { streams_.push_back(DefaultStream()); EXPECT_TRUE(InitializeCodec()); - VideoBitrateAllocation bitrate_allocation = bitrate_allocator_->GetAllocation( - kDefaultTargetBitrateBps, kDefaultFrameRate); + VideoBitrateAllocation bitrate_allocation = + bitrate_allocator_out_->GetAllocation(kDefaultTargetBitrateBps, + kDefaultFrameRate); EXPECT_EQ(1u, codec_out_.numberOfSimulcastStreams); EXPECT_EQ(1u, codec_out_.VP8()->numberOfTemporalLayers); EXPECT_EQ(kDefaultTargetBitrateBps, bitrate_allocation.get_sum_bps()); @@ -151,8 +150,9 @@ TEST_F(VideoCodecInitializerTest, SingleStreamVp8ScreenshareInactive) { streams_.push_back(inactive_stream); EXPECT_TRUE(InitializeCodec()); - VideoBitrateAllocation bitrate_allocation = bitrate_allocator_->GetAllocation( - kDefaultTargetBitrateBps, kDefaultFrameRate); + VideoBitrateAllocation bitrate_allocation = + bitrate_allocator_out_->GetAllocation(kDefaultTargetBitrateBps, + kDefaultFrameRate); EXPECT_EQ(1u, codec_out_.numberOfSimulcastStreams); EXPECT_EQ(1u, codec_out_.VP8()->numberOfTemporalLayers); EXPECT_EQ(0U, bitrate_allocation.get_sum_bps()); @@ -165,8 +165,9 @@ TEST_F(VideoCodecInitializerTest, TemporalLayeredVp8Screenshare) { EXPECT_EQ(1u, codec_out_.numberOfSimulcastStreams); EXPECT_EQ(2u, codec_out_.VP8()->numberOfTemporalLayers); - VideoBitrateAllocation bitrate_allocation = bitrate_allocator_->GetAllocation( - kScreenshareCodecTargetBitrateBps, kScreenshareDefaultFramerate); + VideoBitrateAllocation bitrate_allocation = + bitrate_allocator_out_->GetAllocation(kScreenshareCodecTargetBitrateBps, + kScreenshareDefaultFramerate); EXPECT_EQ(kScreenshareCodecTargetBitrateBps, bitrate_allocation.get_sum_bps()); EXPECT_EQ(kScreenshareTl0BitrateBps, bitrate_allocation.GetBitrate(0, 0)); @@ -184,8 +185,9 @@ TEST_F(VideoCodecInitializerTest, SimulcastVp8Screenshare) { EXPECT_EQ(1u, codec_out_.VP8()->numberOfTemporalLayers); const uint32_t max_bitrate_bps = streams_[0].target_bitrate_bps + streams_[1].max_bitrate_bps; - VideoBitrateAllocation bitrate_allocation = bitrate_allocator_->GetAllocation( - max_bitrate_bps, kScreenshareDefaultFramerate); + VideoBitrateAllocation bitrate_allocation = + bitrate_allocator_out_->GetAllocation(max_bitrate_bps, + kScreenshareDefaultFramerate); EXPECT_EQ(max_bitrate_bps, bitrate_allocation.get_sum_bps()); EXPECT_EQ(static_cast(streams_[0].target_bitrate_bps), bitrate_allocation.GetSpatialLayerSum(0)); @@ -208,8 +210,9 @@ TEST_F(VideoCodecInitializerTest, SimulcastVp8ScreenshareInactive) { EXPECT_EQ(1u, codec_out_.VP8()->numberOfTemporalLayers); const uint32_t target_bitrate = streams_[0].target_bitrate_bps + streams_[1].target_bitrate_bps; - VideoBitrateAllocation bitrate_allocation = bitrate_allocator_->GetAllocation( - target_bitrate, kScreenshareDefaultFramerate); + VideoBitrateAllocation bitrate_allocation = + bitrate_allocator_out_->GetAllocation(target_bitrate, + kScreenshareDefaultFramerate); EXPECT_EQ(static_cast(streams_[0].max_bitrate_bps), bitrate_allocation.get_sum_bps()); EXPECT_EQ(static_cast(streams_[0].max_bitrate_bps), @@ -232,7 +235,7 @@ TEST_F(VideoCodecInitializerTest, HighFpsSimulcastVp8Screenshare) { const uint32_t max_bitrate_bps = streams_[0].target_bitrate_bps + streams_[1].max_bitrate_bps; VideoBitrateAllocation bitrate_allocation = - bitrate_allocator_->GetAllocation(max_bitrate_bps, kDefaultFrameRate); + bitrate_allocator_out_->GetAllocation(max_bitrate_bps, kDefaultFrameRate); EXPECT_EQ(max_bitrate_bps, bitrate_allocation.get_sum_bps()); EXPECT_EQ(static_cast(streams_[0].target_bitrate_bps), bitrate_allocation.GetSpatialLayerSum(0)); diff --git a/modules/video_coding/video_coding_impl.cc b/modules/video_coding/video_coding_impl.cc index 1460f6abbc..a061c18fd7 100644 --- a/modules/video_coding/video_coding_impl.cc +++ b/modules/video_coding/video_coding_impl.cc @@ -13,7 +13,6 @@ #include #include -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video/video_bitrate_allocator.h" #include "common_types.h" // NOLINT(build/include) #include "common_video/libyuv/include/webrtc_libyuv.h" @@ -87,7 +86,6 @@ class VideoCodingModuleImpl : public VideoCodingModule { KeyFrameRequestSender* keyframe_request_sender) : VideoCodingModule(), sender_(clock, &post_encode_callback_), - rate_allocator_factory_(CreateBuiltinVideoBitrateAllocatorFactory()), timing_(new VCMTiming(clock)), receiver_(clock, event_factory, @@ -116,8 +114,7 @@ class VideoCodingModuleImpl : public VideoCodingModule { // asynchronously keep the instance alive until destruction or until a // new send codec is registered. VideoCodec codec = *sendCodec; - rate_allocator_ = - rate_allocator_factory_->CreateVideoBitrateAllocator(codec); + rate_allocator_ = VideoCodecInitializer::CreateBitrateAllocator(codec); return sender_.RegisterSendCodec(&codec, numberOfCores, maxPayloadSize); } return sender_.RegisterSendCodec(sendCodec, numberOfCores, maxPayloadSize); @@ -216,9 +213,8 @@ class VideoCodingModuleImpl : public VideoCodingModule { rtc::ThreadChecker construction_thread_; EncodedImageCallbackWrapper post_encode_callback_; vcm::VideoSender sender_; - const std::unique_ptr rate_allocator_factory_; std::unique_ptr rate_allocator_; - const std::unique_ptr timing_; + std::unique_ptr timing_; vcm::VideoReceiver receiver_; }; } // namespace diff --git a/pc/BUILD.gn b/pc/BUILD.gn index d6531f0398..7663f8b2f2 100644 --- a/pc/BUILD.gn +++ b/pc/BUILD.gn @@ -217,6 +217,23 @@ rtc_static_library("peerconnection") { ] } +rtc_static_library("builtin_video_bitrate_allocator_factory") { + sources = [ + "builtin_video_bitrate_allocator_factory.cc", + "builtin_video_bitrate_allocator_factory.h", + ] + + deps = [ + "../api/video:video_bitrate_allocator_factory", + "../media:rtc_media_base", + "../modules/video_coding:video_coding_utility", + "../modules/video_coding:webrtc_vp9_helpers", + "../rtc_base:ptr_util", + "../rtc_base/system:fallthrough", + "//third_party/abseil-cpp/absl/memory", + ] +} + # This target implements CreatePeerConnectionFactory methods that will create a # PeerConnection will full functionality (audio, video and data). Applications # that wish to reduce their binary size by ommitting functionality they don't @@ -233,7 +250,6 @@ rtc_static_library("create_pc_factory") { "../api:libjingle_peerconnection_api", "../api/audio:audio_mixer_api", "../api/audio_codecs:audio_codecs_api", - "../api/video:builtin_video_bitrate_allocator_factory", "../api/video_codecs:video_codecs_api", "../call", "../call:call_interfaces", @@ -486,7 +502,6 @@ if (rtc_include_tests) { "../api:libjingle_peerconnection_api", "../api:mock_rtp", "../api/units:time_delta", - "../api/video:builtin_video_bitrate_allocator_factory", "../logging:fake_rtc_event_log", "../rtc_base:checks", "../rtc_base:stringutils", diff --git a/api/video/builtin_video_bitrate_allocator_factory.cc b/pc/builtin_video_bitrate_allocator_factory.cc similarity index 96% rename from api/video/builtin_video_bitrate_allocator_factory.cc rename to pc/builtin_video_bitrate_allocator_factory.cc index 70f6ad04cb..46d7daea6f 100644 --- a/api/video/builtin_video_bitrate_allocator_factory.cc +++ b/pc/builtin_video_bitrate_allocator_factory.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "api/video/builtin_video_bitrate_allocator_factory.h" +#include "pc/builtin_video_bitrate_allocator_factory.h" #include "absl/memory/memory.h" #include "media/base/codec.h" diff --git a/api/video/builtin_video_bitrate_allocator_factory.h b/pc/builtin_video_bitrate_allocator_factory.h similarity index 77% rename from api/video/builtin_video_bitrate_allocator_factory.h rename to pc/builtin_video_bitrate_allocator_factory.h index ac880a0863..60f2afcbab 100644 --- a/api/video/builtin_video_bitrate_allocator_factory.h +++ b/pc/builtin_video_bitrate_allocator_factory.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef API_VIDEO_BUILTIN_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_ -#define API_VIDEO_BUILTIN_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_ +#ifndef PC_BUILTIN_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_ +#define PC_BUILTIN_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_ #include @@ -22,4 +22,4 @@ CreateBuiltinVideoBitrateAllocatorFactory(); } // namespace webrtc -#endif // API_VIDEO_BUILTIN_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_ +#endif // PC_BUILTIN_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_ diff --git a/pc/createpeerconnectionfactory.cc b/pc/createpeerconnectionfactory.cc index 71ee2a1cd0..b1db69091b 100644 --- a/pc/createpeerconnectionfactory.cc +++ b/pc/createpeerconnectionfactory.cc @@ -10,7 +10,6 @@ #include "api/call/callfactoryinterface.h" #include "api/peerconnectioninterface.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_encoder_factory.h" #include "logging/rtc_event_log/rtc_event_log_factory_interface.h" @@ -53,15 +52,10 @@ rtc::scoped_refptr CreatePeerConnectionFactory( audio_processing_use = AudioProcessingBuilder().Create(); } - std::unique_ptr - video_bitrate_allocator_factory = - CreateBuiltinVideoBitrateAllocatorFactory(); - std::unique_ptr media_engine( cricket::WebRtcMediaEngineFactory::Create( default_adm, audio_encoder_factory, audio_decoder_factory, - video_encoder_factory, video_decoder_factory, - std::move(video_bitrate_allocator_factory), audio_mixer, + video_encoder_factory, video_decoder_factory, audio_mixer, audio_processing_use)); std::unique_ptr call_factory = CreateCallFactory(); @@ -93,15 +87,10 @@ rtc::scoped_refptr CreatePeerConnectionFactory( audio_processing_use = AudioProcessingBuilder().Create(); } - std::unique_ptr - video_bitrate_allocator_factory = - CreateBuiltinVideoBitrateAllocatorFactory(); - std::unique_ptr media_engine( cricket::WebRtcMediaEngineFactory::Create( default_adm, audio_encoder_factory, audio_decoder_factory, - video_encoder_factory, video_decoder_factory, - std::move(video_bitrate_allocator_factory), audio_mixer, + video_encoder_factory, video_decoder_factory, audio_mixer, audio_processing_use)); std::unique_ptr call_factory = CreateCallFactory(); @@ -130,16 +119,11 @@ rtc::scoped_refptr CreatePeerConnectionFactory( if (!audio_processing) audio_processing = AudioProcessingBuilder().Create(); - std::unique_ptr - video_bitrate_allocator_factory = - CreateBuiltinVideoBitrateAllocatorFactory(); - std::unique_ptr media_engine = cricket::WebRtcMediaEngineFactory::Create( default_adm, audio_encoder_factory, audio_decoder_factory, std::move(video_encoder_factory), std::move(video_decoder_factory), - std::move(video_bitrate_allocator_factory), audio_mixer, - audio_processing); + audio_mixer, audio_processing); std::unique_ptr call_factory = CreateCallFactory(); diff --git a/pc/peerconnection_integrationtest.cc b/pc/peerconnection_integrationtest.cc index 87a4c8571f..236a8bb97d 100644 --- a/pc/peerconnection_integrationtest.cc +++ b/pc/peerconnection_integrationtest.cc @@ -29,7 +29,6 @@ #include "api/peerconnectionproxy.h" #include "api/rtpreceiverinterface.h" #include "api/umametrics.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video_codecs/builtin_video_decoder_factory.h" #include "api/video_codecs/builtin_video_encoder_factory.h" #include "api/video_codecs/sdp_video_format.h" @@ -622,9 +621,7 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver, webrtc::CreateBuiltinAudioEncoderFactory(), webrtc::CreateBuiltinAudioDecoderFactory(), webrtc::CreateBuiltinVideoEncoderFactory(), - webrtc::CreateBuiltinVideoDecoderFactory(), - webrtc::CreateBuiltinVideoBitrateAllocatorFactory(), - nullptr /* audio_mixer */, + webrtc::CreateBuiltinVideoDecoderFactory(), nullptr, webrtc::AudioProcessingBuilder().Create()); pc_factory_dependencies.call_factory = webrtc::CreateCallFactory(); if (event_log_factory) { diff --git a/pc/peerconnection_jsep_unittest.cc b/pc/peerconnection_jsep_unittest.cc index 535dacfe3a..7de0a3ff14 100644 --- a/pc/peerconnection_jsep_unittest.cc +++ b/pc/peerconnection_jsep_unittest.cc @@ -10,7 +10,6 @@ #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video_codecs/builtin_video_decoder_factory.h" #include "api/video_codecs/builtin_video_encoder_factory.h" #include "media/engine/webrtcmediaengine.h" @@ -57,7 +56,6 @@ class PeerConnectionFactoryForJsepTest : public PeerConnectionFactory { CreateBuiltinAudioDecoderFactory(), CreateBuiltinVideoEncoderFactory(), CreateBuiltinVideoDecoderFactory(), - CreateBuiltinVideoBitrateAllocatorFactory(), nullptr, AudioProcessingBuilder().Create()), CreateCallFactory(), diff --git a/pc/peerconnectioninterface_unittest.cc b/pc/peerconnectioninterface_unittest.cc index 0f85549400..c4cf081886 100644 --- a/pc/peerconnectioninterface_unittest.cc +++ b/pc/peerconnectioninterface_unittest.cc @@ -22,7 +22,6 @@ #include "api/peerconnectioninterface.h" #include "api/rtpreceiverinterface.h" #include "api/rtpsenderinterface.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video_codecs/builtin_video_decoder_factory.h" #include "api/video_codecs/builtin_video_encoder_factory.h" #include "logging/rtc_event_log/output/rtc_event_log_output_file.h" @@ -634,8 +633,6 @@ class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory { auto audio_decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory(); auto video_encoder_factory = webrtc::CreateBuiltinVideoEncoderFactory(); auto video_decoder_factory = webrtc::CreateBuiltinVideoDecoderFactory(); - auto video_bitrate_allocator_factory = - webrtc::CreateBuiltinVideoBitrateAllocatorFactory(); // Use fake audio device module since we're only testing the interface // level, and using a real one could make tests flaky when run in parallel. @@ -643,8 +640,7 @@ class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory { cricket::WebRtcMediaEngineFactory::Create( FakeAudioCaptureModule::Create(), audio_encoder_factory, audio_decoder_factory, std::move(video_encoder_factory), - std::move(video_decoder_factory), - std::move(video_bitrate_allocator_factory), nullptr, + std::move(video_decoder_factory), nullptr, webrtc::AudioProcessingBuilder().Create())); std::unique_ptr call_factory = diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 38b6f07825..f703918081 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -913,7 +913,6 @@ if (is_ios || is_mac) { "../api/audio_codecs:audio_codecs_api", "../api/audio_codecs:builtin_audio_decoder_factory", "../api/audio_codecs:builtin_audio_encoder_factory", - "../api/video:builtin_video_bitrate_allocator_factory", "../api/video:video_frame", "../api/video_codecs:video_codecs_api", "../common_video", diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn index d7f3da808e..c513a66d45 100644 --- a/sdk/android/BUILD.gn +++ b/sdk/android/BUILD.gn @@ -573,7 +573,6 @@ if (is_android) { ":vp9_jni", # TODO(bugs.webrtc.org/7925): Remove. "../..:webrtc_common", "../../api:libjingle_peerconnection_api", - "../../api/video:builtin_video_bitrate_allocator_factory", "../../api/video:encoded_image", "../../api/video:video_frame", "../../api/video_codecs:builtin_video_decoder_factory", @@ -663,7 +662,6 @@ if (is_android) { ":native_api_jni", "../..:webrtc_common", "../../api:libjingle_peerconnection_api", - "../../api/video:video_bitrate_allocator_factory", "../../api/video_codecs:video_codecs_api", "../../logging:rtc_event_log_api", "../../logging:rtc_event_log_impl_base", @@ -876,7 +874,6 @@ if (is_android) { deps = [ ":base_jni", - "../../api/video:video_bitrate_allocator_factory", "../../api/video_codecs:video_codecs_api", ] } @@ -899,7 +896,6 @@ if (is_android) { deps = [ ":base_jni", "../../api:callfactory_api", - "../../api/video:video_bitrate_allocator_factory", "../../api/video_codecs:video_codecs_api", "../../call:call_interfaces", "../../logging:rtc_event_log_api", @@ -1392,7 +1388,6 @@ if (is_android) { ":video_jni", "../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/audio_codecs:builtin_audio_encoder_factory", - "../../api/video:builtin_video_bitrate_allocator_factory", "../../api/video:video_frame", "../../media:rtc_audio_video", "../../media:rtc_internal_video_codecs", diff --git a/sdk/android/native_unittests/peerconnection/peerconnectionfactory_unittest.cc b/sdk/android/native_unittests/peerconnection/peerconnectionfactory_unittest.cc index 4392d804fd..747786090c 100644 --- a/sdk/android/native_unittests/peerconnection/peerconnectionfactory_unittest.cc +++ b/sdk/android/native_unittests/peerconnection/peerconnectionfactory_unittest.cc @@ -12,7 +12,6 @@ #include "absl/memory/memory.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "media/base/mediaengine.h" #include "media/engine/internaldecoderfactory.h" #include "media/engine/internalencoderfactory.h" @@ -45,7 +44,6 @@ rtc::scoped_refptr CreateTestPCF( webrtc::CreateBuiltinAudioDecoderFactory(), absl::make_unique(), absl::make_unique(), - webrtc::CreateBuiltinVideoBitrateAllocatorFactory(), nullptr /* audio_mixer */, webrtc::AudioProcessingBuilder().Create()); RTC_LOG(LS_INFO) << "Media engine created: " << media_engine.get(); diff --git a/sdk/android/src/jni/pc/media.cc b/sdk/android/src/jni/pc/media.cc index 5d10907c7b..dba85fbffa 100644 --- a/sdk/android/src/jni/pc/media.cc +++ b/sdk/android/src/jni/pc/media.cc @@ -12,7 +12,6 @@ #include #include "api/call/callfactoryinterface.h" -#include "api/video/video_bitrate_allocator_factory.h" #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_encoder_factory.h" #include "logging/rtc_event_log/rtc_event_log_factory_interface.h" @@ -37,15 +36,12 @@ cricket::MediaEngineInterface* CreateMediaEngine( rtc::scoped_refptr audio_decoder_factory, std::unique_ptr video_encoder_factory, std::unique_ptr video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory, rtc::scoped_refptr audio_mixer, rtc::scoped_refptr audio_processor) { return cricket::WebRtcMediaEngineFactory::Create( adm, audio_encoder_factory, audio_decoder_factory, std::move(video_encoder_factory), std::move(video_decoder_factory), - std::move(video_bitrate_allocator_factory), audio_mixer, - audio_processor) + audio_mixer, audio_processor) .release(); } diff --git a/sdk/android/src/jni/pc/media.h b/sdk/android/src/jni/pc/media.h index d6014a65fe..8a0bb52174 100644 --- a/sdk/android/src/jni/pc/media.h +++ b/sdk/android/src/jni/pc/media.h @@ -25,7 +25,6 @@ class AudioMixer; class AudioProcessing; class VideoEncoderFactory; class VideoDecoderFactory; -class VideoBitrateAllocatorFactory; } // namespace webrtc namespace cricket { @@ -44,8 +43,6 @@ cricket::MediaEngineInterface* CreateMediaEngine( rtc::scoped_refptr audio_decoder_factory, std::unique_ptr video_encoder_factory, std::unique_ptr video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory, rtc::scoped_refptr audio_mixer, rtc::scoped_refptr audio_processor); diff --git a/sdk/android/src/jni/pc/null_media.cc b/sdk/android/src/jni/pc/null_media.cc index 1f937070dd..c59c476d51 100644 --- a/sdk/android/src/jni/pc/null_media.cc +++ b/sdk/android/src/jni/pc/null_media.cc @@ -27,8 +27,6 @@ cricket::MediaEngineInterface* CreateMediaEngine( rtc::scoped_refptr audio_decoder_factory, std::unique_ptr video_encoder_factory, std::unique_ptr video_decoder_factory, - std::unique_ptr - video_bitrate_allocator_factory, rtc::scoped_refptr audio_mixer, rtc::scoped_refptr audio_processor) { return nullptr; diff --git a/sdk/android/src/jni/pc/null_video.cc b/sdk/android/src/jni/pc/null_video.cc index aaf1d0d10b..0e0b80d461 100644 --- a/sdk/android/src/jni/pc/null_video.cc +++ b/sdk/android/src/jni/pc/null_video.cc @@ -10,7 +10,6 @@ #include "sdk/android/src/jni/pc/video.h" -#include "api/video/video_bitrate_allocator_factory.h" #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_encoder_factory.h" @@ -36,10 +35,5 @@ void* CreateVideoSource(JNIEnv* env, return nullptr; } -std::unique_ptr -CreateVideoBitrateAllocatorFactory() { - return nullptr; -} - } // namespace jni } // namespace webrtc diff --git a/sdk/android/src/jni/pc/peerconnectionfactory.cc b/sdk/android/src/jni/pc/peerconnectionfactory.cc index de3a6e951b..148375e3d6 100644 --- a/sdk/android/src/jni/pc/peerconnectionfactory.cc +++ b/sdk/android/src/jni/pc/peerconnectionfactory.cc @@ -13,7 +13,6 @@ #include #include -#include "api/video/video_bitrate_allocator_factory.h" #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_encoder_factory.h" #include "media/base/mediaengine.h" @@ -260,17 +259,13 @@ jlong CreatePeerConnectionFactoryForJava( std::unique_ptr rtc_event_log_factory( CreateRtcEventLogFactory()); - std::unique_ptr - video_bitrate_allocator_factory = CreateVideoBitrateAllocatorFactory(); - std::unique_ptr media_engine(CreateMediaEngine( audio_device_module, audio_encoder_factory, audio_decoder_factory, std::unique_ptr( CreateVideoEncoderFactory(jni, jencoder_factory)), std::unique_ptr( CreateVideoDecoderFactory(jni, jdecoder_factory)), - std::move(video_bitrate_allocator_factory), audio_mixer, - audio_processor)); + audio_mixer, audio_processor)); PeerConnectionFactoryDependencies dependencies; dependencies.network_thread = network_thread.get(); dependencies.worker_thread = worker_thread.get(); diff --git a/sdk/android/src/jni/pc/video.cc b/sdk/android/src/jni/pc/video.cc index e125db206d..dd10fd51cb 100644 --- a/sdk/android/src/jni/pc/video.cc +++ b/sdk/android/src/jni/pc/video.cc @@ -13,7 +13,6 @@ #include #include -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_encoder_factory.h" #include "api/videosourceproxy.h" @@ -53,10 +52,5 @@ void* CreateVideoSource(JNIEnv* env, .release(); } -std::unique_ptr -CreateVideoBitrateAllocatorFactory() { - return CreateBuiltinVideoBitrateAllocatorFactory(); -} - } // namespace jni } // namespace webrtc diff --git a/sdk/android/src/jni/pc/video.h b/sdk/android/src/jni/pc/video.h index 96a33bc125..183770b820 100644 --- a/sdk/android/src/jni/pc/video.h +++ b/sdk/android/src/jni/pc/video.h @@ -13,7 +13,6 @@ #include -#include #include "rtc_base/scoped_ref_ptr.h" #include "rtc_base/thread.h" #include "sdk/android/native_api/jni/scoped_java_ref.h" @@ -21,7 +20,6 @@ namespace webrtc { class VideoEncoderFactory; class VideoDecoderFactory; -class VideoBitrateAllocatorFactory; } // namespace webrtc namespace webrtc { @@ -40,9 +38,6 @@ void* CreateVideoSource(JNIEnv* env, rtc::Thread* worker_thread, jboolean is_screencast); -std::unique_ptr -CreateVideoBitrateAllocatorFactory(); - } // namespace jni } // namespace webrtc diff --git a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm index dfe035af77..48476f2368 100644 --- a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm +++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm @@ -30,7 +30,6 @@ // is not smart enough to take the #ifdef into account. #include "api/audio_codecs/builtin_audio_decoder_factory.h" // nogncheck #include "api/audio_codecs/builtin_audio_encoder_factory.h" // nogncheck -#include "api/video/builtin_video_bitrate_allocator_factory.h" // nogncheck #include "media/engine/convert_legacy_video_factory.h" // nogncheck #include "modules/audio_device/include/audio_device.h" // nogncheck #include "modules/audio_processing/include/audio_processing.h" // nogncheck @@ -194,15 +193,13 @@ if (!audioProcessingModule) audioProcessingModule = webrtc::AudioProcessingBuilder().Create(); std::unique_ptr media_engine = - cricket::WebRtcMediaEngineFactory::Create( - audioDeviceModule, - audioEncoderFactory, - audioDecoderFactory, - std::move(videoEncoderFactory), - std::move(videoDecoderFactory), - webrtc::CreateBuiltinVideoBitrateAllocatorFactory(), - nullptr, // audio mixer - audioProcessingModule); + cricket::WebRtcMediaEngineFactory::Create(audioDeviceModule, + audioEncoderFactory, + audioDecoderFactory, + std::move(videoEncoderFactory), + std::move(videoDecoderFactory), + nullptr, // audio mixer + audioProcessingModule); std::unique_ptr call_factory = webrtc::CreateCallFactory(); diff --git a/test/BUILD.gn b/test/BUILD.gn index c1caf52154..c7218b66a1 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -327,7 +327,6 @@ if (rtc_include_tests) { "../api:create_simulcast_test_fixture_api", "../api:simulcast_test_fixture_api", "../api/test/video:function_video_factory", - "../api/video:builtin_video_bitrate_allocator_factory", "../api/video:video_frame_i420", "../modules/rtp_rtcp:rtp_rtcp", "../modules/video_capture", @@ -663,8 +662,6 @@ rtc_source_set("test_common") { "../api/audio_codecs:builtin_audio_decoder_factory", "../api/audio_codecs:builtin_audio_encoder_factory", "../api/test/video:function_video_factory", - "../api/video:builtin_video_bitrate_allocator_factory", - "../api/video:video_bitrate_allocator_factory", "../api/video:video_frame", "../api/video_codecs:video_codecs_api", "../audio", diff --git a/test/call_test.cc b/test/call_test.cc index 7d782503da..286807e503 100644 --- a/test/call_test.cc +++ b/test/call_test.cc @@ -15,7 +15,6 @@ #include "absl/memory/memory.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video_codecs/video_encoder_config.h" #include "call/fake_network_pipe.h" #include "call/rtp_transport_controller_send.h" @@ -55,7 +54,6 @@ CallTest::CallTest() return fake_encoder; }), fake_decoder_factory_([]() { return absl::make_unique(); }), - bitrate_allocator_factory_(CreateBuiltinVideoBitrateAllocatorFactory()), num_video_streams_(1), num_audio_streams_(0), num_flexfec_streams_(0), @@ -235,8 +233,6 @@ void CallTest::CreateVideoSendConfig(VideoSendStream::Config* video_config, RTC_DCHECK_LE(num_video_streams + num_used_ssrcs, kNumSsrcs); *video_config = VideoSendStream::Config(send_transport); video_config->encoder_settings.encoder_factory = &fake_encoder_factory_; - video_config->encoder_settings.bitrate_allocator_factory = - bitrate_allocator_factory_.get(); video_config->rtp.payload_name = "FAKE"; video_config->rtp.payload_type = kFakeVideoSendPayloadType; video_config->rtp.extensions.push_back( diff --git a/test/call_test.h b/test/call_test.h index 674244ec6c..8bd87e41a9 100644 --- a/test/call_test.h +++ b/test/call_test.h @@ -15,7 +15,6 @@ #include "api/test/video/function_video_decoder_factory.h" #include "api/test/video/function_video_encoder_factory.h" -#include "api/video/video_bitrate_allocator_factory.h" #include "call/call.h" #include "call/rtp_transport_controller_send.h" #include "logging/rtc_event_log/rtc_event_log.h" @@ -206,7 +205,6 @@ class CallTest : public ::testing::Test { test::FunctionVideoEncoderFactory fake_encoder_factory_; int fake_encoder_max_bitrate_ = -1; test::FunctionVideoDecoderFactory fake_decoder_factory_; - std::unique_ptr bitrate_allocator_factory_; // Number of simulcast substreams. size_t num_video_streams_; size_t num_audio_streams_; diff --git a/test/scenario/BUILD.gn b/test/scenario/BUILD.gn index 7a34d0b2e5..f3746b8ff9 100644 --- a/test/scenario/BUILD.gn +++ b/test/scenario/BUILD.gn @@ -46,7 +46,6 @@ if (rtc_include_tests) { "../../api/units:data_rate", "../../api/units:time_delta", "../../api/units:timestamp", - "../../api/video:builtin_video_bitrate_allocator_factory", "../../api/video:video_frame", "../../api/video:video_frame_i420", "../../api/video_codecs:video_codecs_api", diff --git a/test/scenario/video_stream.cc b/test/scenario/video_stream.cc index 4f0078a9da..071ce0a391 100644 --- a/test/scenario/video_stream.cc +++ b/test/scenario/video_stream.cc @@ -13,7 +13,6 @@ #include #include "api/test/video/function_video_encoder_factory.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "media/base/mediaconstants.h" #include "media/engine/internaldecoderfactory.h" #include "media/engine/internalencoderfactory.h" @@ -214,15 +213,9 @@ SendVideoStream::SendVideoStream(CallClient* sender, } RTC_CHECK(encoder_factory_); - bitrate_allocator_factory_ = CreateBuiltinVideoBitrateAllocatorFactory(); - RTC_CHECK(bitrate_allocator_factory_); - VideoSendStream::Config send_config = CreateVideoSendStreamConfig(config, ssrcs_, send_transport); send_config.encoder_settings.encoder_factory = encoder_factory_.get(); - send_config.encoder_settings.bitrate_allocator_factory = - bitrate_allocator_factory_.get(); - VideoEncoderConfig encoder_config = CreateVideoEncoderConfig(config); send_stream_ = sender_->call_->CreateVideoSendStream( diff --git a/test/scenario/video_stream.h b/test/scenario/video_stream.h index e984a075dd..1b5b20a8ca 100644 --- a/test/scenario/video_stream.h +++ b/test/scenario/video_stream.h @@ -50,7 +50,6 @@ class SendVideoStream { CallClient* const sender_; const VideoStreamConfig config_; std::unique_ptr encoder_factory_; - std::unique_ptr bitrate_allocator_factory_; std::unique_ptr video_capturer_; FrameGeneratorCapturer* frame_generator_ = nullptr; int next_local_network_id_ = 0; diff --git a/video/BUILD.gn b/video/BUILD.gn index 4c705514f4..33dcbe6485 100644 --- a/video/BUILD.gn +++ b/video/BUILD.gn @@ -154,7 +154,6 @@ rtc_source_set("video_stream_encoder_impl") { deps = [ "../api/video:encoded_image", "../api/video:video_bitrate_allocator", - "../api/video:video_bitrate_allocator_factory", "../api/video:video_frame", "../api/video:video_frame_i420", "../api/video:video_stream_encoder", @@ -208,8 +207,6 @@ if (rtc_include_tests) { "../api:fec_controller_api", "../api:test_dependency_factory", "../api:video_quality_test_fixture_api", - "../api/video:builtin_video_bitrate_allocator_factory", - "../api/video:video_bitrate_allocator_factory", "../call:fake_network", "../call:simulated_network", "../logging:rtc_event_log_api", @@ -434,7 +431,6 @@ if (rtc_include_tests) { "../api:fake_frame_encryptor", "../api:simulated_network_api", "../api/test/video:function_video_factory", - "../api/video:builtin_video_bitrate_allocator_factory", "../api/video:encoded_image", "../api/video:video_frame", "../api/video:video_frame_i420", diff --git a/video/end_to_end_tests/bandwidth_tests.cc b/video/end_to_end_tests/bandwidth_tests.cc index 265b05250f..4c8f12c481 100644 --- a/video/end_to_end_tests/bandwidth_tests.cc +++ b/video/end_to_end_tests/bandwidth_tests.cc @@ -9,7 +9,6 @@ */ #include "api/test/simulated_network.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "call/fake_network_pipe.h" #include "call/simulated_network.h" #include "modules/rtp_rtcp/include/rtp_rtcp.h" @@ -274,8 +273,6 @@ TEST_F(BandwidthEndToEndTest, ReportsSetEncoderRates) { task_queue_(task_queue), send_stream_(nullptr), encoder_factory_(this), - bitrate_allocator_factory_( - CreateBuiltinVideoBitrateAllocatorFactory()), bitrate_kbps_(0) {} void OnVideoStreamsCreated( @@ -289,8 +286,6 @@ TEST_F(BandwidthEndToEndTest, ReportsSetEncoderRates) { std::vector* receive_configs, VideoEncoderConfig* encoder_config) override { send_config->encoder_settings.encoder_factory = &encoder_factory_; - send_config->encoder_settings.bitrate_allocator_factory = - bitrate_allocator_factory_.get(); RTC_DCHECK_EQ(1, encoder_config->number_of_streams); } @@ -349,7 +344,6 @@ TEST_F(BandwidthEndToEndTest, ReportsSetEncoderRates) { rtc::CriticalSection crit_; VideoSendStream* send_stream_; test::VideoEncoderProxyFactory encoder_factory_; - std::unique_ptr bitrate_allocator_factory_; uint32_t bitrate_kbps_ RTC_GUARDED_BY(crit_); } test(&task_queue_); diff --git a/video/end_to_end_tests/multi_stream_tester.cc b/video/end_to_end_tests/multi_stream_tester.cc index 5d5da65ca8..4590c25dcb 100644 --- a/video/end_to_end_tests/multi_stream_tester.cc +++ b/video/end_to_end_tests/multi_stream_tester.cc @@ -16,7 +16,6 @@ #include "api/test/simulated_network.h" #include "api/test/video/function_video_encoder_factory.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "call/fake_network_pipe.h" #include "call/simulated_network.h" #include "logging/rtc_event_log/rtc_event_log.h" @@ -55,8 +54,6 @@ void MultiStreamTester::RunTest() { test::FrameGeneratorCapturer* frame_generators[kNumStreams]; test::FunctionVideoEncoderFactory encoder_factory( []() { return VP8Encoder::Create(); }); - std::unique_ptr bitrate_allocator_factory = - CreateBuiltinVideoBitrateAllocatorFactory(); InternalDecoderFactory decoder_factory; task_queue_->SendTask([&]() { @@ -78,8 +75,6 @@ void MultiStreamTester::RunTest() { VideoSendStream::Config send_config(sender_transport.get()); send_config.rtp.ssrcs.push_back(ssrc); send_config.encoder_settings.encoder_factory = &encoder_factory; - send_config.encoder_settings.bitrate_allocator_factory = - bitrate_allocator_factory.get(); send_config.rtp.payload_name = "VP8"; send_config.rtp.payload_type = kVideoPayloadType; VideoEncoderConfig encoder_config; diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc index db9280f8b5..15579d855b 100644 --- a/video/video_quality_test.cc +++ b/video/video_quality_test.cc @@ -16,7 +16,6 @@ #include #include -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "call/fake_network_pipe.h" #include "call/simulated_network.h" #include "logging/rtc_event_log/output/rtc_event_log_output_file.h" @@ -284,8 +283,6 @@ VideoQualityTest::VideoQualityTest( [this](const SdpVideoFormat& format) { return this->CreateVideoEncoder(format, analyzer_.get()); }), - video_bitrate_allocator_factory_( - CreateBuiltinVideoBitrateAllocatorFactory()), receive_logs_(0), send_logs_(0), injection_components_(std::move(injection_components)) { @@ -616,8 +613,6 @@ void VideoQualityTest::SetupVideo(Transport* send_transport, video_send_configs_[video_idx].encoder_settings.encoder_factory = (video_idx == 0) ? &video_encoder_factory_with_analyzer_ : &video_encoder_factory_; - video_send_configs_[video_idx].encoder_settings.bitrate_allocator_factory = - video_bitrate_allocator_factory_.get(); video_send_configs_[video_idx].rtp.payload_name = params_.video[video_idx].codec; @@ -806,8 +801,6 @@ void VideoQualityTest::SetupThumbnails(Transport* send_transport, // TODO(nisse): Could use a simpler VP8-only encoder factory. thumbnail_send_config.encoder_settings.encoder_factory = &video_encoder_factory_; - thumbnail_send_config.encoder_settings.bitrate_allocator_factory = - video_bitrate_allocator_factory_.get(); thumbnail_send_config.rtp.payload_name = params_.video[0].codec; thumbnail_send_config.rtp.payload_type = kPayloadTypeVP8; thumbnail_send_config.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; diff --git a/video/video_quality_test.h b/video/video_quality_test.h index f67e65bc13..92796f303a 100644 --- a/video/video_quality_test.h +++ b/video/video_quality_test.h @@ -17,7 +17,6 @@ #include "api/fec_controller.h" #include "api/test/video_quality_test_fixture.h" -#include "api/video/video_bitrate_allocator_factory.h" #include "call/fake_network_pipe.h" #include "media/engine/internaldecoderfactory.h" #include "media/engine/internalencoderfactory.h" @@ -106,8 +105,6 @@ class VideoQualityTest : InternalDecoderFactory internal_decoder_factory_; test::FunctionVideoEncoderFactory video_encoder_factory_; test::FunctionVideoEncoderFactory video_encoder_factory_with_analyzer_; - std::unique_ptr - video_bitrate_allocator_factory_; InternalEncoderFactory internal_encoder_factory_; std::vector thumbnail_send_configs_; std::vector thumbnail_encoder_configs_; diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc index fc4c03e891..799931235c 100644 --- a/video/video_send_stream.cc +++ b/video/video_send_stream.cc @@ -78,7 +78,6 @@ VideoSendStream::VideoSendStream( config_(std::move(config)), content_type_(encoder_config.content_type) { RTC_DCHECK(config_.encoder_settings.encoder_factory); - RTC_DCHECK(config_.encoder_settings.bitrate_allocator_factory); video_stream_encoder_ = CreateVideoStreamEncoder(num_cpu_cores, &stats_proxy_, config_.encoder_settings, diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index 4e73ffbf85..6f734fb9d1 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -17,8 +17,6 @@ #include "api/video/encoded_image.h" #include "api/video/i420_buffer.h" -#include "api/video/video_bitrate_allocator_factory.h" -#include "common_video/include/video_frame.h" #include "modules/video_coding/include/video_codec_initializer.h" #include "modules/video_coding/include/video_coding.h" #include "rtc_base/arraysize.h" @@ -536,14 +534,11 @@ void VideoStreamEncoder::ReconfigureEncoder() { crop_height_ = last_frame_info_->height - highest_stream_height; VideoCodec codec; - if (!VideoCodecInitializer::SetupCodec(encoder_config_, streams, &codec)) { + if (!VideoCodecInitializer::SetupCodec(encoder_config_, streams, &codec, + &rate_allocator_)) { RTC_LOG(LS_ERROR) << "Failed to create encoder configuration."; } - rate_allocator_ = - settings_.bitrate_allocator_factory->CreateVideoBitrateAllocator(codec); - RTC_CHECK(rate_allocator_) << "Failed to create bitrate allocator."; - // Set min_bitrate_bps, max_bitrate_bps, and max padding bit rate for VP9. if (encoder_config_.codec_type == kVideoCodecVP9) { RTC_DCHECK_EQ(1U, streams.size()); diff --git a/video/video_stream_encoder_unittest.cc b/video/video_stream_encoder_unittest.cc index 1c8edc258e..4b9de7ba60 100644 --- a/video/video_stream_encoder_unittest.cc +++ b/video/video_stream_encoder_unittest.cc @@ -14,7 +14,6 @@ #include #include -#include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video/i420_buffer.h" #include "api/video_codecs/create_vp8_temporal_layers.h" #include "api/video_codecs/vp8_temporal_layers.h" @@ -280,7 +279,6 @@ class VideoStreamEncoderTest : public ::testing::Test { max_framerate_(kDefaultFramerate), fake_encoder_(), encoder_factory_(&fake_encoder_), - bitrate_allocator_factory_(CreateBuiltinVideoBitrateAllocatorFactory()), stats_proxy_(new MockableSendStatisticsProxy( Clock::GetRealTimeClock(), video_send_config_, @@ -291,8 +289,6 @@ class VideoStreamEncoderTest : public ::testing::Test { metrics::Reset(); video_send_config_ = VideoSendStream::Config(nullptr); video_send_config_.encoder_settings.encoder_factory = &encoder_factory_; - video_send_config_.encoder_settings.bitrate_allocator_factory = - bitrate_allocator_factory_.get(); video_send_config_.rtp.payload_name = "FAKE"; video_send_config_.rtp.payload_type = 125; @@ -699,7 +695,6 @@ class VideoStreamEncoderTest : public ::testing::Test { int max_framerate_; TestEncoder fake_encoder_; test::VideoEncoderProxyFactory encoder_factory_; - std::unique_ptr bitrate_allocator_factory_; std::unique_ptr stats_proxy_; TestSink sink_; AdaptingFrameForwarder video_source_;