Add builder setters for ScalableVideoStructure::LayerFrameConfig
Bug: None Change-Id: I19721f87b9f4641e093dc51f9c023b0493adcf97 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176702 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31473}
This commit is contained in:
committed by
Commit Bot
parent
c186e1498b
commit
a48dd43fe1
@ -28,23 +28,44 @@ class ScalableVideoController {
|
||||
int num_spatial_layers = 1;
|
||||
int num_temporal_layers = 1;
|
||||
};
|
||||
struct LayerFrameConfig {
|
||||
class LayerFrameConfig {
|
||||
public:
|
||||
// Builders/setters.
|
||||
LayerFrameConfig& Id(int value);
|
||||
LayerFrameConfig& Keyframe();
|
||||
LayerFrameConfig& S(int value);
|
||||
LayerFrameConfig& T(int value);
|
||||
LayerFrameConfig& Reference(int buffer_id);
|
||||
LayerFrameConfig& Update(int buffer_id);
|
||||
LayerFrameConfig& ReferenceAndUpdate(int buffer_id);
|
||||
|
||||
// Getters.
|
||||
int Id() const { return id_; }
|
||||
bool IsKeyframe() const { return is_keyframe_; }
|
||||
int SpatialId() const { return spatial_id_; }
|
||||
int TemporalId() const { return temporal_id_; }
|
||||
const absl::InlinedVector<CodecBufferUsage, kMaxEncoderBuffers>& Buffers()
|
||||
const {
|
||||
return buffers_;
|
||||
}
|
||||
|
||||
private:
|
||||
// Id to match configuration returned by NextFrameConfig with
|
||||
// (possibly modified) configuration passed back via OnEncoderDone.
|
||||
// The meaning of the id is an implementation detail of
|
||||
// the ScalableVideoController.
|
||||
int id = 0;
|
||||
int id_ = 0;
|
||||
|
||||
// Indication frame should be encoded as a key frame. In particular when
|
||||
// `is_keyframe=true` property `CodecBufferUsage::referenced` should be
|
||||
// ignored and treated as false.
|
||||
bool is_keyframe = false;
|
||||
bool is_keyframe_ = false;
|
||||
|
||||
int spatial_id = 0;
|
||||
int temporal_id = 0;
|
||||
int spatial_id_ = 0;
|
||||
int temporal_id_ = 0;
|
||||
// Describes how encoder which buffers encoder allowed to reference and
|
||||
// which buffers encoder should update.
|
||||
absl::InlinedVector<CodecBufferUsage, kMaxEncoderBuffers> buffers;
|
||||
absl::InlinedVector<CodecBufferUsage, kMaxEncoderBuffers> buffers_;
|
||||
};
|
||||
|
||||
virtual ~ScalableVideoController() = default;
|
||||
@ -66,6 +87,43 @@ class ScalableVideoController {
|
||||
LayerFrameConfig config) = 0;
|
||||
};
|
||||
|
||||
// Below are implementation details.
|
||||
inline ScalableVideoController::LayerFrameConfig&
|
||||
ScalableVideoController::LayerFrameConfig::Id(int value) {
|
||||
id_ = value;
|
||||
return *this;
|
||||
}
|
||||
inline ScalableVideoController::LayerFrameConfig&
|
||||
ScalableVideoController::LayerFrameConfig::Keyframe() {
|
||||
is_keyframe_ = true;
|
||||
return *this;
|
||||
}
|
||||
inline ScalableVideoController::LayerFrameConfig&
|
||||
ScalableVideoController::LayerFrameConfig::S(int value) {
|
||||
spatial_id_ = value;
|
||||
return *this;
|
||||
}
|
||||
inline ScalableVideoController::LayerFrameConfig&
|
||||
ScalableVideoController::LayerFrameConfig::T(int value) {
|
||||
temporal_id_ = value;
|
||||
return *this;
|
||||
}
|
||||
inline ScalableVideoController::LayerFrameConfig&
|
||||
ScalableVideoController::LayerFrameConfig::Reference(int buffer_id) {
|
||||
buffers_.emplace_back(buffer_id, /*referenced=*/true, /*updated=*/false);
|
||||
return *this;
|
||||
}
|
||||
inline ScalableVideoController::LayerFrameConfig&
|
||||
ScalableVideoController::LayerFrameConfig::Update(int buffer_id) {
|
||||
buffers_.emplace_back(buffer_id, /*referenced=*/false, /*updated=*/true);
|
||||
return *this;
|
||||
}
|
||||
inline ScalableVideoController::LayerFrameConfig&
|
||||
ScalableVideoController::LayerFrameConfig::ReferenceAndUpdate(int buffer_id) {
|
||||
buffers_.emplace_back(buffer_id, /*referenced=*/true, /*updated=*/true);
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_AV1_SCALABLE_VIDEO_CONTROLLER_H_
|
||||
|
||||
Reference in New Issue
Block a user