summaryrefslogtreecommitdiffstats
path: root/libhb/hb.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-11-07 17:29:03 +0000
committerjstebbins <[email protected]>2009-11-07 17:29:03 +0000
commitccca5789382f571a21edf068549a5bf85dfbbda4 (patch)
tree361668f605bad25a3022c42b186f30cddbdd34b0 /libhb/hb.c
parent953bf32afdef1656cc22c3ab973b32cc4b2b78f0 (diff)
Maintain an accurate job ETA across pause/resume
Keeps track of how much time is spent paused and factors that into the ETA calculation git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2918 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/hb.c')
-rw-r--r--libhb/hb.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libhb/hb.c b/libhb/hb.c
index 898650ac2..34fe53b72 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -1195,6 +1195,8 @@ void hb_pause( hb_handle_t * h )
hb_lock( h->pause_lock );
h->paused = 1;
+ hb_current_job( h )->st_pause_date = hb_get_date();
+
hb_lock( h->state_lock );
h->state.state = HB_STATE_PAUSED;
hb_unlock( h->state_lock );
@@ -1209,6 +1211,13 @@ void hb_resume( hb_handle_t * h )
{
if( h->paused )
{
+#define job hb_current_job( h )
+ if( job->st_pause_date != -1 )
+ {
+ job->st_paused += hb_get_date() - job->st_pause_date;
+ }
+#undef job
+
hb_unlock( h->pause_lock );
h->paused = 0;
}