- put references to RtpDump to #ifdef USE_RTPDUMP where possible

This commit is contained in:
2019-03-14 10:30:38 +02:00
parent eb4d3237c0
commit 11db9b7450
6 changed files with 42 additions and 11 deletions

View File

@@ -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();

View File

@@ -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,

View File

@@ -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<PDatagramSocket>& 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)
{

View File

@@ -39,9 +39,10 @@ namespace MT
void setSocket(const RtpPair<PDatagramSocket>& socket);
RtpPair<PDatagramSocket>& 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<PDatagramSocket> mSocket;
RtpPair<InternetAddress> mTarget;
Statistics& mStat;
RtpDump* mDumpWriter;
#if defined(USE_RTPDUMP)
RtpDump* mDumpWriter = nullptr;
#endif
SrtpSession* mSrtpSession;
char mSendBuffer[MAX_VALID_UDPPACKET_SIZE];
};