diff options
-rw-r--r-- | orkaudio/BatchProcessing.cpp | 2 | ||||
-rw-r--r-- | orkaudio/CapturePort.cpp | 10 | ||||
-rw-r--r-- | orkaudio/Reporting.cpp | 21 | ||||
-rw-r--r-- | orkaudio/Reporting.h | 1 | ||||
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 5 | ||||
-rw-r--r-- | orkbasecxx/AudioCapture.cpp | 6 | ||||
-rw-r--r-- | orkbasecxx/AudioCapture.h | 4 | ||||
-rw-r--r-- | orkbasecxx/AudioTape.cpp | 11 | ||||
-rw-r--r-- | orkbasecxx/messages/TapeMsg.h | 1 |
9 files changed, 49 insertions, 12 deletions
diff --git a/orkaudio/BatchProcessing.cpp b/orkaudio/BatchProcessing.cpp index 2e3ce29..31439af 100644 --- a/orkaudio/BatchProcessing.cpp +++ b/orkaudio/BatchProcessing.cpp @@ -12,6 +12,8 @@ */ #pragma warning( disable: 4786 ) +#define _WINSOCKAPI_ // prevents the inclusion of winsock.h + #include "ConfigManager.h" #include "BatchProcessing.h" #include "ace/OS_NS_unistd.h" diff --git a/orkaudio/CapturePort.cpp b/orkaudio/CapturePort.cpp index 71c5e9d..a1a761c 100644 --- a/orkaudio/CapturePort.cpp +++ b/orkaudio/CapturePort.cpp @@ -211,8 +211,8 @@ void CapturePort::AddCaptureEvent(CaptureEventRef eventRef) audioTapeRef->SetShouldStop(); // force stop of previous tape } audioTapeRef.reset(new AudioTape(m_id)); // Create a new tape - audioTapeRef->AddCaptureEvent(eventRef, false); - //Reporting::GetInstance()->AddAudioTape(audioTapeRef); + audioTapeRef->AddCaptureEvent(eventRef, true); + m_audioTapeRef = audioTapeRef; LOG4CXX_INFO(s_log, "#" + m_id + ": start"); } @@ -239,8 +239,6 @@ void CapturePort::AddCaptureEvent(CaptureEventRef eventRef) { // Notify immediate processing that tape has stopped ImmediateProcessing::GetInstance()->AddAudioTape(m_audioTapeRef); - // Reporting needs to send a stop message - // Reporting::GetInstance()->AddAudioTape(audioTapeRef); } else { @@ -248,6 +246,10 @@ void CapturePort::AddCaptureEvent(CaptureEventRef eventRef) LOG4CXX_WARN(s_log, "#" + m_id + ": no audio reported between last start and stop"); } break; + case CaptureEvent::EtEndMetadata: + // Now that all metadata has been acquired, we can generate the tape start message + Reporting::Instance()->AddAudioTape(audioTapeRef); + break; case CaptureEvent::EtDirection: case CaptureEvent::EtRemoteParty: case CaptureEvent::EtLocalParty: diff --git a/orkaudio/Reporting.cpp b/orkaudio/Reporting.cpp index 72c3f49..f03a22c 100644 --- a/orkaudio/Reporting.cpp +++ b/orkaudio/Reporting.cpp @@ -12,6 +12,8 @@ */ #pragma warning( disable: 4786 ) +#define _WINSOCKAPI_ // prevents the inclusion of winsock.h + #include "ConfigManager.h" #include "Reporting.h" #include "LogManager.h" @@ -29,6 +31,10 @@ void Reporting::Initialize() TapeProcessorRegistry::instance()->RegisterTapeProcessor(m_singleton); } +Reporting* Reporting::Instance() +{ + return (Reporting*)m_singleton.get(); +} Reporting::Reporting() { @@ -92,8 +98,16 @@ void Reporting::ThreadHandler(void *args) MessageRef msgRef; audioTapeRef->GetMessage(msgRef); + TapeMsg* ptapeMsg = (TapeMsg*)msgRef.get(); + bool startMsg = false; + if(msgRef.get() /*&& CONFIG.m_enableReporting*/) { + if(ptapeMsg->m_stage.Equals("START")) + { + startMsg = true; + } + CStdString msgAsSingleLineString = msgRef->SerializeSingleLine(); LOG4CXX_INFO(LOG.reportingLog, msgAsSingleLineString); @@ -126,8 +140,11 @@ void Reporting::ThreadHandler(void *args) } else { - // Pass the tape to the next processor - pReporting->RunNextProcessor(audioTapeRef); + if(!startMsg) + { + // Pass the tape to the next processor + pReporting->RunNextProcessor(audioTapeRef); + } } } else diff --git a/orkaudio/Reporting.h b/orkaudio/Reporting.h index e16f647..5f5365e 100644 --- a/orkaudio/Reporting.h +++ b/orkaudio/Reporting.h @@ -22,6 +22,7 @@ class Reporting : public TapeProcessor { public: static void Initialize(); + static Reporting* Instance(); CStdString __CDECL__ GetName(); TapeProcessorRef __CDECL__ Instanciate(); diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp index cfeecc8..ec2dd4e 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp @@ -274,6 +274,11 @@ void RtpSession::ReportMetadata() event->m_type = CaptureEvent::EtRemoteIp; event->m_value = szRemoteIp; g_captureEventCallBack(event, m_capturePort); + + // Report end of metadata + event.reset(new CaptureEvent()); + event->m_type = CaptureEvent::EtEndMetadata; + g_captureEventCallBack(event, m_capturePort); } // Returns false if the packet does not belong to the session (RTP timestamp discontinuity) diff --git a/orkbasecxx/AudioCapture.cpp b/orkbasecxx/AudioCapture.cpp index 7788fe8..dc72935 100644 --- a/orkbasecxx/AudioCapture.cpp +++ b/orkbasecxx/AudioCapture.cpp @@ -233,6 +233,8 @@ CStdString CaptureEvent::EventTypeToString(int eventTypeEnum) return ET_LOCALMAC; case EtRemoteMac: return ET_REMOTEMAC; + case EtEndMetadata: + return ET_ENDMETADATA; } return ET_INVALID; } @@ -284,6 +286,10 @@ int CaptureEvent::EventTypeToEnum(CStdString& eventTypeString) { eventTypeEnum = EtRemoteMac; } + else if (eventTypeString.CompareNoCase(ET_ENDMETADATA) == 0) + { + eventTypeEnum = EtEndMetadata; + } return eventTypeEnum; } diff --git a/orkbasecxx/AudioCapture.h b/orkbasecxx/AudioCapture.h index a81ce8b..1d6e8e9 100644 --- a/orkbasecxx/AudioCapture.h +++ b/orkbasecxx/AudioCapture.h @@ -120,6 +120,7 @@ public: #define ET_REMOTEIP "remoteip" #define ET_LOCALMAC "localmac" #define ET_REMOTEMAC "remotemac" +#define ET_ENDMETADATA "endmetadata" #define ET_INVALID "invalid" typedef enum { @@ -135,7 +136,8 @@ public: EtRemoteIp = 9, EtLocalMac = 10, EtRemoteMac = 11, - EtInvalid = 12 + EtEndMetadata = 12, + EtInvalid = 13 } EventTypeEnum; static CStdString EventTypeToString(int eventTypeEnum); static int EventTypeToEnum(CStdString&); diff --git a/orkbasecxx/AudioTape.cpp b/orkbasecxx/AudioTape.cpp index 3cb81e5..c406485 100644 --- a/orkbasecxx/AudioTape.cpp +++ b/orkbasecxx/AudioTape.cpp @@ -249,13 +249,16 @@ void AudioTape::GetMessage(MessageRef& msgRef) CaptureEventRef captureEventRef; { MutexSentinel sentinel(m_mutex); - captureEventRef = m_toSendEventQueue.front(); - m_toSendEventQueue.pop(); + if(m_toSendEventQueue.size() > 0) + { + captureEventRef = m_toSendEventQueue.front(); + m_toSendEventQueue.pop(); + } } msgRef.reset(new TapeMsg); TapeMsg* pTapeMsg = (TapeMsg*)msgRef.get(); - if(captureEventRef->m_type == CaptureEvent::EtStop) + if(captureEventRef->m_type == CaptureEvent::EtStop || captureEventRef->m_type == CaptureEvent::EtStart) { pTapeMsg->m_recId = m_fileIdentifier; pTapeMsg->m_fileName = m_filePath + m_fileIdentifier + m_fileExtension; @@ -272,7 +275,7 @@ void AudioTape::GetMessage(MessageRef& msgRef) } else { - // This should be a key-value pair message or a start event + // This should be a key-value pair message } } diff --git a/orkbasecxx/messages/TapeMsg.h b/orkbasecxx/messages/TapeMsg.h index f83805e..481bfd3 100644 --- a/orkbasecxx/messages/TapeMsg.h +++ b/orkbasecxx/messages/TapeMsg.h @@ -53,7 +53,6 @@ public: CStdString m_localEntryPoint; CStdString m_remoteParty; CStdString m_direction; - CStdString m_loginString; int m_duration; CStdString m_serviceName; CStdString m_localIp; |