Return int from av1_pack_bitstream().
- Stop relying on asserts for error checking.
- Update callers to check for and return errors where required.
Change-Id: Id6a39b14397394b85aaa9dc8b168f7a26f04919b
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index a0b5268..443a856 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -4682,7 +4682,7 @@
#endif
-void av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dst, size_t *size) {
+int av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dst, size_t *size) {
uint8_t *data = dst;
uint32_t data_size;
unsigned int max_tile_size;
@@ -4824,6 +4824,8 @@
assert(tile_size_bytes >= 1 && tile_size_bytes <= 4);
aom_wb_write_literal(&saved_wb, tile_size_bytes - 1, 2);
}
+
+ if (compressed_hdr_size > 0xffff) return AOM_CODEC_ERROR;
} else {
#endif // CONFIG_EXT_TILE
data += data_size;
@@ -4831,4 +4833,5 @@
}
#endif // CONFIG_EXT_TILE
*size = data - dst;
+ return AOM_CODEC_OK;
}