]> granicus.if.org Git - handbrake/commitdiff
scan: improve preview generation for short videos that have no IDRs
authorjstebbins <jstebbins.hb@gmail.com>
Mon, 2 Feb 2015 19:11:31 +0000 (19:11 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Mon, 2 Feb 2015 19:11:31 +0000 (19:11 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.10.x@6863 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/scan.c

index b54f43b3eb3b4c6ab5c61b1fd2a019682a58e555..712ca3641e3a86fae35cc0046682d8d20483f13a 100644 (file)
@@ -594,7 +594,20 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title, int flush )
             vid_decoder->flush( vid_decoder );
         if (title->flags & HBTF_NO_IDR)
         {
-            frame_wait = 100;
+            if (!flush)
+            {
+                // If we are doing the first previews decode attempt,
+                // set this threshold high so that we get the best
+                // quality frames possible.
+                frame_wait = 100;
+            }
+            else
+            {
+                // If we failed to get enough valid frames in the first
+                // previews decode attempt, lower the threshold to improve
+                // our chances of getting something to work with.
+                frame_wait = 10;
+            }
         }
 
         hb_buffer_t * vid_buf = NULL;