codec2: Add support for B frames in C2SoftAvcEnc plugin
Test: VtsHidlC2V1_0TargetVideoEncTest -I software -C c2.android.avc.encoder -P /sdcard/res/
Bug: 122593474
Change-Id: Id9b40accd4185183e12e20e9dea5e88e8295fae0
diff --git a/media/codec2/components/avc/C2SoftAvcEnc.h b/media/codec2/components/avc/C2SoftAvcEnc.h
index 58a86d8..555055b 100644
--- a/media/codec2/components/avc/C2SoftAvcEnc.h
+++ b/media/codec2/components/avc/C2SoftAvcEnc.h
@@ -33,6 +33,7 @@
#define LEN_STATUS_BUFFER (10 * 1024)
#define MAX_VBV_BUFF_SIZE (120 * 16384)
#define MAX_NUM_IO_BUFS 3
+#define MAX_B_FRAMES 1
#define DEFAULT_MAX_REF_FRM 2
#define DEFAULT_MAX_REORDER_FRM 0
@@ -167,7 +168,6 @@
bool mSpsPpsHeaderReceived;
bool mSawInputEOS;
- bool mSawOutputEOS;
bool mSignalledError;
bool mIntra4x4;
bool mEnableFastSad;
@@ -183,6 +183,8 @@
size_t mNumMemRecords; // Number of memory records requested by codec
size_t mNumCores; // Number of cores used by the codec
+ std::shared_ptr<C2LinearBlock> mOutBlock;
+
// configurations used by component in process
// (TODO: keep this in intf but make them internal only)
std::shared_ptr<C2StreamPictureSizeInfo::input> mSize;
@@ -230,7 +232,13 @@
const C2GraphicView *const input,
uint8_t *base,
uint32_t capacity,
- uint64_t timestamp);
+ uint64_t workIndex);
+ void finishWork(uint64_t workIndex,
+ const std::unique_ptr<C2Work> &work,
+ ive_video_encode_op_t *ps_encode_op);
+ c2_status_t drainInternal(uint32_t drainMode,
+ const std::shared_ptr<C2BlockPool> &pool,
+ const std::unique_ptr<C2Work> &work);
C2_DO_NOT_COPY(C2SoftAvcEnc);
};