summaryrefslogtreecommitdiffstats
path: root/libhb/dvdnav.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-09-12 20:03:36 +0000
committerjstebbins <[email protected]>2009-09-12 20:03:36 +0000
commit94d44646aeb23b42bb5596941e0534c7896fa61e (patch)
treed4dd1bb1c7d07753e7487c4ff40a2d8bb1bbfefd /libhb/dvdnav.c
parentbc0d347b68e70d98672f55525275bddd344df004 (diff)
dvdnav: read error recovery
- patch libdvdnav seek to guarantee the position will move forward when making a seek request to a position that is after the current position - when a read error is detected, seek forward and retry. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2815 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/dvdnav.c')
-rw-r--r--libhb/dvdnav.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c
index 40587b7ed..4633f1cf6 100644
--- a/libhb/dvdnav.c
+++ b/libhb/dvdnav.c
@@ -982,6 +982,7 @@ static int hb_dvdnav_read( hb_dvd_t * e, hb_buffer_t * b )
hb_dvdnav_t * d = &(e->dvdnav);
int result, event, len;
int chapter = 0;
+ int error_count = 0;
while ( 1 )
{
@@ -993,8 +994,21 @@ static int hb_dvdnav_read( hb_dvd_t * e, hb_buffer_t * b )
if ( result == DVDNAV_STATUS_ERR )
{
hb_log("dvdnav: Read Error, %s", dvdnav_err_to_string(d->dvdnav));
- return 0;
+ if (dvdnav_sector_search(d->dvdnav, 1, SEEK_CUR) != DVDNAV_STATUS_OK)
+ {
+ hb_error( "dvd: dvdnav_sector_search failed - %s",
+ dvdnav_err_to_string(d->dvdnav) );
+ return 0;
+ }
+ error_count++;
+ if (error_count > 10)
+ {
+ hb_log("dvdnav: Error, too many consecutive read errors");
+ return 0;
+ }
+ continue;
}
+ error_count = 0;
switch ( event )
{
case DVDNAV_BLOCK_OK: