summaryrefslogtreecommitdiffstats
path: root/libhb/muxcommon.c
diff options
context:
space:
mode:
authorjohnallen <[email protected]>2007-01-08 03:18:40 +0000
committerjohnallen <[email protected]>2007-01-08 03:18:40 +0000
commit18189c197f5d5e04e8e8cd37de0caedb1a469a38 (patch)
treeb0fbfe562fd5d8c371033d316fe455eb89c3eb45 /libhb/muxcommon.c
parentdc22ce2c46ee62a46963d92ccb4a7fc26bd21d26 (diff)
added worker thread sleep throttling.
each of the work object threads now self adjust their sleep interval based on the "fullness" of their fifo. 80% is the choose threshold. Work objects with a fifo fullness of greater than 80% increase their sleep interval. This allows other work object with less than 80% fullness more CPU usage. Also adjusted thread_func, reader, and muxer sleep intervals to more reasonable values. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@98 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/muxcommon.c')
-rw-r--r--libhb/muxcommon.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libhb/muxcommon.c b/libhb/muxcommon.c
index f1723ccf8..99fe6fc91 100644
--- a/libhb/muxcommon.c
+++ b/libhb/muxcommon.c
@@ -108,7 +108,7 @@ static void MuxerFunc( void * _mux )
break;
}
- hb_snooze( 50 );
+ hb_snooze( 200 );
}
/* Create file, write headers */
@@ -134,13 +134,21 @@ static void MuxerFunc( void * _mux )
hb_list_add( list, track );
}
- while( !*job->die && !job->done )
+ int thread_sleep_interval = 50;
+ while( !*job->die && !job->done )
{
if( !( track = GetTrack( list ) ) )
{
- hb_snooze( 50 );
+ hb_snooze( thread_sleep_interval );
+ thread_sleep_interval += 1;
continue;
}
+ thread_sleep_interval = MAX(1, (thread_sleep_interval - 1));
+#if 0
+ if ((thread_sleep_interval <= 1) || (thread_sleep_interval > 100)) {
+ hb_log("%s: %d", "Muxer", thread_sleep_interval);
+ }
+#endif
buf = hb_fifo_get( track->fifo );
if( job->pass != 1 )