- remove suspicious part of code - caused hanging sometimes

This commit is contained in:
Dmytro Bogovych 2018-10-12 11:23:29 +03:00
parent fba79c57de
commit 905d8269dc
1 changed files with 466 additions and 462 deletions

View File

@ -27,7 +27,7 @@ using namespace MT;
// ----------------- RtpBuffer::Packet -------------- // ----------------- RtpBuffer::Packet --------------
RtpBuffer::Packet::Packet(std::shared_ptr<RTPPacket> packet, int timelength, int rate) RtpBuffer::Packet::Packet(std::shared_ptr<RTPPacket> packet, int timelength, int rate)
:mRtp(packet), mTimelength(timelength), mRate(rate) :mRtp(packet), mTimelength(timelength), mRate(rate)
{ {
} }
@ -48,7 +48,7 @@ int RtpBuffer::Packet::rate() const
// ------------ RtpBuffer ---------------- // ------------ RtpBuffer ----------------
RtpBuffer::RtpBuffer(Statistics& stat) RtpBuffer::RtpBuffer(Statistics& stat)
:mStat(stat), mSsrc(0), mHigh(RTP_BUFFER_HIGH), mLow(RTP_BUFFER_LOW), mPrebuffer(RTP_BUFFER_PREBUFFER), :mStat(stat), mSsrc(0), mHigh(RTP_BUFFER_HIGH), mLow(RTP_BUFFER_LOW), mPrebuffer(RTP_BUFFER_PREBUFFER),
mFirstPacketWillGo(true), mFirstPacketWillGo(true),
mReturnedCounter(0), mAddCounter(0), mFetchedPacket(std::shared_ptr<RTPPacket>(), 0, 0) mReturnedCounter(0), mAddCounter(0), mFetchedPacket(std::shared_ptr<RTPPacket>(), 0, 0)
{ {
@ -214,10 +214,14 @@ RtpBuffer::FetchResult RtpBuffer::fetch(ResultList& rl)
rl.push_back(p.rtp()); rl.push_back(p.rtp());
// Maybe it is time to replay packet right now ? For case of AMR SID packets // Maybe it is time to replay packet right now ? For case of AMR SID packets
if (mFetchedPacket.rtp() && gap == 0 && mFetchedPacket.timelength() >= 10 && p.timelength() >= 10) /*if (mFetchedPacket.rtp() && gap == 0 && mFetchedPacket.timelength() >= 10 && p.timelength() >= 10)
{ {
int timestampDelta;
// Timestamp difference // Timestamp difference
int timestampDelta = TimeHelper::getDelta(p.rtp()->GetTimestamp(), mFetchedPacket.rtp()->GetTimestamp()); if (p.rtp()->GetTimestamp() > mFetchedPacket.rtp()->GetTimestamp())
timestampDelta = TimeHelper::getDelta(p.rtp()->GetTimestamp(), mFetchedPacket.rtp()->GetTimestamp());
else
timestampDelta = TimeHelper::getDelta(mFetchedPacket.rtp()->GetTimestamp(), p.rtp()->GetTimestamp());
// Timestamp units per packet // Timestamp units per packet
int nrOfPackets = timestampDelta / (p.timelength() * (p.rate() / 1000)); int nrOfPackets = timestampDelta / (p.timelength() * (p.rate() / 1000));
@ -228,7 +232,7 @@ RtpBuffer::FetchResult RtpBuffer::fetch(ResultList& rl)
//assert(false); //assert(false);
rl.push_back(p.rtp()); rl.push_back(p.rtp());
} }
} }*/
// Save last returned normal packet // Save last returned normal packet
mFetchedPacket = mPacketList.front(); mFetchedPacket = mPacketList.front();
@ -289,7 +293,7 @@ int RtpBuffer::getNumberOfAddPackets() const
//-------------- Receiver --------------- //-------------- Receiver ---------------
Receiver::Receiver(Statistics& stat) Receiver::Receiver(Statistics& stat)
:mStat(stat) :mStat(stat)
{ {
} }
@ -299,7 +303,7 @@ Receiver::~Receiver()
//-------------- AudioReceiver ---------------- //-------------- AudioReceiver ----------------
AudioReceiver::AudioReceiver(const CodecList::Settings& settings, MT::Statistics &stat) AudioReceiver::AudioReceiver(const CodecList::Settings& settings, MT::Statistics &stat)
:Receiver(stat), mBuffer(stat), mFrameCount(0), mFailedCount(0), mCodecSettings(settings), :Receiver(stat), mBuffer(stat), mFrameCount(0), mFailedCount(0), mCodecSettings(settings),
mCodecList(settings) mCodecList(settings)
{ {
// Init resamplers // Init resamplers
@ -533,9 +537,9 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, DecodeOptions options, i
result = mFrameCount > 0; result = mFrameCount > 0;
// Check for bitrate counter // Check for bitrate counter
#if defined(USE_AMR_CODEC) #if defined(USE_AMR_CODEC)
processStatisticsWithAmrCodec(mCodec.get()); processStatisticsWithAmrCodec(mCodec.get());
#endif #endif
} }
else else
ICELogMedia(<< "RTP packet with tail."); ICELogMedia(<< "RTP packet with tail.");
@ -713,7 +717,7 @@ int AudioReceiver::samplerateFor(jrtplib::RTPPacket& p)
// ----------------------- DtmfReceiver ------------------- // ----------------------- DtmfReceiver -------------------
DtmfReceiver::DtmfReceiver(Statistics& stat) DtmfReceiver::DtmfReceiver(Statistics& stat)
:Receiver(stat) :Receiver(stat)
{ {
} }