Remove passing FieldTrialsView into AudioDecoderFactory as unused

Plan is to pass field trials using Environment when creating individual AudioDecoder rather than providing single set of field trials for the factory.
Current implementation is not used, and doesn't pass field trials when actually creating an AudioDecoder

Bug: webrtc:356878416
Change-Id: I0f79f09f7a6aa63e20fbdd783e90e8d026158330
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/359221
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42762}
This commit is contained in:
Danil Chapovalov 2024-08-12 13:54:12 +02:00 committed by WebRTC LUCI CQ
parent defe1358a5
commit ea233be459
5 changed files with 9 additions and 29 deletions

View File

@ -34,7 +34,6 @@ rtc_library("audio_codecs_api") {
"..:make_ref_counted",
"..:ref_count",
"..:scoped_refptr",
"../../api:field_trials_view",
"../../api:rtp_parameters",
"../../rtc_base:buffer",
"../../rtc_base:checks",

View File

@ -20,7 +20,6 @@
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_format.h"
#include "api/field_trials_view.h"
#include "api/make_ref_counted.h"
#include "api/scoped_refptr.h"
@ -38,8 +37,7 @@ struct Helper<> {
static bool IsSupportedDecoder(const SdpAudioFormat& format) { return false; }
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id,
const FieldTrialsView* field_trials) {
absl::optional<AudioCodecPairId> codec_pair_id) {
return nullptr;
}
};
@ -62,22 +60,16 @@ struct Helper<T, Ts...> {
}
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id,
const FieldTrialsView* field_trials) {
absl::optional<AudioCodecPairId> codec_pair_id) {
auto opt_config = T::SdpToConfig(format);
return opt_config ? T::MakeAudioDecoder(*opt_config, codec_pair_id)
: Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id,
field_trials);
: Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id);
}
};
template <typename... Ts>
class AudioDecoderFactoryT : public AudioDecoderFactory {
public:
explicit AudioDecoderFactoryT(const FieldTrialsView* field_trials) {
field_trials_ = field_trials;
}
std::vector<AudioCodecSpec> GetSupportedDecoders() override {
std::vector<AudioCodecSpec> specs;
Helper<Ts...>::AppendSupportedDecoders(&specs);
@ -91,11 +83,8 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id) override {
return Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id,
field_trials_);
return Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id);
}
const FieldTrialsView* field_trials_;
};
} // namespace audio_decoder_factory_template_impl
@ -131,8 +120,7 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
// TODO(kwiberg): Point at CreateBuiltinAudioDecoderFactory() for an example of
// how it is used.
template <typename... Ts>
rtc::scoped_refptr<AudioDecoderFactory> CreateAudioDecoderFactory(
const FieldTrialsView* field_trials = nullptr) {
scoped_refptr<AudioDecoderFactory> CreateAudioDecoderFactory() {
// There's no technical reason we couldn't allow zero template parameters,
// but such a factory couldn't create any decoders, and callers can do this
// by mistake by simply forgetting the <> altogether. So we forbid it in
@ -140,9 +128,8 @@ rtc::scoped_refptr<AudioDecoderFactory> CreateAudioDecoderFactory(
static_assert(sizeof...(Ts) >= 1,
"Caller must give at least one template parameter");
return rtc::make_ref_counted<
audio_decoder_factory_template_impl::AudioDecoderFactoryT<Ts...>>(
field_trials);
return make_ref_counted<
audio_decoder_factory_template_impl::AudioDecoderFactoryT<Ts...>>();
}
} // namespace webrtc

View File

@ -24,7 +24,6 @@ if (rtc_include_tests) {
"../..:make_ref_counted",
"../..:scoped_refptr",
"../../../test:audio_codec_mocks",
"../../../test:scoped_key_value_config",
"../../../test:test_support",
"../../environment",
"../../environment:environment_factory",

View File

@ -29,7 +29,6 @@
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/mock_audio_decoder.h"
#include "test/scoped_key_value_config.h"
namespace webrtc {
@ -85,11 +84,9 @@ struct AudioDecoderFakeApi {
} // namespace
TEST(AudioDecoderFactoryTemplateTest, NoDecoderTypes) {
test::ScopedKeyValueConfig field_trials;
rtc::scoped_refptr<AudioDecoderFactory> factory(
rtc::make_ref_counted<
audio_decoder_factory_template_impl::AudioDecoderFactoryT<>>(
&field_trials));
audio_decoder_factory_template_impl::AudioDecoderFactoryT<>>());
EXPECT_THAT(factory->GetSupportedDecoders(), ::testing::IsEmpty());
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
EXPECT_EQ(nullptr,

View File

@ -31,7 +31,6 @@
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/mock_audio_encoder.h"
#include "test/scoped_key_value_config.h"
namespace webrtc {
namespace {
@ -186,8 +185,7 @@ TEST(AudioEncoderFactoryTemplateTest, CanUseTraitWithOnlyV2MakeAudioEncoder) {
}
TEST(AudioEncoderFactoryTemplateTest, NoEncoderTypes) {
test::ScopedKeyValueConfig field_trials;
const Environment env = CreateEnvironment(&field_trials);
const Environment env = CreateEnvironment();
rtc::scoped_refptr<AudioEncoderFactory> factory(
rtc::make_ref_counted<
audio_encoder_factory_template_impl::AudioEncoderFactoryT<>>());