diff options
author | John Stebbins <[email protected]> | 2017-04-12 15:09:26 -0600 |
---|---|---|
committer | John Stebbins <[email protected]> | 2017-04-12 15:09:26 -0600 |
commit | 969b60fff13091268e9aa5775e6822c1bca7e874 (patch) | |
tree | 80c74e31ada627fab3b7170bd134cd3871cd378c /libhb/scan.c | |
parent | 9a22ae2b2715b088cd936ba5e7d700ee4fbea096 (diff) |
scan: fix very slow scanning for some files
The threshold in bytes for when to give up trying to decode a frame was
too big for a lot of streams. It was made large to accomodate 4K raw
video. Instead of counting bytes, count frames fed to the decoder.
This is more consistant regardless of video resolution and codec.
Diffstat (limited to 'libhb/scan.c')
-rw-r--r-- | libhb/scan.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libhb/scan.c b/libhb/scan.c index 8b5c5d47a..86d1f324d 100644 --- a/libhb/scan.c +++ b/libhb/scan.c @@ -31,7 +31,7 @@ typedef struct uint64_t min_title_duration; } hb_scan_t; -#define PREVIEW_READ_THRESH (1024 * 1024 * 300) +#define PREVIEW_READ_THRESH (200) static void ScanFunc( void * ); static int DecodePreviews( hb_scan_t *, hb_title_t * title, int flush ); @@ -676,8 +676,9 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title, int flush ) hb_buffer_t * vid_buf = NULL; - int total_read = 0, packets = 0; - while (total_read < PREVIEW_READ_THRESH || + int packets = 0; + vid_decoder->frame_count = 0; + while (vid_decoder->frame_count < PREVIEW_READ_THRESH || (!AllAudioOK(title) && packets < 10000)) { if (data->bd) @@ -741,7 +742,6 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title, int flush ) abort = 1; goto skip_preview; } - total_read += buf->size; packets++; (hb_demux[title->demuxer])(buf, &list_es, 0 ); |