diff options
author | Gerald Begumisa <ben_g@users.sourceforge.net> | 2007-11-26 12:59:51 +0000 |
---|---|---|
committer | Gerald Begumisa <ben_g@users.sourceforge.net> | 2007-11-26 12:59:51 +0000 |
commit | bc9e02f50ffb374715994d4320faace5d8875576 (patch) | |
tree | 93cc5480e159aadfb044534cecabbbeb56d8b8b8 /orkbasecxx/AudioTape.cpp | |
parent | f4b9b1d0e2e57532f6d838d2a5e88f8852fb5888 (diff) |
Added configuration parameter, CaptureFileSizeLimitKb, which limits the size of the MCF file to the value specified in kilo bytes
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@509 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx/AudioTape.cpp')
-rw-r--r-- | orkbasecxx/AudioTape.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/orkbasecxx/AudioTape.cpp b/orkbasecxx/AudioTape.cpp index 96d70d7..e68df00 100644 --- a/orkbasecxx/AudioTape.cpp +++ b/orkbasecxx/AudioTape.cpp @@ -81,6 +81,8 @@ AudioTape::AudioTape(CStdString &portId) m_shouldStop = false; m_readyForBatchProcessing = false; m_trackingId = portId; // to make sure this has a value before we get the capture tracking Id. + m_bytesWritten = 0; + m_lastLogWarning = 0; GenerateCaptureFilePathAndIdentifier(); } @@ -177,7 +179,22 @@ void AudioTape::Write() } if (m_state == StateActive) { - m_audioFileRef->WriteChunk(chunkRef); + if((m_bytesWritten / 1024) > CONFIG.m_captureFileSizeLimitKb) + { + if((time(NULL) - m_lastLogWarning) > 3600) + { + CStdString logMsg; + + logMsg.Format("[%s] capture file %s.mcf is over size limit (%u KBytes) - ignoring new data", m_trackingId, GetIdentifier(), CONFIG.m_captureFileSizeLimitKb); + LOG4CXX_INFO(LOG.portLog, logMsg); + m_lastLogWarning = time(NULL); + } + } + else + { + m_audioFileRef->WriteChunk(chunkRef); + m_bytesWritten += chunkRef->GetNumBytes(); + } if (CONFIG.m_logRms) { |