Chromium Code Reviews| Index: webrtc/modules/video_coding/codecs/vp8/temporal_layers.h |
| diff --git a/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h b/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h |
| index 2a41c6da8b483f6b365acf57f085ced2bc43dc7a..f24398e5ff897193f1f9da13de8f70d2f986d8d1 100644 |
| --- a/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h |
| +++ b/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h |
| @@ -24,52 +24,57 @@ namespace webrtc { |
| struct CodecSpecificInfoVP8; |
| -enum TemporalBufferFlags { |
| - kNone = 0, |
| - kReference = 1, |
| - kUpdate = 2, |
| - kReferenceAndUpdate = kReference | kUpdate, |
| -}; |
| - |
| +// TODO(pbos): Remove along with layer_sync and freeze_entropy, they are |
| +// derivable from picture_idx and should be exposed with |
| +// TL::IsLayerSync(TL::FrameConfig). |
| enum TemporalFlags { kLayerSync = 1, kFreezeEntropy = 2 }; |
| -struct TemporalReferences { |
| - TemporalReferences(TemporalBufferFlags last, |
| - TemporalBufferFlags golden, |
| - TemporalBufferFlags arf); |
| - TemporalReferences(TemporalBufferFlags last, |
| - TemporalBufferFlags golden, |
| - TemporalBufferFlags arf, |
| - int extra_flags); |
| - |
| - const bool drop_frame; |
| - const TemporalBufferFlags last_buffer_flags; |
| - const TemporalBufferFlags golden_buffer_flags; |
| - const TemporalBufferFlags arf_buffer_flags; |
| - |
| - // TODO(pbos): Consider breaking these out of here and returning only a |
| - // pattern index that needs to be returned to fill CodecSpecificInfoVP8 or |
| - // EncodeFlags. |
| - const bool layer_sync; |
| - const bool freeze_entropy; |
| - |
| - private: |
| - TemporalReferences(TemporalBufferFlags last, |
| - TemporalBufferFlags golden, |
| - TemporalBufferFlags arf, |
| - bool layer_sync, |
| - bool freeze_entropy); |
| -}; |
| - |
| class TemporalLayers { |
| public: |
| + enum BufferFlags { |
| + kNone = 0, |
| + kReference = 1, |
| + kUpdate = 2, |
| + kReferenceAndUpdate = kReference | kUpdate, |
| + }; |
| + |
| + struct FrameConfig { |
| + FrameConfig(); |
| + |
| + FrameConfig(BufferFlags last, BufferFlags golden, BufferFlags arf); |
| + FrameConfig(BufferFlags last, |
| + BufferFlags golden, |
| + BufferFlags arf, |
| + int extra_flags); |
| + |
| + bool drop_frame; |
| + BufferFlags last_buffer_flags; |
| + BufferFlags golden_buffer_flags; |
| + BufferFlags arf_buffer_flags; |
| + |
| + // TODO(pbos): Consider breaking these out of here and returning only a |
| + // pattern index that needs to be returned to fill CodecSpecificInfoVP8 or |
| + // EncodeFlags. |
| + bool layer_sync; |
| + bool freeze_entropy; |
| + |
| + int pattern_idx; |
| + |
| + private: |
| + FrameConfig(BufferFlags last, |
| + BufferFlags golden, |
| + BufferFlags arf, |
| + bool layer_sync, |
| + bool freeze_entropy); |
| + }; |
| + |
| // Factory for TemporalLayer strategy. Default behavior is a fixed pattern |
| // of temporal layers. See default_temporal_layers.cc |
| virtual ~TemporalLayers() {} |
| // Returns the recommended VP8 encode flags needed. May refresh the decoder |
| // and/or update the reference buffers. |
| - virtual TemporalReferences UpdateLayerConfig(uint32_t timestamp) = 0; |
| + virtual FrameConfig UpdateLayerConfig(uint32_t timestamp) = 0; |
| // Update state based on new bitrate target and incoming framerate. |
| // Returns the bitrate allocation for the active temporal layers. |
| @@ -82,12 +87,14 @@ class TemporalLayers { |
| virtual bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) = 0; |
| virtual void PopulateCodecSpecific(bool is_keyframe, |
| + TemporalLayers::FrameConfig tl_config, |
|
sprang_webrtc
2017/05/03 15:18:43
Since it's a proper struct now, make it const Temp
pbos-webrtc
2017/05/04 10:52:22
(FWIW: I didn't because I believe the struct is sm
|
| CodecSpecificInfoVP8* vp8_info, |
| uint32_t timestamp) = 0; |
| virtual void FrameEncoded(unsigned int size, int qp) = 0; |
| - virtual int CurrentLayerId() const = 0; |
| + virtual int GetTemporalLayerId( |
| + TemporalLayers::FrameConfig tl_config) const = 0; |
| }; |
| class TemporalLayersListener; |