summaryrefslogtreecommitdiffstats
path: root/libhb/work.c
diff options
context:
space:
mode:
authorRodeo <[email protected]>2015-06-23 22:35:29 +0000
committerRodeo <[email protected]>2015-06-23 22:35:29 +0000
commit293083e5a6c9cff671bcd2060468832d566f55b3 (patch)
tree6f3d825c157166c7edd94ee8f595fa51d11f031f /libhb/work.c
parent4b36930c67ac7013618b82233222ebfacd18d9ea (diff)
libhb: re-work OpenCL cleanup a bit.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7313 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/work.c')
-rw-r--r--libhb/work.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/libhb/work.c b/libhb/work.c
index 3d158862b..a31333d86 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -614,12 +614,23 @@ static void do_job(hb_job_t *job)
job->list_work = hb_list_init();
- /* OpenCL */
+ /*
+ * OpenCL
+ *
+ * Note: we delay hb_ocl_init until here, since they're no point it loading
+ * the library if we aren't going to use it. But we only call hb_ocl_close
+ * in hb_global_close, since un/reloading the library each run is wasteful.
+ */
if (job->use_opencl && (hb_ocl_init() || hb_init_opencl_run_env(0, NULL, "-I.")))
{
hb_log("work: failed to initialize OpenCL environment, using fallback");
+ hb_release_opencl_run_env();
job->use_opencl = 0;
- hb_ocl_close();
+ }
+ else
+ {
+ // we're not (re-)using OpenCL here, we can release the environment
+ hb_release_opencl_run_env();
}
hb_log( "starting job" );
@@ -1730,12 +1741,6 @@ cleanup:
}
hb_buffer_pool_free();
-
- /* OpenCL: must be closed *after* freeing the buffer pool */
- if (job->use_opencl)
- {
- hb_ocl_close();
- }
hb_job_close( &job );
}