]> granicus.if.org Git - handbrake/commitdiff
QSV: work around an issue where two consecutive IDR frames cause Media SDK to use...
authorRodeo <tdskywalker@gmail.com>
Fri, 7 Feb 2014 15:16:24 +0000 (15:16 +0000)
committerRodeo <tdskywalker@gmail.com>
Fri, 7 Feb 2014 15:16:24 +0000 (15:16 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6016 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/enc_qsv.c

index e4d0dc04b1d44496ebca5313a73a35ee7129c7f1..6a9a27c4e9f9df9b1b6a9d94389c92e198c32751 100644 (file)
@@ -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)