ref: 7aa0c748b34a242ceb3609b0638674a1fe396931
parent: 511bf49b7ed39a5a88c0d2a1076e552760ed57ee
parent: f368f86df6705711dc3341dd910686911270ce69
author: James Zern <[email protected]>
date: Mon Jul 25 15:00:37 EDT 2016
Merge "vp9: fix frame-level threaded decode shutdown"
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -64,11 +64,16 @@
static vpx_codec_err_t decoder_destroy(vpx_codec_alg_priv_t *ctx) {
if (ctx->frame_workers != NULL) {
int i;
+ // Shutdown all threads before reclaiming any memory. The frame-level
+ // parallel decoder may access data from another worker.
for (i = 0; i < ctx->num_frame_workers; ++i) {
VPxWorker *const worker = &ctx->frame_workers[i];
+ vpx_get_worker_interface()->end(worker);
+ }
+ for (i = 0; i < ctx->num_frame_workers; ++i) {
+ VPxWorker *const worker = &ctx->frame_workers[i];
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
- vpx_get_worker_interface()->end(worker);
vp9_remove_common(&frame_worker_data->pbi->common);
#if CONFIG_VP9_POSTPROC
vp9_free_postproc_buffers(&frame_worker_data->pbi->common);