mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-20 09:07:52 +01:00
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
3 changed files with 23 additions and 7 deletions
|
@ -21,9 +21,11 @@ rtc_source_set("neteq_api") {
|
|||
"..:rtp_headers",
|
||||
"..:rtp_packet_info",
|
||||
"..:scoped_refptr",
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:stringutils",
|
||||
"../../system_wrappers:system_wrappers",
|
||||
"../audio_codecs:audio_codecs_api",
|
||||
"../environment",
|
||||
"../units:timestamp",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
#include <memory>
|
||||
|
||||
#include "api/audio_codecs/audio_decoder_factory.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/neteq/neteq.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -27,10 +30,21 @@ class NetEqFactory {
|
|||
// 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
|
||||
// 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(
|
||||
const NetEq::Config& config,
|
||||
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
|
||||
|
|
|
@ -39,12 +39,12 @@ namespace {
|
|||
std::unique_ptr<NetEq> CreateNetEq(
|
||||
NetEqFactory* neteq_factory,
|
||||
const NetEq::Config& config,
|
||||
Clock* clock,
|
||||
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
|
||||
const Environment& env,
|
||||
scoped_refptr<AudioDecoderFactory> decoder_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
|
||||
|
@ -60,8 +60,8 @@ AcmReceiver::AcmReceiver(const Environment& env, Config config)
|
|||
: env_(env),
|
||||
neteq_(CreateNetEq(config.neteq_factory,
|
||||
config.neteq_config,
|
||||
&env_.clock(),
|
||||
config.decoder_factory)),
|
||||
env_,
|
||||
std::move(config.decoder_factory))),
|
||||
resampled_last_output_frame_(true) {
|
||||
ClearSamples(last_audio_buffer_);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue