From 0c46572c6e372e8b41dcdc70867ff9bacb2cef08 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Sat, 24 Apr 2010 20:24:38 +0000 Subject: make sure HB_STATE_WORKING always gets set for a job very short video, or video that has no valid frames, can cause UpdateState in sync.c to never be called. This is the only way the sequence_id would ever be set, so when the ui sees HB_STATE_WORKDONE, it could not look up the job in it's queue based on the sequence_id causing it to never be marked as complete. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3261 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/work.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libhb/work.c') diff --git a/libhb/work.c b/libhb/work.c index 935ffa490..d2c8ac66b 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -49,6 +49,24 @@ hb_thread_t * hb_work_init( hb_list_t * jobs, int cpu_count, return hb_thread_init( "work", work_func, work, HB_LOW_PRIORITY ); } +static void InitWorkState( hb_handle_t * h ) +{ + hb_state_t state; + + state.state = HB_STATE_WORKING; +#define p state.param.working + p.progress = 0.0; + p.rate_cur = 0.0; + p.rate_avg = 0.0; + p.hours = -1; + p.minutes = -1; + p.seconds = -1; +#undef p + + hb_set_state( h, &state ); + +} + /** * Iterates through job list and calls do_job for each job. * @param _work Handle work object. @@ -65,6 +83,7 @@ static void work_func( void * _work ) hb_list_rem( work->jobs, job ); job->die = work->die; *(work->current_job) = job; + InitWorkState( job->h ); do_job( job, work->cpu_count ); *(work->current_job) = NULL; } -- cgit v1.2.3