diff options
author | Henri Herscher <henri@oreka.org> | 2006-05-05 21:40:03 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2006-05-05 21:40:03 +0000 |
commit | 5fcfb03dea11fcf5d9732879fdc0b4abf89bb69b (patch) | |
tree | 279e35d402553cf67fbe90a6012420d3e8d382e2 /orkaudio | |
parent | 030f3d40121bc7e4c806f6460fe0674ed5fcba99 (diff) |
now deleting failed capture files by default (configurable)
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@226 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio')
-rw-r--r-- | orkaudio/BatchProcessing.cpp | 29 | ||||
-rw-r--r-- | orkaudio/Config.cpp | 2 | ||||
-rw-r--r-- | orkaudio/Config.h | 3 |
3 files changed, 22 insertions, 12 deletions
diff --git a/orkaudio/BatchProcessing.cpp b/orkaudio/BatchProcessing.cpp index 73424f2..e281751 100644 --- a/orkaudio/BatchProcessing.cpp +++ b/orkaudio/BatchProcessing.cpp @@ -43,7 +43,7 @@ void BatchProcessing::AddAudioTape(AudioTapeRef audioTapeRef) if (!m_audioTapeQueue.push(audioTapeRef)) { // Log error - LOG4CXX_ERROR(LOG.batchProcessingLog, CStdString("BatchProcessing: queue full")); + LOG4CXX_ERROR(LOG.batchProcessingLog, CStdString("queue full")); } } @@ -185,8 +185,6 @@ void BatchProcessing::ThreadHandler(void *args) default: outFileRef.reset(new LibSndFileFile(SF_FORMAT_PCM_16 | SF_FORMAT_WAV)); } - CStdString file = CONFIG.m_audioOutputPath + "/" + audioTapeRef->GetPath() + audioTapeRef->GetIdentifier(); - outFileRef->Open(file, AudioFile::WRITE, false, fileRef->GetSampleRate()); FilterRef filter; FilterRef decoder1; @@ -200,23 +198,30 @@ void BatchProcessing::ThreadHandler(void *args) AudioChunkDetails details = *chunkRef->GetDetails(); if(firstChunk && details.m_rtpPayloadType != -1) { - firstChunk = false; CStdString filterName("RtpMixer"); filter = FilterRegistry::instance()->GetNewFilter(filterName); if(filter.get() == NULL) { - debug = "BatchProcessing - Could not instanciate RTP mixer"; + debug = "Could not instanciate RTP mixer"; throw(debug); } decoder1 = FilterRegistry::instance()->GetNewFilter(details.m_rtpPayloadType); decoder2 = FilterRegistry::instance()->GetNewFilter(details.m_rtpPayloadType); if(decoder1.get() == NULL || decoder2.get() == NULL) { - debug.Format("BatchProcessing - Could not find decoder for RTP payload type:%u", chunkRef->GetDetails()->m_rtpPayloadType); + debug.Format("Could not find decoder for RTP payload type:%u", chunkRef->GetDetails()->m_rtpPayloadType); throw(debug); } voIpSession = true; } + if(firstChunk) + { + firstChunk = false; + + // At this point, we know we have the right codec, open the output file + CStdString file = CONFIG.m_audioOutputPath + "/" + audioTapeRef->GetPath() + audioTapeRef->GetIdentifier(); + outFileRef->Open(file, AudioFile::WRITE, false, fileRef->GetSampleRate()); + } if(voIpSession) { if(details.m_channel == 2) @@ -267,15 +272,15 @@ void BatchProcessing::ThreadHandler(void *args) } catch (CStdString& e) { - //if(CONFIG.m_deleteNativeFile && fileRef.get() != NULL) - //{ - // fileRef->Delete(); - //} - LOG4CXX_ERROR(LOG.batchProcessingLog, CStdString("BatchProcessing: ") + e); + LOG4CXX_ERROR(LOG.batchProcessingLog, e); + if(CONFIG.m_deleteFailedCaptureFile && fileRef.get() != NULL) + { + fileRef->Delete(); + } } //catch(...) //{ - // LOG4CXX_ERROR(LOG.batchProcessingLog, CStdString("BatchProcessing: unknown exception")); + // LOG4CXX_ERROR(LOG.batchProcessingLog, CStdString("unknown exception")); //} } LOG4CXX_INFO(LOG.batchProcessingLog, CStdString("Exiting thread #" + threadIdString)); diff --git a/orkaudio/Config.cpp b/orkaudio/Config.cpp index c72e9de..ca7273c 100644 --- a/orkaudio/Config.cpp +++ b/orkaudio/Config.cpp @@ -41,6 +41,7 @@ Config::Config() m_immediateProcessingQueueSize = IMMEDIATE_PROCESSING_QUEUE_SIZE_DEFAULT; m_batchProcessingQueueSize = BATCH_PROCESSING_QUEUE_SIZE_DEFAULT; m_batchProcessingEnhancePriority = BATCH_PROCESSING_ENHANCE_PRIORITY_DEFAULT; + m_deleteFailedCaptureFile = DELETE_FAILED_CAPTURE_FILE_DEFAULT; char hostname[40]; ACE_OS::hostname(hostname, 40); @@ -78,6 +79,7 @@ void Config::Define(Serializer* s) s->IntValue(IMMEDIATE_PROCESSING_QUEUE_SIZE_PARAM, m_immediateProcessingQueueSize); s->IntValue(BATCH_PROCESSING_QUEUE_SIZE_PARAM, m_batchProcessingQueueSize); s->BoolValue(BATCH_PROCESSING_ENHANCE_PRIORITY_PARAM, m_batchProcessingEnhancePriority); + s->BoolValue(DELETE_FAILED_CAPTURE_FILE_PARAM, m_deleteFailedCaptureFile); } void Config::Validate() diff --git a/orkaudio/Config.h b/orkaudio/Config.h index b7623f4..48be3f0 100644 --- a/orkaudio/Config.h +++ b/orkaudio/Config.h @@ -65,6 +65,8 @@ #define BATCH_PROCESSING_QUEUE_SIZE_DEFAULT 20000 #define BATCH_PROCESSING_ENHANCE_PRIORITY_PARAM "BatchProcessingEnhancePriority" #define BATCH_PROCESSING_ENHANCE_PRIORITY_DEFAULT false +#define DELETE_FAILED_CAPTURE_FILE_PARAM "DeleteFailedCaptureFile" +#define DELETE_FAILED_CAPTURE_FILE_DEFAULT false class Config : public Object { @@ -102,6 +104,7 @@ public: int m_immediateProcessingQueueSize; int m_batchProcessingQueueSize; bool m_batchProcessingEnhancePriority; + bool m_deleteFailedCaptureFile; }; |