Add factory function for legacy VideoCoding that takes Environment

That forces external field trials, thus VideoCoding will be able to remove dependency on the global field trials string through FieldTrialBasedConfig class.

Bug: webrtc:10335
Change-Id: I6d22a7d20a4433801a0086b0863cda78e91f4f60
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347646
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42092}
This commit is contained in:
Danil Chapovalov 2024-04-16 14:22:29 +02:00 committed by WebRTC LUCI CQ
parent 5bdd54beb3
commit 366a1bc709
3 changed files with 13 additions and 2 deletions

View File

@ -333,6 +333,7 @@ rtc_library("video_coding_legacy") {
"../../api:rtp_headers",
"../../api:rtp_packet_info",
"../../api:sequence_checker",
"../../api/environment",
"../../api/transport:field_trial_based_config",
"../../api/units:timestamp",
"../../api/video:encoded_image",

View File

@ -11,6 +11,9 @@
#ifndef MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_H_
#define MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_H_
#include <memory>
#include "api/environment/environment.h"
#include "api/field_trials_view.h"
#include "api/video/video_frame.h"
#include "api/video_codecs/video_decoder.h"
@ -27,10 +30,11 @@ struct CodecSpecificInfo;
class VideoCodingModule {
public:
// DEPRECATED.
static VideoCodingModule* Create(
[[deprecated]] static VideoCodingModule* Create(
Clock* clock,
const FieldTrialsView* field_trials = nullptr);
[[deprecated]] static std::unique_ptr<VideoCodingModule> CreateDeprecated(
const Environment& env);
virtual ~VideoCodingModule() = default;

View File

@ -251,4 +251,10 @@ VideoCodingModule* VideoCodingModule::Create(
return new VideoCodingModuleImpl(clock, field_trials);
}
std::unique_ptr<VideoCodingModule> VideoCodingModule::CreateDeprecated(
const Environment& env) {
return std::make_unique<VideoCodingModuleImpl>(&env.clock(),
&env.field_trials());
}
} // namespace webrtc