diff options
author | Gerald Begumisa <ben_g@users.sourceforge.net> | 2008-03-07 08:54:25 +0000 |
---|---|---|
committer | Gerald Begumisa <ben_g@users.sourceforge.net> | 2008-03-07 08:54:25 +0000 |
commit | a6d2e0b990df35b552ef5fa25d695f043b120d70 (patch) | |
tree | 9d836d3c505f1786038603f392e9093e406b9051 /orkbasecxx/BatchProcessing.cpp | |
parent | c8218d259f148e5eb267369a2e508d43570291c0 (diff) |
Added feature that allows control over the CPU time which is given for transcoding purposes. Two configuration parameters, TranscodingSleepEveryNumFrames and TranscodingSleepUs have been added to config.xml. If both parameters have non-zero values then the transcoding thread will sleep for TranscodingSleepUs microseconds every TranscodingSleepEveryNumFrames which are transcoded.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@528 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx/BatchProcessing.cpp')
-rw-r--r-- | orkbasecxx/BatchProcessing.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/orkbasecxx/BatchProcessing.cpp b/orkbasecxx/BatchProcessing.cpp index 95b8b8a..a2361a1 100644 --- a/orkbasecxx/BatchProcessing.cpp +++ b/orkbasecxx/BatchProcessing.cpp @@ -138,6 +138,9 @@ void BatchProcessing::ThreadHandler(void *args) AudioChunkRef chunkRef; AudioChunkRef tmpChunkRef; + unsigned int frameSleepCounter; + + frameSleepCounter = 0; switch(CONFIG.m_storageAudioFormat) { @@ -296,6 +299,22 @@ void BatchProcessing::ThreadHandler(void *args) ts.tv_nsec = 1; ACE_OS::nanosleep (&ts, NULL); } + + if(CONFIG.m_transcodingSleepEveryNumFrames > 0 && CONFIG.m_transcodingSleepUs > 0) + { + if(frameSleepCounter >= CONFIG.m_transcodingSleepEveryNumFrames) + { + frameSleepCounter = 0; + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = CONFIG.m_transcodingSleepUs*1000; + ACE_OS::nanosleep (&ts, NULL); + } + else + { + frameSleepCounter += 1; + } + } } if(voIpSession && !firstChunk) |