Index: source/libvpx/vp8/vp8_dx_iface.c |
=================================================================== |
--- source/libvpx/vp8/vp8_dx_iface.c (revision 290053) |
+++ source/libvpx/vp8/vp8_dx_iface.c (working copy) |
@@ -60,6 +60,7 @@ |
vpx_decrypt_cb decrypt_cb; |
void *decrypt_state; |
vpx_image_t img; |
+ int flushed; |
int img_setup; |
struct frame_buffers yv12_frame_buffers; |
void *user_priv; |
@@ -88,6 +89,7 @@ |
ctx->priv->alg_priv->si.sz = sizeof(ctx->priv->alg_priv->si); |
ctx->priv->alg_priv->decrypt_cb = NULL; |
ctx->priv->alg_priv->decrypt_state = NULL; |
+ ctx->priv->alg_priv->flushed = 0; |
ctx->priv->init_flags = ctx->init_flags; |
if (ctx->config.dec) |
@@ -328,7 +330,14 @@ |
unsigned int resolution_change = 0; |
unsigned int w, h; |
+ if (data == NULL && data_sz == 0) { |
+ ctx->flushed = 1; |
+ return VPX_CODEC_OK; |
+ } |
+ /* Reset flushed when receiving a valid frame */ |
+ ctx->flushed = 0; |
+ |
/* Update the input fragment data */ |
if(update_fragments(ctx, data, data_sz, &res) <= 0) |
return res; |
@@ -557,17 +566,23 @@ |
static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img, |
YV12_BUFFER_CONFIG *yv12) |
{ |
+ const int y_w = img->d_w; |
+ const int y_h = img->d_h; |
+ const int uv_w = (img->d_w + 1) / 2; |
+ const int uv_h = (img->d_h + 1) / 2; |
vpx_codec_err_t res = VPX_CODEC_OK; |
yv12->y_buffer = img->planes[VPX_PLANE_Y]; |
yv12->u_buffer = img->planes[VPX_PLANE_U]; |
yv12->v_buffer = img->planes[VPX_PLANE_V]; |
- yv12->y_crop_width = img->d_w; |
- yv12->y_crop_height = img->d_h; |
- yv12->y_width = img->d_w; |
- yv12->y_height = img->d_h; |
- yv12->uv_width = yv12->y_width / 2; |
- yv12->uv_height = yv12->y_height / 2; |
+ yv12->y_crop_width = y_w; |
+ yv12->y_crop_height = y_h; |
+ yv12->y_width = y_w; |
+ yv12->y_height = y_h; |
+ yv12->uv_crop_width = uv_w; |
+ yv12->uv_crop_height = uv_h; |
+ yv12->uv_width = uv_w; |
+ yv12->uv_height = uv_h; |
yv12->y_stride = img->stride[VPX_PLANE_Y]; |
yv12->uv_stride = img->stride[VPX_PLANE_U]; |
@@ -737,8 +752,9 @@ |
if (corrupted && pbi) |
{ |
- *corrupted = pbi->common.frame_to_show->corrupted; |
- |
+ const YV12_BUFFER_CONFIG *const frame = pbi->common.frame_to_show; |
+ if (frame == NULL) return VPX_CODEC_ERROR; |
+ *corrupted = frame->corrupted; |
return VPX_CODEC_OK; |
} |
else |
@@ -794,8 +810,6 @@ |
vp8_init, /* vpx_codec_init_fn_t init; */ |
vp8_destroy, /* vpx_codec_destroy_fn_t destroy; */ |
vp8_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */ |
- NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */ |
- NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */ |
{ |
vp8_peek_si, /* vpx_codec_peek_si_fn_t peek_si; */ |
vp8_get_si, /* vpx_codec_get_si_fn_t get_si; */ |
@@ -804,6 +818,7 @@ |
NOT_IMPLEMENTED, |
}, |
{ /* encoder functions */ |
+ 0, |
NOT_IMPLEMENTED, |
NOT_IMPLEMENTED, |
NOT_IMPLEMENTED, |