From 071fbf11a15cada9cb9c77d518a8d7474f11b774 Mon Sep 17 00:00:00 2001 From: Henri Herscher Date: Thu, 21 May 2009 16:37:11 +0000 Subject: Avoid sending tape to batch processing when an error happens in writing to mcf file. git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@615 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkbasecxx/AudioTape.cpp | 21 ++++++++++++++------- orkbasecxx/AudioTape.h | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/orkbasecxx/AudioTape.cpp b/orkbasecxx/AudioTape.cpp index fd152fa..16d4107 100644 --- a/orkbasecxx/AudioTape.cpp +++ b/orkbasecxx/AudioTape.cpp @@ -84,6 +84,7 @@ AudioTape::AudioTape(CStdString &portId) m_bytesWritten = 0; m_lastLogWarning = 0; m_passedPartyFilterTest = false; + m_numErrors = 0; GenerateCaptureFilePathAndIdentifier(); } @@ -128,7 +129,7 @@ void AudioTape::Write() if(!m_passedPartyFilterTest) { logMsg.Format("[%s] rejected by PartyFilter", m_trackingId); - LOG4CXX_INFO(LOG.portLog, logMsg); + LOG4CXX_INFO(LOG.tapeLog, logMsg); } } @@ -227,7 +228,7 @@ void AudioTape::Write() 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); + LOG4CXX_ERROR(LOG.tapeLog, logMsg); m_lastLogWarning = time(NULL); } } @@ -242,14 +243,20 @@ void AudioTape::Write() // Compute RMS, RMS dB and log CStdString rmsString; rmsString.Format("%.1f dB:%.1f", chunkRef.get()->ComputeRms(), chunkRef.get()->ComputeRmsDb()); - LOG4CXX_INFO(LOG.portLog, "[" + m_trackingId + "] RMS: " + rmsString); + LOG4CXX_INFO(LOG.tapeLog, "[" + m_trackingId + "] RMS: " + rmsString); } } } catch (CStdString& e) { - LOG4CXX_INFO(LOG.portLog, "[" + m_trackingId + "] " + e); - m_state = StateError; + m_numErrors++; + + if(m_numErrors <= 3) + { + logMsg.Format("[%s] bytesWritten:%d %s", m_trackingId, m_bytesWritten, e); + LOG4CXX_ERROR(LOG.tapeLog, logMsg); + } + //m_state = StateError; // removed this for now, otherwise sends the tape straight to batchProcessing instead of waiting for end of session } } } @@ -326,7 +333,7 @@ void AudioTape::AddCaptureEvent(CaptureEventRef eventRef, bool send) if(m_passedPartyFilterTest) { logMsg.Format("[%s] remote party passed PartyFilter test", m_trackingId); - LOG4CXX_INFO(LOG.portLog, logMsg); + LOG4CXX_INFO(LOG.tapeLog, logMsg); } } break; @@ -338,7 +345,7 @@ void AudioTape::AddCaptureEvent(CaptureEventRef eventRef, bool send) if(m_passedPartyFilterTest) { logMsg.Format("[%s] local party passed PartyFilter test", m_trackingId); - LOG4CXX_INFO(LOG.portLog, logMsg); + LOG4CXX_INFO(LOG.tapeLog, logMsg); } } break; diff --git a/orkbasecxx/AudioTape.h b/orkbasecxx/AudioTape.h index 13e12c3..5b08182 100644 --- a/orkbasecxx/AudioTape.h +++ b/orkbasecxx/AudioTape.h @@ -95,6 +95,7 @@ public: CStdString m_trackingId; CStdString m_nativeCallId; StateEnum m_state; + int m_numErrors; TapeResponseRef m_tapeResponse; -- cgit v1.2.3