diff options
author | eddyg <[email protected]> | 2008-10-14 22:36:22 +0000 |
---|---|---|
committer | eddyg <[email protected]> | 2008-10-14 22:36:22 +0000 |
commit | 81866d0278b1d26de96d63cebef7cc6b8be1645b (patch) | |
tree | 8366ea764c8f0d782d13d76ea6530fc6e32116fc /libhb/deca52.c | |
parent | f2b3f4b94b12f2c70923274fceeded392f2df846 (diff) |
a52_syncinfo() returns garbage values sometimes, so when scanning a stream check for two AC3 packets in a row that agree on their values before accepting them as gospel.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1832 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/deca52.c')
-rw-r--r-- | libhb/deca52.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libhb/deca52.c b/libhb/deca52.c index c0651fad2..d53a25df7 100644 --- a/libhb/deca52.c +++ b/libhb/deca52.c @@ -289,6 +289,7 @@ static int deca52BSInfo( hb_work_object_t *w, const hb_buffer_t *b, hb_work_info_t *info ) { int i, rate, bitrate, flags; + int old_rate = 0, old_bitrate = 0; memset( info, 0, sizeof(*info) ); @@ -298,7 +299,22 @@ static int deca52BSInfo( hb_work_object_t *w, const hb_buffer_t *b, { if( a52_syncinfo( &b->data[i], &flags, &rate, &bitrate ) != 0 ) { - break; + /* + * Got sync apparently, save these values and check that they + * also match when we get sync again. + */ + if( old_rate ) + { + if( rate == old_rate && bitrate == old_bitrate ) + { + break; + } else { + hb_log( "AC3 sync didn't return the same values two times in a row, still looking" ); + } + } + + old_rate = rate; + old_bitrate = bitrate; } } if ( i >= b->size - 7 ) |