Introduce NetEqFactory::Create taking Environment instead of the Clock
To propagate field trials into the NetEq and further towards Audio Decoders Bug: webrtc:356878416 Change-Id: Ia7cf18451aef70441ca958bf652f492138c6051a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358620 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42739}
This commit is contained in:
parent
9847885240
commit
e1dbddfbcf
@ -21,9 +21,11 @@ rtc_source_set("neteq_api") {
|
|||||||
"..:rtp_headers",
|
"..:rtp_headers",
|
||||||
"..:rtp_packet_info",
|
"..:rtp_packet_info",
|
||||||
"..:scoped_refptr",
|
"..:scoped_refptr",
|
||||||
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:stringutils",
|
"../../rtc_base:stringutils",
|
||||||
"../../system_wrappers:system_wrappers",
|
"../../system_wrappers:system_wrappers",
|
||||||
"../audio_codecs:audio_codecs_api",
|
"../audio_codecs:audio_codecs_api",
|
||||||
|
"../environment",
|
||||||
"../units:timestamp",
|
"../units:timestamp",
|
||||||
"//third_party/abseil-cpp/absl/types:optional",
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -14,7 +14,10 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "api/audio_codecs/audio_decoder_factory.h"
|
#include "api/audio_codecs/audio_decoder_factory.h"
|
||||||
|
#include "api/environment/environment.h"
|
||||||
#include "api/neteq/neteq.h"
|
#include "api/neteq/neteq.h"
|
||||||
|
#include "api/scoped_refptr.h"
|
||||||
|
#include "rtc_base/checks.h"
|
||||||
#include "system_wrappers/include/clock.h"
|
#include "system_wrappers/include/clock.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -27,10 +30,21 @@ class NetEqFactory {
|
|||||||
// Creates a new NetEq object, with parameters set in `config`. The `config`
|
// Creates a new NetEq object, with parameters set in `config`. The `config`
|
||||||
// object will only have to be valid for the duration of the call to this
|
// object will only have to be valid for the duration of the call to this
|
||||||
// method.
|
// method.
|
||||||
|
virtual std::unique_ptr<NetEq> Create(
|
||||||
|
const Environment& env,
|
||||||
|
const NetEq::Config& config,
|
||||||
|
scoped_refptr<AudioDecoderFactory> decoder_factory) const {
|
||||||
|
return CreateNetEq(config, decoder_factory, &env.clock());
|
||||||
|
}
|
||||||
|
|
||||||
virtual std::unique_ptr<NetEq> CreateNetEq(
|
virtual std::unique_ptr<NetEq> CreateNetEq(
|
||||||
const NetEq::Config& config,
|
const NetEq::Config& config,
|
||||||
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory,
|
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory,
|
||||||
Clock* clock) const = 0;
|
Clock* clock) const {
|
||||||
|
// TODO: b/356878416 - Delete this function when all callers are migrated
|
||||||
|
// to `Create` function above.
|
||||||
|
RTC_CHECK_NOTREACHED();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
@ -39,12 +39,12 @@ namespace {
|
|||||||
std::unique_ptr<NetEq> CreateNetEq(
|
std::unique_ptr<NetEq> CreateNetEq(
|
||||||
NetEqFactory* neteq_factory,
|
NetEqFactory* neteq_factory,
|
||||||
const NetEq::Config& config,
|
const NetEq::Config& config,
|
||||||
Clock* clock,
|
const Environment& env,
|
||||||
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
|
scoped_refptr<AudioDecoderFactory> decoder_factory) {
|
||||||
if (neteq_factory) {
|
if (neteq_factory) {
|
||||||
return neteq_factory->CreateNetEq(config, decoder_factory, clock);
|
return neteq_factory->Create(env, config, std::move(decoder_factory));
|
||||||
}
|
}
|
||||||
return DefaultNetEqFactory().CreateNetEq(config, decoder_factory, clock);
|
return DefaultNetEqFactory().Create(env, config, std::move(decoder_factory));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -60,8 +60,8 @@ AcmReceiver::AcmReceiver(const Environment& env, Config config)
|
|||||||
: env_(env),
|
: env_(env),
|
||||||
neteq_(CreateNetEq(config.neteq_factory,
|
neteq_(CreateNetEq(config.neteq_factory,
|
||||||
config.neteq_config,
|
config.neteq_config,
|
||||||
&env_.clock(),
|
env_,
|
||||||
config.decoder_factory)),
|
std::move(config.decoder_factory))),
|
||||||
resampled_last_output_frame_(true) {
|
resampled_last_output_frame_(true) {
|
||||||
ClearSamples(last_audio_buffer_);
|
ClearSamples(last_audio_buffer_);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user