webrtc_m130/api/video_codecs/vp8_frame_config.h
Elad Alon b64af4b168 Add retransmission_allowed flag to encoder output
Using this flag, an encoder may inform the RTP sender module that
the packet is not elligible for retransmission. Specifically, it
may not be retransmitted in response to a NACK message,
nor because of early loss detection (see CL #135881).

Bug: webrtc:10702
Change-Id: Ib6a9cc361cf10ea7214cf672e05940c27899a6be
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/140105
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28169}
2019-06-05 12:08:07 +00:00

104 lines
3.4 KiB
C++

/*
* Copyright (c) 2019 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 API_VIDEO_CODECS_VP8_FRAME_CONFIG_H_
#define API_VIDEO_CODECS_VP8_FRAME_CONFIG_H_
#include <stdint.h>
namespace webrtc {
// Configuration of a VP8 frame - which buffers are to be referenced
// by it, which buffers should be updated, etc.
struct Vp8FrameConfig {
enum BufferFlags : int {
kNone = 0,
kReference = 1,
kUpdate = 2,
kReferenceAndUpdate = kReference | kUpdate,
};
enum FreezeEntropy { kFreezeEntropy };
// Defined bit-maskable reference to the three buffers available in VP8.
enum class Vp8BufferReference : uint8_t {
kNone = 0,
kLast = 1,
kGolden = 2,
kAltref = 4
};
Vp8FrameConfig();
Vp8FrameConfig(BufferFlags last, BufferFlags golden, BufferFlags arf);
Vp8FrameConfig(BufferFlags last,
BufferFlags golden,
BufferFlags arf,
FreezeEntropy);
enum class Buffer : int { kLast = 0, kGolden = 1, kArf = 2, kCount };
bool References(Buffer buffer) const;
bool Updates(Buffer buffer) const;
bool IntraFrame() const {
// Intra frames do not reference any buffers, and update all buffers.
return last_buffer_flags == kUpdate && golden_buffer_flags == kUpdate &&
arf_buffer_flags == kUpdate;
}
bool drop_frame;
BufferFlags last_buffer_flags;
BufferFlags golden_buffer_flags;
BufferFlags arf_buffer_flags;
// The encoder layer ID is used to utilize the correct bitrate allocator
// inside the encoder. It does not control references nor determine which
// "actual" temporal layer this is. The packetizer temporal index determines
// which layer the encoded frame should be packetized into.
// Normally these are the same, but current temporal-layer strategies for
// screenshare use one bitrate allocator for all layers, but attempt to
// packetize / utilize references to split a stream into multiple layers,
// with different quantizer settings, to hit target bitrate.
// TODO(sprang): Screenshare layers are being reconsidered at the time of
// writing, we might be able to remove this distinction, and have a temporal
// layer imply both (the normal case).
int encoder_layer_id;
// TODO(eladalon/sprang): Move out of this class.
int packetizer_temporal_idx;
// TODO(eladalon/sprang): Move out of this class.
bool layer_sync;
bool freeze_entropy;
// Indicates in which order the encoder should search the reference buffers
// when doing motion prediction. Set to kNone to use unspecified order. Any
// buffer indicated here must not have the corresponding no_ref bit set.
// If all three buffers can be reference, the one not listed here should be
// searched last.
Vp8BufferReference first_reference;
Vp8BufferReference second_reference;
// Whether this frame is eligible for retransmission.
bool retransmission_allowed;
private:
Vp8FrameConfig(BufferFlags last,
BufferFlags golden,
BufferFlags arf,
bool freeze_entropy);
};
} // namespace webrtc
#endif // API_VIDEO_CODECS_VP8_FRAME_CONFIG_H_