diff options
-rw-r--r-- | orkbasecxx/BatchProcessing.cpp | 19 | ||||
-rw-r--r-- | orkbasecxx/Config.cpp | 17 | ||||
-rw-r--r-- | orkbasecxx/Config.h | 6 |
3 files changed, 42 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) diff --git a/orkbasecxx/Config.cpp b/orkbasecxx/Config.cpp index 2da7141..08038f7 100644 --- a/orkbasecxx/Config.cpp +++ b/orkbasecxx/Config.cpp @@ -71,6 +71,8 @@ Config::Config() m_stereoRecording = STEREO_RECORDING_DEFAULT; m_tapeNumChannels = TAPE_NUM_CHANNELS_DEFAULT; m_tapeDurationMinimumSec = TAPE_DURATION_MINIMUM_SEC_DEFAULT; + m_transcodingSleepEveryNumFrames = TRANSCODING_SLEEP_EVERY_NUM_FRAMES_DEFAULT; + m_transcodingSleepUs = TRANSCODING_SLEEP_US_DEFAULT; } void Config::Define(Serializer* s) @@ -146,6 +148,8 @@ void Config::Define(Serializer* s) s->BoolValue(STEREO_RECORDING_PARAM, m_stereoRecording); s->IntValue(TAPE_NUM_CHANNELS_PARAM, m_tapeNumChannels); s->IntValue(TAPE_DURATION_MINIMUM_SEC_PARAM, m_tapeDurationMinimumSec); + s->IntValue(TRANSCODING_SLEEP_EVERY_NUM_FRAMES_PARAM, m_transcodingSleepEveryNumFrames); + s->IntValue(TRANSCODING_SLEEP_US_PARAM, m_transcodingSleepUs); } void Config::Validate() @@ -195,6 +199,19 @@ void Config::Validate() exception.Format("Config::Validate: please set a valid number for TapeNumChannels - currently:%d", m_tapeNumChannels); throw(exception); } + + if(m_transcodingSleepEveryNumFrames < 0) + { + CStdString exception; + exception.Format("Config::Validate: please set a valid value for TranscodingSleepEveryNumFrames - currently:%d", m_transcodingSleepEveryNumFrames); + throw(exception); + } + if(m_transcodingSleepUs < 0) + { + CStdString exception; + exception.Format("Config::Validate: please set a valid value for TranscodingSleepUs - currently:%d", m_transcodingSleepUs); + throw(exception); + } } CStdString Config::GetClassName() diff --git a/orkbasecxx/Config.h b/orkbasecxx/Config.h index 561e238..02fe025 100644 --- a/orkbasecxx/Config.h +++ b/orkbasecxx/Config.h @@ -110,6 +110,10 @@ #define TAPE_NUM_CHANNELS_DEFAULT 2 #define TAPE_DURATION_MINIMUM_SEC_PARAM "TapeDurationMinimumSec" #define TAPE_DURATION_MINIMUM_SEC_DEFAULT 0 +#define TRANSCODING_SLEEP_EVERY_NUM_FRAMES_PARAM "TranscodingSleepEveryNumFrames" +#define TRANSCODING_SLEEP_EVERY_NUM_FRAMES_DEFAULT 0 +#define TRANSCODING_SLEEP_US_PARAM "TranscodingSleepUs" +#define TRANSCODING_SLEEP_US_DEFAULT 0 class DLL_IMPORT_EXPORT_ORKBASE Config : public Object @@ -173,6 +177,8 @@ public: bool m_stereoRecording; int m_tapeNumChannels; int m_tapeDurationMinimumSec; + int m_transcodingSleepEveryNumFrames; + int m_transcodingSleepUs; private: log4cxx::LoggerPtr m_log; |