ref: 27f1838519ea1354bb8a038ec4e9d2c6da0da994
parent: f4fc562489bcee227403ca00f589e70043ebc5dc
author: Angie Chiang <angiebird@google.com>
date: Tue Jan 19 12:48:07 EST 2021
Return status in vp9_extrc_send_firstpass_stats Bug: webm:1716 Change-Id: I96b18436c58ed888fcf677097819cc0093b6f41d
--- a/vp9/encoder/vp9_ext_ratectrl.c
+++ b/vp9/encoder/vp9_ext_ratectrl.c
@@ -94,9 +94,13 @@
rc_frame_stats->count = stats->count;
}
-void vp9_extrc_send_firstpass_stats(EXT_RATECTRL *ext_ratectrl,
- const FIRST_PASS_INFO *first_pass_info) {
+vpx_codec_err_t vp9_extrc_send_firstpass_stats(
+ EXT_RATECTRL *ext_ratectrl, const FIRST_PASS_INFO *first_pass_info) {
+ if (ext_ratectrl == NULL) {
+ return VPX_CODEC_ERROR;
+ }
if (ext_ratectrl->ready) {
+ vpx_rc_status_t rc_status;
vpx_rc_firstpass_stats_t *rc_firstpass_stats =
&ext_ratectrl->rc_firstpass_stats;
int i;
@@ -105,9 +109,13 @@
gen_rc_firstpass_stats(&first_pass_info->stats[i],
&rc_firstpass_stats->frame_stats[i]);
}
- ext_ratectrl->funcs.send_firstpass_stats(ext_ratectrl->model,
- rc_firstpass_stats);
+ rc_status = ext_ratectrl->funcs.send_firstpass_stats(ext_ratectrl->model,
+ rc_firstpass_stats);
+ if (rc_status == VPX_RC_ERROR) {
+ return VPX_CODEC_ERROR;
+ }
}
+ return VPX_CODEC_OK;
}
static int extrc_get_frame_type(FRAME_UPDATE_TYPE update_type) {
--- a/vp9/encoder/vp9_ext_ratectrl.h
+++ b/vp9/encoder/vp9_ext_ratectrl.h
@@ -30,8 +30,8 @@
vpx_codec_err_t vp9_extrc_delete(EXT_RATECTRL *ext_ratectrl);
-void vp9_extrc_send_firstpass_stats(EXT_RATECTRL *ext_ratectrl,
- const FIRST_PASS_INFO *first_pass_info);
+vpx_codec_err_t vp9_extrc_send_firstpass_stats(
+ EXT_RATECTRL *ext_ratectrl, const FIRST_PASS_INFO *first_pass_info);
void vp9_extrc_get_encodeframe_decision(
EXT_RATECTRL *ext_ratectrl, int show_index, int coding_index, int gop_index,