Index: webrtc/modules/video_coding/codecs/vp9/vp9_impl.h |
diff --git a/webrtc/modules/video_coding/codecs/vp9/vp9_impl.h b/webrtc/modules/video_coding/codecs/vp9/vp9_impl.h |
index c164a63980f2dedf54149e4f6e30477682f947e8..980b748a89011183e4a04bda1727bbfc55178e54 100644 |
--- a/webrtc/modules/video_coding/codecs/vp9/vp9_impl.h |
+++ b/webrtc/modules/video_coding/codecs/vp9/vp9_impl.h |
@@ -13,6 +13,7 @@ |
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_IMPL_H_ |
#include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
+#include "webrtc/modules/video_coding/codecs/vp9/screenshare_layers.h" |
#include "webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h" |
#include "vpx/svc_context.h" |
@@ -58,6 +59,30 @@ class VP9EncoderImpl : public VP9Encoder { |
bool SetSvcRates(); |
+ /* |
+ * Generate the flags used when calling vpx_encoder_encode and also |
+ * saves information used to reference this frame to earlier frames. |
+ * Used in flexible mode and has to be called for every frame (even |
+ * keyframes) in order to update its state. The information used |
+ * for references is saved in p_diff_ and num_ref_pics_. |
+ * |
+ * upd_buffer - which buffer to update: |
+ * -2: this is a keyframe, always stored in buffer |
+ * 0 and all other params are ignored |
+ * -1: don't update any buffers |
+ * 0..2: update buffer 0..2 |
+ * |
+ * ref_buf1, ref_buf2, ref_buf3 - which buffers to reference back to: |
+ * -1: don't reference any buffer |
+ * 0..2: reference buffer 0..2 |
+ * |
+ */ |
+ vpx_enc_frame_flags_t GenerateRefsAndFlags(int8_t upd_buffer = -2, |
+ int8_t ref_buf1 = -1, |
+ int8_t ref_buf2 = -1, |
+ int8_t ref_buf3 = -1); |
+ vpx_enc_frame_flags_t GenerateRefsAndFlags(std::array<int8_t, 4> args); |
+ |
virtual int GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt); |
// Callback function for outputting packets per spatial layer. |
@@ -88,9 +113,17 @@ class VP9EncoderImpl : public VP9Encoder { |
GofInfoVP9 gof_; // Contains each frame's temporal information for |
// non-flexible mode. |
uint8_t tl0_pic_idx_; // Only used in non-flexible mode. |
- size_t gof_idx_; // Only used in non-flexible mode. |
+ size_t frames_since_kf_; |
uint8_t num_temporal_layers_; |
uint8_t num_spatial_layers_; |
+ |
+ // Used for flexible mode |
+ bool is_flexible_mode_; |
+ int64_t buf_upd_at_frame_[8]; |
+ int64_t frames_encoded_; |
+ uint8_t num_refs_pics_; |
+ uint8_t p_diff_[kMaxVp9RefPics]; |
+ ScreenshareLayersVP9 temporal_layer_; |
}; |