summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreddyg <[email protected]>2010-11-30 20:55:36 +0000
committereddyg <[email protected]>2010-11-30 20:55:36 +0000
commitc2b3a753b7b8bc625732df4531824ac420bc92b7 (patch)
tree6bba2bacdfbe40f8dd6a6c790bd67efc8165c123
parent2333f423bfb7c1b3a154707219d732fd7465328e (diff)
[libhb] Change bad block handling using libdvdread to scan forward for
good blocks instead of jumping to the end of cell after encountering bad blocks. Changed handling of libdvdnav to not abort after just 10 failures, however it will still jump to end of cell, I couldn't see how to scan forward for good blocks. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3695 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/dvd.c29
-rw-r--r--libhb/dvdnav.c2
2 files changed, 23 insertions, 8 deletions
diff --git a/libhb/dvd.c b/libhb/dvd.c
index 5fd0a4ad9..f1411d7ce 100644
--- a/libhb/dvd.c
+++ b/libhb/dvd.c
@@ -861,22 +861,37 @@ static int hb_dvdread_read( hb_dvd_t * e, hb_buffer_t * b )
{
int block, pack_len, next_vobu, read_retry;
- for( read_retry = 0; read_retry < 3; read_retry++ )
+ for( read_retry = 1; read_retry < 1024; read_retry++ )
{
if( DVDReadBlocks( d->file, d->next_vobu, 1, b->data ) == 1 )
{
/*
* Successful read.
*/
+ if( read_retry > 1 && !is_nav_pack( b->data) )
+ {
+ // But wasn't a nav pack, so carry on looking
+ read_retry = 1;
+ d->next_vobu++;
+ continue;
+ }
break;
- } else {
- hb_log( "dvd: Read Error on blk %d, attempt %d",
- d->next_vobu, read_retry );
+ } else {
+ // First retry the same block, then try the next one,
+ // adjust the skip increment upwards so that we can skip
+ // large sections of bad blocks more efficiently (at the
+ // cost of some missed good blocks at the end).
+ hb_log( "dvd: vobu read error blk %d - skipping to next blk incr %d",
+ d->next_vobu, (read_retry * 10));
+ d->next_vobu += (read_retry * 10);
}
+
}
- if( read_retry == 3 )
+ if( read_retry == 1024 )
{
+ // That's too many bad blocks, jump to the start of the
+ // next cell.
hb_log( "dvd: vobu read error blk %d - skipping to cell %d",
d->next_vobu, d->cell_next );
d->cell_cur = d->cell_next;
@@ -895,7 +910,7 @@ static int hb_dvdread_read( hb_dvd_t * e, hb_buffer_t * b )
hb_log("dvd: Lost sync, searching for NAV pack at blk %d",
d->next_vobu);
d->in_sync = 0;
- }
+ }
continue;
}
@@ -1030,7 +1045,7 @@ static int hb_dvdread_read( hb_dvd_t * e, hb_buffer_t * b )
}
if( d->in_cell )
{
- hb_error( "dvd: assuming missed end of cell %d", d->cell_cur );
+ hb_error( "dvd: assuming missed end of cell %d at block %d", d->cell_cur, d->block );
d->cell_cur = d->cell_next;
d->next_vobu = d->pgc->cell_playback[d->cell_cur].first_sector;
FindNextCell( d );
diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c
index 9fb7ff973..7571b57d3 100644
--- a/libhb/dvdnav.c
+++ b/libhb/dvdnav.c
@@ -1503,7 +1503,7 @@ static int hb_dvdnav_read( hb_dvd_t * e, hb_buffer_t * b )
return 0;
}
error_count++;
- if (error_count > 10)
+ if (error_count > 500)
{
hb_error("dvdnav: Error, too many consecutive read errors");
return 0;