[Opalvoip-svn] SF.net SVN: opalvoip:[34893] opal/branches/v3_16
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2016-07-30 14:39:03
|
Revision: 34893 http://sourceforge.net/p/opalvoip/code/34893 Author: rjongbloed Date: 2016-07-30 14:39:01 +0000 (Sat, 30 Jul 2016) Log Message: ----------- Merged revision(s) 34817, 34820, 34822, 34845, 34851, 34881 from opal/trunk: Fixed incorrect inclusion of watermark video when not enabled in OpenPhone ........ Fixed jitter buffer when in zero delay mode. ........ Avoid issues in jitter buffer with constant delay offset caused by initial in rush of packets. ........ Allow for retransmit of re-INVITE. This also deals with a strange bug in Asterisk, where it appears to try to do a re-INVITE using the same transaction ID as the initial INVITE it sent. ........ Fixed regression with a retry of a re-INVITE being interpreted as an initial INVITE. Caused by recent workaround for Asterisk using initial INVITE transaction ID on re-INVITE transaction. ........ Fixed crash if x264 encoder helper app increases resolution on the fly. ........ Modified Paths: -------------- opal/branches/v3_16/include/rtp/jitter.h opal/branches/v3_16/plugins/video/x264/gpl/h264_helper.cxx opal/branches/v3_16/samples/openphone/main.cxx opal/branches/v3_16/src/rtp/jitter.cxx opal/branches/v3_16/src/sip/sipcon.cxx Property Changed: ---------------- opal/branches/v3_16/ Index: opal/branches/v3_16 =================================================================== --- opal/branches/v3_16 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16 2016-07-30 14:39:01 UTC (rev 34893) Property changes on: opal/branches/v3_16 ___________________________________________________________________ Modified: svn:mergeinfo ## -14,6 +14,6 ## /opal/branches/v3_4:21060,21062,21088,21092,21111,21113,21115,21119,21143,21148,21151-21152,21155,21158,21184,21188,21253,21265-21266,21283-21284,21298,21300,21303,21307,21309,21311,21327,21331,21333,21359,21367,21369,21488,21556,21564-21565,21568,21570,21620,21625,21631,21748,21751,21756,21759,21761,21767,21770,22246,23044,23140,23143,23286 /opal/branches/v3_6:22169,22178,22184,22186,22197,22204,22216,22251,22253,22255,22258,22260,22291,22296,22300,22306,22308,22313,22319,22336,22353,22358,22436,22447,22449,22497,22511,22517,22519-22521,22527,22536,22538,22589,22596,22599,22617,22620,22622,22630,22640,22655,22675,22682,22726-22728,22730,22733,22738,22745-22746,22800,22820-22821,22842,22844-22845,22851,22853,22889,22896,22902,22904,22906,22918,22924,22928,22946,22965,22967,22976,22978,22980,22982,22994,23028,23123,23125-23126,23128,23157,23165,23173,23175,23183,23294,23341,23465,23467,23474,23521,23829,24346,24809 /opal/branches/v3_8:24025,24027,24029,24036,24038,24040,24042,24048,24050,24058,24061,24068,24071,24074,24076,24080,24082,24086-24087,24092,24099,24101,24105,24107,24109,24111,24114,24116-24117,24120-24121,24125,24127,24130,24132,24134,24138,24140,24144,24146,24148,24150-24151,24154,24156,24158,24162,24170,24218,24245,24257,24261,24340,24362-24363,24365,24369,24373,24422,24440,24442,24447,24489,24504,24506,24532,24536,24545,24547,24552,24554,24614,24678,24687,24699,24705,24775,24833,24861,24903,25146 -/opal/trunk:34112-34116,34118-34120,34122,34137-34139,34155-34156,34161-34165,34168,34170,34173,34177,34187-34190,34208,34218,34222,34237-34238,34246-34252,34269-34271,34281-34288,34297,34300,34303-34316,34333,34346,34365,34375,34377,34382-34384,34390,34393-34394,34399,34417-34421,34424,34430,34432,34435-34437,34440,34442,34455-34456,34480,34483-34484,34487-34488,34490-34491,34502-34503,34506,34588-34589,34718,34735,34746,34775,34784,34795 +/opal/trunk:34112-34116,34118-34120,34122,34137-34139,34155-34156,34161-34165,34168,34170,34173,34177,34187-34190,34208,34218,34222,34237-34238,34246-34252,34269-34271,34281-34288,34297,34300,34303-34316,34333,34346,34365,34375,34377,34382-34384,34390,34393-34394,34399,34417-34421,34424,34430,34432,34435-34437,34440,34442,34455-34456,34480,34483-34484,34487-34488,34490-34491,34502-34503,34506,34588-34589,34718,34735,34746,34775,34784,34795,34817,34820,34822,34845,34851,34881 /ptlib/branches/v2_8:24136 /ptlib/trunk:20820 \ No newline at end of property Modified: opal/branches/v3_16/include/rtp/jitter.h =================================================================== --- opal/branches/v3_16/include/rtp/jitter.h 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16/include/rtp/jitter.h 2016-07-30 14:39:01 UTC (rev 34893) @@ -332,8 +332,8 @@ PDECLARE_MUTEX(m_bufferMutex); PSemaphore m_frameCount; + PTimeInterval m_lastInsertTick; #if PTRACING - PTimeInterval m_lastInsertTick; PTimeInterval m_lastRemoveTick; public: static unsigned sm_EveryPacketLogLevel; Modified: opal/branches/v3_16/plugins/video/x264/gpl/h264_helper.cxx =================================================================== --- opal/branches/v3_16/plugins/video/x264/gpl/h264_helper.cxx 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16/plugins/video/x264/gpl/h264_helper.cxx 2016-07-30 14:39:01 UTC (rev 34893) @@ -175,9 +175,12 @@ H264Encoder x264; -void ResizeBuffer() +void ResizeBuffer(size_t len) { - size_t newBufSize = x264.GetWidth()*x264.GetHeight()*3/2 + rtpSize + 1024; + size_t newBufSize =x264.GetWidth()*x264.GetHeight()*3/2; + if (newBufSize < len) + newBufSize = len; + newBufSize += rtpSize + 1024; if (newBufSize > bufSize) { buffer = (unsigned char *)realloc(buffer, newBufSize); if (buffer == NULL) { @@ -266,15 +269,15 @@ WritePipe(&msg, sizeof(msg)); break; case ENCODE_FRAMES: - ResizeBuffer(); ReadPipe(&srcLen, sizeof(srcLen)); + ResizeBuffer(srcLen); ReadPipe(buffer+rtpSize, srcLen); ReadPipe(&headerLen, sizeof(headerLen)); ReadPipe(buffer, headerLen); ReadPipe(&flags, sizeof(flags)); case ENCODE_FRAMES_BUFFERED: { - ResizeBuffer(); + ResizeBuffer(0); unsigned dstLen = rtpSize; unsigned ret = x264.EncodeFrames(buffer+rtpSize, srcLen, buffer, dstLen, headerLen, flags); WritePipe(&msg, sizeof(msg)); Modified: opal/branches/v3_16/samples/openphone/main.cxx =================================================================== --- opal/branches/v3_16/samples/openphone/main.cxx 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16/samples/openphone/main.cxx 2016-07-30 14:39:01 UTC (rev 34893) @@ -2935,7 +2935,7 @@ OpalMediaStream::DetailAudio | OpalMediaStream::DetailEOL); } - else { + else if (!m_VideoWatermarkDevice.IsEmpty()) { OpalVideoMediaStream * videoStream = dynamic_cast<OpalVideoMediaStream *>(&patch.GetSource()); if (videoStream != NULL) { PVideoInputDevice * device = PVideoInputDevice::CreateOpenedDevice(m_VideoWatermarkDevice, false); Modified: opal/branches/v3_16/src/rtp/jitter.cxx =================================================================== --- opal/branches/v3_16/src/rtp/jitter.cxx 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16/src/rtp/jitter.cxx 2016-07-30 14:39:01 UTC (rev 34893) @@ -291,8 +291,7 @@ , m_consecutiveEmpty(0) , m_lastSyncSource(0) #if PTRACING - , m_lastInsertTick(PTimer::Tick()) - , m_lastRemoveTick(m_lastInsertTick) + , m_lastRemoveTick(PTimer::Tick()) #endif { InternalReset(); @@ -390,11 +389,10 @@ m_synchronisationState = e_SynchronisationStart; m_frames.clear(); - m_frameCount.Reset(); } -PBoolean OpalAudioJitterBuffer::WriteData(const RTP_DataFrame & frame, PTimeInterval PTRACE_PARAM(tick)) +PBoolean OpalAudioJitterBuffer::WriteData(const RTP_DataFrame & frame, PTimeInterval tick) { if (m_closed) return false; @@ -410,6 +408,16 @@ RTP_SequenceNumber currentSequenceNum = frame.GetSequenceNumber(); RTP_SyncSourceId newSyncSource = frame.GetSyncSource(); + // Avoid issues with constant delay offset caused by initial in rush of packets + if (m_lastSyncSource == 0 && (m_lastInsertTick == 0 || (tick - m_lastInsertTick) < 10)) { + PTRACE(std::min(sm_EveryPacketLogLevel,4U), "Flushing initial audio packet:" + " SSRC=" << RTP_TRACE_SRC(newSyncSource) << + " sn=" << currentSequenceNum << + " ts=" << timestamp); + m_lastInsertTick = tick; + return true; + } + // Check for remote switching media senders, they shouldn't do this but do anyway if (newSyncSource != m_lastSyncSource) { PTRACE_IF(std::min(sm_EveryPacketLogLevel,4U), m_lastSyncSource != 0, "Buffer reset due to SSRC change from " @@ -521,9 +529,7 @@ " dT=" << (tick - m_lastInsertTick) << "," " payload=" << frame.GetPayloadSize() << "," " size=" << m_frames.size()); -#if PTRACING m_lastInsertTick = tick; -#endif m_frameCount.Signal(); } else { @@ -571,7 +577,12 @@ m_currentJitterDelay = 0; m_frameCount.Wait(); // Go synchronous PWaitAndSignal mutex(m_bufferMutex); - if (!m_frames.empty()) { + if (m_frames.empty()) { + // Must have been reset, clear the semaphore. + while (m_frameCount.Wait(0)) + ; + } + else { FrameMap::iterator oldestFrame = m_frames.begin(); frame = oldestFrame->second; m_frames.erase(oldestFrame); Modified: opal/branches/v3_16/src/sip/sipcon.cxx =================================================================== --- opal/branches/v3_16/src/sip/sipcon.cxx 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16/src/sip/sipcon.cxx 2016-07-30 14:39:01 UTC (rev 34893) @@ -2115,6 +2115,14 @@ SIPConnection::TypeOfINVITE SIPConnection::CheckINVITE(const SIP_PDU & request) const { + /* If we have same transaction ID, it means it is a retransmission + of the original INVITE, probably should re-transmit last sent response + but we just ignore it. Still should work. */ + if (m_lastReceivedINVITE != NULL && m_lastReceivedINVITE->GetTransactionID() == request.GetTransactionID()) { + PTRACE(3, "Ignoring duplicate INVITE from " << request.GetURI() << " after " << m_phaseTime[UninitialisedPhase].GetElapsed()); + return IsDuplicateINVITE; + } + const SIPMIMEInfo & requestMIME = request.GetMIME(); PString requestFromTag = requestMIME.GetFieldParameter("From", "tag"); PString requestToTag = requestMIME.GetFieldParameter("To", "tag"); @@ -2129,7 +2137,7 @@ if (IsOriginating()) { /* Weird, got incoming INVITE for a call we originated, however it is not in the same dialog. Send back a refusal as this just isn't handled. */ - PTRACE(2, "Ignoring INVITE from " << request.GetURI() << " when originated call."); + PTRACE(2, "Ignoring INVITE from " << request.GetURI() << " when we originated call."); return IsLoopedINVITE; } @@ -2138,21 +2146,13 @@ // to be new INVITE, then it should be retried and next time the race // will be passed. if (m_lastReceivedINVITE == NULL) { - PTRACE(3, "Ignoring INVITE from " << request.GetURI() << " as we are originator."); + PTRACE(3, "Ignoring INVITE from " << request.GetURI() << " as have not yet processed pevious one."); return IsDuplicateINVITE; } - /* If we have same transaction ID, it means it is a retransmission - of the original INVITE, probably should re-transmit last sent response - but we just ignore it. Still should work. */ - if (m_lastReceivedINVITE->GetTransactionID() == request.GetTransactionID()) { - PTRACE(3, "Ignoring duplicate INVITE from " << request.GetURI() << " after " << (PTime() - m_phaseTime[SetUpPhase])); - return IsDuplicateINVITE; - } - // Check if is RFC3261/8.2.2.2 case relating to merged requests. if (!requestToTag.IsEmpty()) { - PTRACE(3, "Ignoring INVITE from " << request.GetURI() << " as has invalid to-tag."); + PTRACE(2, "Ignoring INVITE from " << request.GetURI() << " as has invalid to-tag \"" << requestToTag << '"'); return IsDuplicateINVITE; } @@ -2175,9 +2175,8 @@ void SIPConnection::OnReceivedINVITE(SIP_PDU & request) { - bool isReinvite = IsOriginating() || - (m_lastReceivedINVITE != NULL && m_lastReceivedINVITE->GetTransactionID() != request.GetTransactionID()); - PTRACE_IF(4, !isReinvite, "Initial INVITE to " << request.GetURI()); + bool isReinvite = IsOriginating() || GetPhase() >= ConnectedPhase; + PTRACE(3, (isReinvite ? "Re-" : "Initial ") << "INVITE to " << request.GetURI() << ", id=" << request.GetTransactionID()); // m_lastReceivedINVITE should contain the last received INVITE for this connection delete m_lastReceivedINVITE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |