diff --git a/src/engine/helper/HL_Rtp.cpp b/src/engine/helper/HL_Rtp.cpp index 483faf02..27c39ed2 100644 --- a/src/engine/helper/HL_Rtp.cpp +++ b/src/engine/helper/HL_Rtp.cpp @@ -7,8 +7,11 @@ #include "HL_Exception.h" #include "HL_String.h" -#include "jrtplib/src/rtprawpacket.h" -#include "jrtplib/src/rtpipv4address.h" +#if defined(USE_RTP_DUMP) +# include "jrtplib/src/rtprawpacket.h" +# include "jrtplib/src/rtpipv4address.h" +#endif + #if !defined(TARGET_WIN) # include #endif @@ -97,6 +100,7 @@ int RtpHelper::findPayloadLength(const void* buffer, size_t length) return -1; } +#if defined(USE_RTPDUMP) RtpDump::RtpDump(const char *filename) :mFilename(filename) {} @@ -172,6 +176,8 @@ void RtpDump::flush() } fclose(f); } +#endif + // -------------- MediaStreamId -------------------- bool MediaStreamId::operator < (const MediaStreamId& right) const @@ -206,7 +212,10 @@ void writeToJson(const MediaStreamId& id, std::ostringstream& oss) oss << " \"src\": \"" << id.mSource.toStdString() << "\"," << std::endl << " \"dst\": \"" << id.mDestination.toStdString() << "\"," << std::endl << " \"ssrc\": \"" << StringHelper::toHex(id.mSSRC) << "\"," << std::endl - << " \"link_id\": \"" << id.mLinkId.toString() << "\"" << std::endl; +#if !defined(USE_NULL_UUID) + << " \"link_id\": \"" << id.mLinkId.toString() << "\"" << std::endl +#endif + ; } std::string MediaStreamId::getDetectDescription() const diff --git a/src/engine/helper/HL_Rtp.h b/src/engine/helper/HL_Rtp.h index 7fe373b7..0e518ade 100644 --- a/src/engine/helper/HL_Rtp.h +++ b/src/engine/helper/HL_Rtp.h @@ -6,8 +6,15 @@ #ifndef __HL_RTP_H #define __HL_RTP_H -#include "jrtplib/src/rtppacket.h" -#include "HL_Uuid.h" +#if defined(USE_RTPDUMP) +# include "jrtplib/src/rtppacket.h" +#endif + +#if !defined(USE_NULL_UUID) +# include "HL_Uuid.h" +#endif + + #include "HL_InternetAddress.h" #include @@ -42,6 +49,7 @@ public: static int findPayloadLength(const void* buffer, size_t length); }; +#if defined(USE_RTPDUMP) class RtpDump { protected: @@ -66,6 +74,7 @@ public: void add(const void* data, size_t len); void flush(); }; +#endif struct MediaStreamId { @@ -73,7 +82,9 @@ struct MediaStreamId InternetAddress mDestination; uint32_t mSSRC = 0; bool mSsrcIsId = true; +#if !defined(USE_NULL_UUID) Uuid mLinkId; +#endif bool operator < (const MediaStreamId& s2) const; bool operator == (const MediaStreamId& right) const; diff --git a/src/engine/media/MT_AudioStream.cpp b/src/engine/media/MT_AudioStream.cpp index ecb8d198..65014e5a 100644 --- a/src/engine/media/MT_AudioStream.cpp +++ b/src/engine/media/MT_AudioStream.cpp @@ -24,7 +24,7 @@ using namespace MT; AudioStream::AudioStream(const CodecList::Settings& settings) :mPacketTime(0), mEncodedTime(0), mCodecSettings(settings), mRemoteTelephoneCodec(0), mRtpSession(), mTransmittingPayloadType(-1), -mRtpSender(mStat), mRtpDump(NULL) +mRtpSender(mStat) { mOutputBuffer.setCapacity(16384); mCapturedAudio.setCapacity(16384); @@ -75,11 +75,13 @@ AudioStream::~AudioStream() if (mRtpSession.IsActive()) mRtpSession.Destroy(); +#if defined(USE_RTPDUMP) if (mRtpDump) { mRtpDump->flush(); delete mRtpDump; } +#endif mCaptureResampler8.stop(); mCaptureResampler16.stop(); diff --git a/src/engine/media/MT_AudioStream.h b/src/engine/media/MT_AudioStream.h index 648b8ad0..32b22e03 100644 --- a/src/engine/media/MT_AudioStream.h +++ b/src/engine/media/MT_AudioStream.h @@ -79,7 +79,9 @@ namespace MT NativeRtpSender mRtpSender; AudioStreamMap mStreamMap; // Map of media streams. Key is RTP's SSRC value. Audio::DataWindow mOutputBuffer; - RtpDump* mRtpDump; +#if defined(USE_RTPDUMP) + RtpDump* mRtpDump = nullptr; +#endif Audio::Resampler mCaptureResampler8, mCaptureResampler16, mCaptureResampler32, diff --git a/src/engine/media/MT_NativeRtpSender.cpp b/src/engine/media/MT_NativeRtpSender.cpp index 40b37c86..3dfef528 100644 --- a/src/engine/media/MT_NativeRtpSender.cpp +++ b/src/engine/media/MT_NativeRtpSender.cpp @@ -1,4 +1,4 @@ -/* Copyright(C) 2007-2014 VoIP objects (voipobjects.com) +/* Copyright(C) 2007-2019 VoIP objects (voipobjects.com) * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -9,7 +9,7 @@ using namespace MT; NativeRtpSender::NativeRtpSender(Statistics& stat) -:mDumpWriter(NULL), mStat(stat), mSrtpSession(NULL) +:mStat(stat), mSrtpSession(nullptr) { } @@ -22,8 +22,10 @@ bool NativeRtpSender::SendRTP(const void *data, size_t len) if (mTarget.mRtp.isEmpty() || !mSocket.mRtp) return false; +#if defined(USE_RTPDUMP) if (mDumpWriter) mDumpWriter->add(data, len); +#endif // Copy data to intermediary buffer bigger that original int sendLength = len; @@ -99,6 +101,7 @@ RtpPair& NativeRtpSender::socket() return mSocket; } +#if defined(USE_RTPDUMP) void NativeRtpSender::setDumpWriter(RtpDump *dump) { mDumpWriter = dump; @@ -108,6 +111,7 @@ RtpDump* NativeRtpSender::dumpWriter() { return mDumpWriter; } +#endif void NativeRtpSender::setSrtpSession(SrtpSession* srtp) { diff --git a/src/engine/media/MT_NativeRtpSender.h b/src/engine/media/MT_NativeRtpSender.h index 677b82ee..e57aa3c2 100644 --- a/src/engine/media/MT_NativeRtpSender.h +++ b/src/engine/media/MT_NativeRtpSender.h @@ -39,9 +39,10 @@ namespace MT void setSocket(const RtpPair& socket); RtpPair& socket(); +#if defined(USE_RTPDUMP) void setDumpWriter(RtpDump* dump); RtpDump* dumpWriter(); - +#endif void setSrtpSession(SrtpSession* srtp); SrtpSession* srtpSession(); @@ -49,7 +50,9 @@ namespace MT RtpPair mSocket; RtpPair mTarget; Statistics& mStat; - RtpDump* mDumpWriter; +#if defined(USE_RTPDUMP) + RtpDump* mDumpWriter = nullptr; +#endif SrtpSession* mSrtpSession; char mSendBuffer[MAX_VALID_UDPPACKET_SIZE]; };