summaryrefslogtreecommitdiffstats
path: root/libhb/work.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-04-24 20:24:38 +0000
committerjstebbins <[email protected]>2010-04-24 20:24:38 +0000
commit0c46572c6e372e8b41dcdc70867ff9bacb2cef08 (patch)
tree3c85bcf52f56713fd512b9a90b4bcf7b4eb5448e /libhb/work.c
parent8d7bf485002a1d9358254632f13be1f392d2ba81 (diff)
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
Diffstat (limited to 'libhb/work.c')
-rw-r--r--libhb/work.c19
1 files changed, 19 insertions, 0 deletions
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;
}