diff options
author | van <[email protected]> | 2008-06-30 05:01:01 +0000 |
---|---|---|
committer | van <[email protected]> | 2008-06-30 05:01:01 +0000 |
commit | 9c5ffcd12957fcf93c4addd7ccc478c85304d047 (patch) | |
tree | 077a4794221f0705ddae3f3879e13e0b3ad95a08 /libhb/reader.c | |
parent | da80bb8d441e3c12260f2f1bc0fff218112cb42d (diff) |
- fix an error in the SCR calculation that would cause an extra frame to be dropped at an SCR discontinuity.
- fix a rounding error in the encx264 init_delay computation that would underestimate the delay for progressive content and cause spurious "init_delay too small" messages.
- clean up the sync.c "video time didn't advance" logic and try to make the error mgs more useful for debugging frame duration problems.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1543 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/reader.c')
-rw-r--r-- | libhb/reader.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libhb/reader.c b/libhb/reader.c index 9ad2867e5..9ce2a806a 100644 --- a/libhb/reader.c +++ b/libhb/reader.c @@ -43,6 +43,21 @@ hb_thread_t * hb_reader_init( hb_job_t * job ) r->die = job->die; r->sequence = 0; + /* + * when the scr changes we need to base the timing offset change on the + * end of the current video frame otherwise we'll map the first frame + * following the change over the current frame & it will be discarded. + * Since the PTS only gives the start of the frame we need the average + * frame duration to get its end. See the comments in the init_delay + * setup in libhb/encx264.c to understand the following code. + */ + r->demux.frame_duration = 90000. * (double)job->vrate_base / (double)job->vrate; + if ( r->demux.frame_duration == 3753 ) + { + r->demux.frame_duration = 4506; + } + r->demux.frame_duration += 3; + return hb_thread_init( "reader", ReaderFunc, r, HB_NORMAL_PRIORITY ); } @@ -158,7 +173,7 @@ static void ReaderFunc( void * _r ) #define p state.param.working state.state = HB_STATE_WORKING; - p.progress = (float)chapter / (float)r->job->chapter_end; + p.progress = (double)chapter / (double)r->job->chapter_end; if( p.progress > 1.0 ) { p.progress = 1.0; |