History

Handle vp9_extrc functions' return status properly

Angie Chiang committed 5 years ago

Commit f57fa3f1 parent 3aecf4a2 files · +29 −6Browse files

Unified · Split

2 files
  1. vp9/encoder/vp9_encoder.c +24 −5
  2. vp9/vp9_cx_iface.c +5 −1
vp9/encoder/vp9_encoder.c+24−5
@@ -2464,7 +2464,12 @@ VP9_COMP *vp9_create_compressor(const VP9EncoderConfig *oxcf, · 2463 unmodified lines
24642464
24652465 cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
24662466
2467− vp9_extrc_init(&cpi->ext_ratectrl);
2467+ {
2468+ vpx_codec_err_t codec_status = vp9_extrc_init(&cpi->ext_ratectrl);
2469+ if (codec_status != VPX_CODEC_OK) {
2470+ vpx_internal_error(&cm->error, codec_status, "vp9_extrc_init() failed");
2471+ }
2472+ }
24682473
24692474 #if !CONFIG_REALTIME_ONLY
24702475 if (oxcf->pass == 1) {
@@ -4503,6 +4508,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size, uint8_t *dest · 2032 unmodified lines
45034508 }
45044509 #endif
45054510 if (cpi->ext_ratectrl.ready) {
4511+ vpx_codec_err_t codec_status;
45064512 const GF_GROUP *gf_group = &cpi->twopass.gf_group;
45074513 vpx_rc_encodeframe_decision_t encode_frame_decision;
45084514 FRAME_UPDATE_TYPE update_type = gf_group->update_type[gf_group->index];
@@ -4511,10 +4517,14 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size, uint8_t *dest · 2 unmodified lines
45114517 const RefCntBuffer *curr_frame_buf =
45124518 get_ref_cnt_buffer(cm, cm->new_fb_idx);
45134519 get_ref_frame_bufs(cpi, ref_frame_bufs);
4514− vp9_extrc_get_encodeframe_decision(
4520+ codec_status = vp9_extrc_get_encodeframe_decision(
45154521 &cpi->ext_ratectrl, curr_frame_buf->frame_index,
45164522 cm->current_frame_coding_index, gf_group->index, update_type,
45174523 ref_frame_bufs, ref_frame_flags, &encode_frame_decision);
4524+ if (codec_status != VPX_CODEC_OK) {
4525+ vpx_internal_error(&cm->error, codec_status,
4526+ "vp9_extrc_get_encodeframe_decision() failed");
4527+ }
45184528 q = encode_frame_decision.q_index;
45194529 }
45204530
@@ -5489,9 +5499,13 @@ static void encode_frame_to_data_rate( · 968 unmodified lines
54895499 {
54905500 const RefCntBuffer *coded_frame_buf =
54915501 get_ref_cnt_buffer(cm, cm->new_fb_idx);
5492− vp9_extrc_update_encodeframe_result(
5502+ vpx_codec_err_t codec_status = vp9_extrc_update_encodeframe_result(
54935503 &cpi->ext_ratectrl, (*size) << 3, cpi->Source, &coded_frame_buf->buf,
54945504 cm->bit_depth, cpi->oxcf.input_bit_depth);
5505+ if (codec_status != VPX_CODEC_OK) {
5506+ vpx_internal_error(&cm->error, codec_status,
5507+ "vp9_extrc_update_encodeframe_result() failed");
5508+ }
54955509 }
54965510 #if CONFIG_REALTIME_ONLY
54975511 (void)encode_frame_result;
@@ -5682,8 +5696,13 @@ static void Pass2Encode(VP9_COMP *cpi, size_t *size, uint8_t *dest, · 184 unmodified lines
56825696 cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
56835697
56845698 if (cpi->common.current_frame_coding_index == 0) {
5685− vp9_extrc_send_firstpass_stats(&cpi->ext_ratectrl,
5686− &cpi->twopass.first_pass_info);
5699+ VP9_COMMON *cm = &cpi->common;
5700+ const vpx_codec_err_t codec_status = vp9_extrc_send_firstpass_stats(
5701+ &cpi->ext_ratectrl, &cpi->twopass.first_pass_info);
5702+ if (codec_status != VPX_CODEC_OK) {
5703+ vpx_internal_error(&cm->error, codec_status,
5704+ "vp9_extrc_send_firstpass_stats() failed");
5705+ }
56875706 }
56885707 #if CONFIG_MISMATCH_DEBUG
56895708 mismatch_move_frame_idx_w();
vp9/vp9_cx_iface.c+5−1
@@ -1744,6 +1744,7 @@ static vpx_codec_err_t ctrl_set_external_rate_control(vpx_codec_alg_priv_t *ctx, · 1743 unmodified lines
17441744 if (oxcf->pass == 2) {
17451745 const FRAME_INFO *frame_info = &cpi->frame_info;
17461746 vpx_rc_config_t ratectrl_config;
1747+ vpx_codec_err_t codec_status;
17471748
17481749 ratectrl_config.frame_width = frame_info->frame_width;
17491750 ratectrl_config.frame_height = frame_info->frame_height;
@@ -1755,7 +1756,10 @@ static vpx_codec_err_t ctrl_set_external_rate_control(vpx_codec_alg_priv_t *ctx, · 5 unmodified lines
17551756 ratectrl_config.frame_rate_num = oxcf->g_timebase.den;
17561757 ratectrl_config.frame_rate_den = oxcf->g_timebase.num;
17571758
1758− vp9_extrc_create(funcs, ratectrl_config, ext_ratectrl);
1759+ codec_status = vp9_extrc_create(funcs, ratectrl_config, ext_ratectrl);
1760+ if (codec_status != VPX_CODEC_OK) {
1761+ return codec_status;
1762+ }
17591763 }
17601764 return VPX_CODEC_OK;
17611765 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t