diff options
author | Rodeo <[email protected]> | 2013-08-22 20:33:35 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-08-22 20:33:35 +0000 |
commit | d41905d539046445e1b81499ff7bd04d170c91d4 (patch) | |
tree | 3f39a09e757bca8bc461d46303a2cb1c35e8d9a6 /libhb/sync.c | |
parent | c1a493b581f0567eba92625f2ee132de8e7f1d6d (diff) |
Big merge, QSV to trunk: part 1 (tracked files).
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5737 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/sync.c')
-rw-r--r-- | libhb/sync.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libhb/sync.c b/libhb/sync.c index c04e517d4..8134688b3 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -527,6 +527,27 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, hb_unlock( pv->common->mutex ); UpdateSearchState( w, next_start ); +#ifdef USE_QSV + // reclaim QSV resources before dropping the buffer + // when decoding without QSV, the QSV atom will be NULL + if (job != NULL && job->qsv != NULL && next->qsv_details.qsv_atom != NULL) + { + av_qsv_stage *stage = av_qsv_get_last_stage(next->qsv_details.qsv_atom); + if (stage != NULL) + { + av_qsv_wait_on_sync(job->qsv, stage); + if (stage->out.sync->in_use > 0) + { + ff_qsv_atomic_dec(&stage->out.sync->in_use); + } + if (stage->out.p_surface->Data.Locked > 0) + { + ff_qsv_atomic_dec(&stage->out.p_surface->Data.Locked); + } + } + av_qsv_flush_stages(job->qsv->pipes, &next->qsv_details.qsv_atom); + } +#endif hb_buffer_close( &next ); return HB_WORK_OK; @@ -720,6 +741,29 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, // don't drop a chapter mark when we drop the buffer sync->chap_mark = next->s.new_chap; } + +#ifdef USE_QSV + // reclaim QSV resources before dropping the buffer + // when decoding without QSV, the QSV atom will be NULL + if (job != NULL && job->qsv != NULL && next->qsv_details.qsv_atom != NULL) + { + av_qsv_stage *stage = av_qsv_get_last_stage(next->qsv_details.qsv_atom); + if (stage != NULL) + { + av_qsv_wait_on_sync(job->qsv, stage); + if (stage->out.sync->in_use > 0) + { + ff_qsv_atomic_dec(&stage->out.sync->in_use); + } + if (stage->out.p_surface->Data.Locked > 0) + { + ff_qsv_atomic_dec(&stage->out.p_surface->Data.Locked); + } + } + av_qsv_flush_stages(job->qsv->pipes, &next->qsv_details.qsv_atom); + } +#endif + hb_buffer_close( &next ); return HB_WORK_OK; } |