[Opalvoip-svn] SF.net SVN: opalvoip:[34912] opal/trunk
Brought to you by:
csoutheren,
rjongbloed
|
From: <rjo...@us...> - 2016-08-09 14:27:37
|
Revision: 34912
http://sourceforge.net/p/opalvoip/code/34912
Author: rjongbloed
Date: 2016-08-09 14:27:35 +0000 (Tue, 09 Aug 2016)
Log Message:
-----------
Make sure when silent/missing frames are reconstructed on delay (e.g. Opus FEC) that the outgoing packet has the correct timestamp, of the previous (missing) input not the one on which it was reconstructed.
Modified Paths:
--------------
opal/trunk/include/opal/transcoders.h
opal/trunk/src/opal/transcoders.cxx
Modified: opal/trunk/include/opal/transcoders.h
===================================================================
--- opal/trunk/include/opal/transcoders.h 2016-08-08 14:13:37 UTC (rev 34911)
+++ opal/trunk/include/opal/transcoders.h 2016-08-09 14:27:35 UTC (rev 34912)
@@ -450,6 +450,7 @@
PINDEX inputBytesPerFrame;
PINDEX outputBytesPerFrame;
PINDEX maxOutputDataSize;
+ RTP_Timestamp m_lastSilentTimestamp;
};
Modified: opal/trunk/src/opal/transcoders.cxx
===================================================================
--- opal/trunk/src/opal/transcoders.cxx 2016-08-08 14:13:37 UTC (rev 34911)
+++ opal/trunk/src/opal/transcoders.cxx 2016-08-09 14:27:35 UTC (rev 34912)
@@ -498,6 +498,7 @@
OpalFramedTranscoder::OpalFramedTranscoder(const OpalMediaFormat & inputMediaFormat,
const OpalMediaFormat & outputMediaFormat)
: OpalTranscoder(inputMediaFormat, outputMediaFormat)
+ , m_lastSilentTimestamp(0)
{
CalculateSizes();
}
@@ -605,6 +606,11 @@
outLen = maxOutputDataSize;
if (!ConvertFrame(inputPtr, inputLength, outputPtr, outLen))
return false;
+
+ /* If the codec is delaying the frame data (e.g. due to FEC of Opus) then
+ remember the timestamp of the reconstructed frame. */
+ if (outLen == 0)
+ m_lastSilentTimestamp = input.GetTimestamp();
}
else {
if (!ConvertSilentFrame(outputPtr))
@@ -630,6 +636,12 @@
inputPtr += consumed;
inputLength -= consumed;
}
+
+ // We have delayed output from codec, so use timestamp from original sample
+ if (outLen > 0 && m_lastSilentTimestamp != 0) {
+ output.SetTimestamp(m_lastSilentTimestamp);
+ m_lastSilentTimestamp = 0;
+ }
}
// set actual output payload size
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|