From d710c5a94605517233d8745fb8a2c379f2964cef Mon Sep 17 00:00:00 2001 From: Rodeo Date: Fri, 7 Feb 2014 15:16:24 +0000 Subject: QSV: work around an issue where two consecutive IDR frames cause Media SDK to use one more consecutive reference B-frame than accounted for by the initial PTS-DTS delay. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6016 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/enc_qsv.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c index e4d0dc04b..6a9a27c4e 100644 --- a/libhb/enc_qsv.c +++ b/libhb/enc_qsv.c @@ -1464,6 +1464,16 @@ int encqsvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, ((task->bs->TimeStamp - task->bs->DecodeTimeStamp + (duration / 2)) / duration)); + + // When forcing an IDR for a chapter right after another IDR + // selected by MSDK, we may end up with one more consecutive + // B-reference frame than the original delay accounts for; + // work around it by incrementing the delay in this case + if (pv->bfrm_workaround && job->chapter_markers && + pv->bfrm_delay > 1) + { + pv->bfrm_delay++; + } } if (!pv->bfrm_workaround) -- cgit v1.2.3