This is a reland of commit 82617ac51e7825db53451818f4d1ad52b69761fd The reason for the revert was a downstream use of `rtc::VideoSinkWants::requested_resolution`, so in this reland we don't rename this field, it's fine just to rename the one in RtpEncodingParameters for now. Original change's description: > Rename `requested_resolution` to `scale_resolution_down_to`. > > This is a pure refactor/rename CL without any changes in behavior. > > This field is called scaleResolutionDownTo in the spec and JavaScript. > Let's make C++ match to avoid confusion. > > In order not to break downstream during the transition a variable with > the old name being a pure reference to the renamed attribute is added. > This means we have to add custom constructors, but we can change this > back to "= default" when the transition is completed, which should only > be a couple of CLs away. > > Bug: webrtc:375048799 > Change-Id: If755102ccd79d46020ce5b33acd3dfcc29799e47 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/366560 > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Reviewed-by: Henrik Andreassson <henrika@webrtc.org> > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#43300} NOTRY=True Bug: webrtc:375048799 Change-Id: Ic4ee156c1d50aa36070a8d84059870791dcbbe5e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/366660 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43304}
70 lines
2.4 KiB
C++
70 lines
2.4 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,
|
|
std::optional<webrtc::VideoSourceRestrictions>
|
|
restrictions = std::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 std::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 std::optional<webrtc::DataRate>& experimental_min_bitrate) const;
|
|
|
|
webrtc::Resolution GetLayerResolutionFromScaleResolutionDownTo(
|
|
int in_frame_width,
|
|
int in_frame_height,
|
|
webrtc::Resolution scale_resolution_down_to) const;
|
|
|
|
std::vector<webrtc::Resolution> GetStreamResolutions(
|
|
const webrtc::FieldTrialsView& trials,
|
|
int width,
|
|
int height,
|
|
const webrtc::VideoEncoderConfig& encoder_config) const;
|
|
|
|
const int encoder_info_requested_resolution_alignment_;
|
|
const std::optional<webrtc::VideoSourceRestrictions> restrictions_;
|
|
};
|
|
|
|
} // namespace cricket
|
|
|
|
#endif // VIDEO_CONFIG_ENCODER_STREAM_FACTORY_H_
|