Enforce VideoEncoderConfig.num_temporal_layers >= 1.

This change clarifies the semantics of this field:
  unset: Depends on context.
  == 0: Invalid.
  == 1: No temporal layering.
  >= 2: Temporal layering.

We should try to remove the wrapping optional later.

Bug: webrtc:11297
Change-Id: Id765f2dc1d31a4ba3cd424978ac6054cd60152ea
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166528
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30336}
This commit is contained in:
Rasmus Brandt
2020-01-21 13:54:11 +01:00
committed by Commit Bot
parent d74c56fcd0
commit 43bfe0b8a6
5 changed files with 35 additions and 4 deletions

View File

@ -24,28 +24,47 @@
namespace webrtc {
// The |VideoStream| struct describes a simulcast layer, or "stream".
struct VideoStream {
VideoStream();
~VideoStream();
VideoStream(const VideoStream& other);
std::string ToString() const;
// Width in pixels.
size_t width;
// Height in pixels.
size_t height;
// Frame rate in fps.
int max_framerate;
// Bitrate, in bps, for the stream.
int min_bitrate_bps;
int target_bitrate_bps;
int max_bitrate_bps;
// Scaling factor applied to the stream size.
// |width| and |height| values are already scaled down.
double scale_resolution_down_by;
// Maximum Quantization Parameter to use when encoding the stream.
int max_qp;
// Determines the number of temporal layers that the stream should be
// encoded with. This value should be greater than zero.
// TODO(brandtr): This class is used both for configuring the encoder
// (meaning that this field _must_ be set), and for signaling the app-level
// encoder settings (meaning that the field _may_ be set). We should separate
// this and remove this optional instead.
absl::optional<size_t> num_temporal_layers;
// The priority of this stream, to be used when allocating resources
// between multiple streams.
absl::optional<double> bitrate_priority;
// If this stream is enabled by the user, or not.
bool active;
};