Add VideoEncoderFactory::Create to pass Environment for VideoEncoder construction
Bug: webrtc:15860 Change-Id: I6197780aaaa9c29717cb94df5790645b674c3bc2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/341900 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41873}
This commit is contained in:
parent
cd54fd8606
commit
9a9f6a8441
@ -16,14 +16,15 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/units/data_rate.h"
|
||||
#include "api/video/render_resolution.h"
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class VideoEncoder;
|
||||
|
||||
// A factory that creates VideoEncoders.
|
||||
// NOTE: This class is still under development and may change without notice.
|
||||
class VideoEncoderFactory {
|
||||
@ -96,8 +97,21 @@ class VideoEncoderFactory {
|
||||
}
|
||||
|
||||
// Creates a VideoEncoder for the specified format.
|
||||
virtual std::unique_ptr<VideoEncoder> Create(const Environment& env,
|
||||
const SdpVideoFormat& format) {
|
||||
return CreateVideoEncoder(format);
|
||||
}
|
||||
|
||||
// Deprecated in favor of the `Create` above.
|
||||
// TODO: bugs.webrtc.org/15860 - Make private when all callers are updated
|
||||
// to use Create function above. Delete when all derived classes implement
|
||||
// `Create` instead of this function.
|
||||
virtual std::unique_ptr<VideoEncoder> CreateVideoEncoder(
|
||||
const SdpVideoFormat& format) = 0;
|
||||
const SdpVideoFormat& format) {
|
||||
// Newer code shouldn't call this function,
|
||||
// Older code should implement it in derived classes.
|
||||
RTC_CHECK_NOTREACHED();
|
||||
}
|
||||
|
||||
// This method creates a EncoderSelector to use for a VideoSendStream.
|
||||
// (and hence should probably been called CreateEncoderSelector()).
|
||||
|
||||
@ -947,8 +947,7 @@ void VideoStreamEncoder::ReconfigureEncoder() {
|
||||
encoder_.reset();
|
||||
|
||||
encoder_ = MaybeCreateFrameDumpingEncoderWrapper(
|
||||
settings_.encoder_factory->CreateVideoEncoder(
|
||||
encoder_config_.video_format),
|
||||
settings_.encoder_factory->Create(env_, encoder_config_.video_format),
|
||||
env_.field_trials());
|
||||
if (!encoder_) {
|
||||
RTC_LOG(LS_ERROR) << "CreateVideoEncoder failed, failing encoder format: "
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user