* Simplified ctor. Get settings (max_qp, content_type, etc) from encoder_config passed to CreateEncoderStreams(). * Some tests assigned VideoEncoderConfig::video_stream_factory to EncoderStreamFactory they created. That's not really needed. VideoStreamEncoder creates the factory if video_stream_factory is not provided [1]. Removed video_stream_factory initialization in tests. [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/video/video_stream_encoder.cc;l=1002;drc=1d7d0e6e2c5002815853be251ce43fe88779ac85 Bug: b/347150850, webrtc:42233936 Change-Id: Ie0322abb6c48e1a9bd10e9ed3879e3ed484fea5d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/355321 Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42608}
64 lines
2.2 KiB
C++
64 lines
2.2 KiB
C++
/*
|
|
* Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
#ifndef VIDEO_CONFIG_ENCODER_STREAM_FACTORY_H_
|
|
#define VIDEO_CONFIG_ENCODER_STREAM_FACTORY_H_
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "api/field_trials_view.h"
|
|
#include "api/units/data_rate.h"
|
|
#include "api/video_codecs/video_encoder.h"
|
|
#include "call/adaptation/video_source_restrictions.h"
|
|
#include "video/config/video_encoder_config.h"
|
|
|
|
namespace cricket {
|
|
|
|
class EncoderStreamFactory
|
|
: public webrtc::VideoEncoderConfig::VideoStreamFactoryInterface {
|
|
public:
|
|
EncoderStreamFactory(const webrtc::VideoEncoder::EncoderInfo& encoder_info,
|
|
absl::optional<webrtc::VideoSourceRestrictions>
|
|
restrictions = absl::nullopt);
|
|
|
|
std::vector<webrtc::VideoStream> CreateEncoderStreams(
|
|
const webrtc::FieldTrialsView& trials,
|
|
int width,
|
|
int height,
|
|
const webrtc::VideoEncoderConfig& encoder_config) override;
|
|
|
|
private:
|
|
std::vector<webrtc::VideoStream> CreateDefaultVideoStreams(
|
|
int width,
|
|
int height,
|
|
const webrtc::VideoEncoderConfig& encoder_config,
|
|
const absl::optional<webrtc::DataRate>& experimental_min_bitrate) const;
|
|
|
|
std::vector<webrtc::VideoStream>
|
|
CreateSimulcastOrConferenceModeScreenshareStreams(
|
|
const webrtc::FieldTrialsView& trials,
|
|
int width,
|
|
int height,
|
|
const webrtc::VideoEncoderConfig& encoder_config,
|
|
const absl::optional<webrtc::DataRate>& experimental_min_bitrate) const;
|
|
|
|
webrtc::Resolution GetLayerResolutionFromRequestedResolution(
|
|
int in_frame_width,
|
|
int in_frame_height,
|
|
webrtc::Resolution requested_resolution) const;
|
|
|
|
const int encoder_info_requested_resolution_alignment_;
|
|
const absl::optional<webrtc::VideoSourceRestrictions> restrictions_;
|
|
};
|
|
|
|
} // namespace cricket
|
|
|
|
#endif // VIDEO_CONFIG_ENCODER_STREAM_FACTORY_H_
|