ref: fdc977afc6b431c7577e70d151f89ea726bcaf8f
parent: 73f45fcf0b2144d7b84014dd5a7e9b486d03fba1
author: James Zern <[email protected]>
date: Tue Feb 16 14:33:16 EST 2016
vp10,encoder: relocate setjmp move to encoder_encode() as vp10_get_compressed_data() allocates data and would require some modification to make its error return meaningful. Change-Id: Ia5267c35d16ccd42b6da6d2136402b13e28f9159
--- a/vp10/encoder/encoder.c
+++ b/vp10/encoder/encoder.c
@@ -3808,9 +3808,9 @@
int vp10_receive_raw_frame(VP10_COMP *cpi, unsigned int frame_flags,
YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
int64_t end_time) {
- VP10_COMMON *volatile const cm = &cpi->common;
+ VP10_COMMON *const cm = &cpi->common;
struct vpx_usec_timer timer;
- volatile int res = 0;
+ int res = 0;
const int subsampling_x = sd->subsampling_x;
const int subsampling_y = sd->subsampling_y;
#if CONFIG_VP9_HIGHBITDEPTH
@@ -3817,12 +3817,6 @@
const int use_highbitdepth = (sd->flags & YV12_FLAG_HIGHBITDEPTH) != 0;
#endif
- if (setjmp(cm->error.jmp)) {
- cm->error.setjmp = 0;
- return -1;
- }
- cm->error.setjmp = 1;
-
#if CONFIG_VP9_HIGHBITDEPTH
check_initial_width(cpi, use_highbitdepth, subsampling_x, subsampling_y);
#else
@@ -3856,7 +3850,6 @@
res = -1;
}
- cm->error.setjmp = 0;
return res;
}
--- a/vp10/vp10_cx_iface.c
+++ b/vp10/vp10_cx_iface.c
@@ -14,6 +14,7 @@
#include "./vpx_config.h"
#include "vpx/vpx_encoder.h"
#include "vpx_ports/vpx_once.h"
+#include "vpx_ports/system_state.h"
#include "vpx/internal/vpx_codec_internal.h"
#include "./vpx_version.h"
#include "vp10/encoder/encoder.h"
@@ -885,9 +886,10 @@
const vpx_image_t *img,
vpx_codec_pts_t pts,
unsigned long duration,
- vpx_enc_frame_flags_t flags,
+ vpx_enc_frame_flags_t enc_flags,
unsigned long deadline) {
- vpx_codec_err_t res = VPX_CODEC_OK;
+ volatile vpx_codec_err_t res = VPX_CODEC_OK;
+ volatile vpx_enc_frame_flags_t flags = enc_flags;
VP10_COMP *const cpi = ctx->cpi;
const vpx_rational_t *const timebase = &ctx->cfg.g_timebase;
size_t data_sz;
@@ -926,6 +928,14 @@
return VPX_CODEC_INVALID_PARAM;
}
+ if (setjmp(cpi->common.error.jmp)) {
+ cpi->common.error.setjmp = 0;
+ res = update_error_state(ctx, &cpi->common.error);
+ vpx_clear_system_state();
+ return res;
+ }
+ cpi->common.error.setjmp = 1;
+
vp10_apply_encoding_flags(cpi, flags);
// Handle fixed keyframe intervals
@@ -976,7 +986,8 @@
* the buffer size anyway.
*/
if (cx_data_sz < ctx->cx_data_sz / 2) {
- ctx->base.err_detail = "Compressed data buffer too small";
+ vpx_internal_error(&cpi->common.error, VPX_CODEC_ERROR,
+ "Compressed data buffer too small");
return VPX_CODEC_ERROR;
}
}
@@ -1065,6 +1076,7 @@
}
}
+ cpi->common.error.setjmp = 0;
return res;
}