Remove unused method in VCMInterFrameDelay.

Bug: none
Change-Id: I88f0f4011643736267f0dfa254cd65a936330253
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130475
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27430}
This commit is contained in:
Åsa Persson
2019-04-01 14:31:46 +02:00
committed by Commit Bot
parent caedb5db82
commit 288cbe8200
2 changed files with 23 additions and 43 deletions

View File

@ -16,7 +16,7 @@ VCMInterFrameDelay::VCMInterFrameDelay(int64_t currentWallClock) {
Reset(currentWallClock);
}
// Resets the delay estimate
// Resets the delay estimate.
void VCMInterFrameDelay::Reset(int64_t currentWallClock) {
_zeroWallClock = currentWallClock;
_wrapArounds = 0;
@ -31,7 +31,7 @@ bool VCMInterFrameDelay::CalculateDelay(uint32_t timestamp,
int64_t* delay,
int64_t currentWallClock) {
if (_prevWallClock == 0) {
// First set of data, initialization, wait for next frame
// First set of data, initialization, wait for next frame.
_prevWallClock = currentWallClock;
_prevTimestamp = timestamp;
*delay = 0;
@ -41,30 +41,29 @@ bool VCMInterFrameDelay::CalculateDelay(uint32_t timestamp,
int32_t prevWrapArounds = _wrapArounds;
CheckForWrapArounds(timestamp);
// This will be -1 for backward wrap arounds and +1 for forward wrap arounds
// This will be -1 for backward wrap arounds and +1 for forward wrap arounds.
int32_t wrapAroundsSincePrev = _wrapArounds - prevWrapArounds;
// Account for reordering in jitter variance estimate in the future?
// Note that this also captures incomplete frames which are grabbed
// for decoding after a later frame has been complete, i.e. real
// packet losses.
// Note that this also captures incomplete frames which are grabbed for
// decoding after a later frame has been complete, i.e. real packet losses.
if ((wrapAroundsSincePrev == 0 && timestamp < _prevTimestamp) ||
wrapAroundsSincePrev < 0) {
*delay = 0;
return false;
}
// Compute the compensated timestamp difference and convert it to ms and
// round it to closest integer.
// Compute the compensated timestamp difference and convert it to ms and round
// it to closest integer.
_dTS = static_cast<int64_t>(
(timestamp + wrapAroundsSincePrev * (static_cast<int64_t>(1) << 32) -
_prevTimestamp) /
90.0 +
0.5);
// frameDelay is the difference of dT and dTS -- i.e. the difference of
// the wall clock time difference and the timestamp difference between
// two following frames.
// frameDelay is the difference of dT and dTS -- i.e. the difference of the
// wall clock time difference and the timestamp difference between two
// following frames.
*delay = static_cast<int64_t>(currentWallClock - _prevWallClock - _dTS);
_prevTimestamp = timestamp;
@ -73,34 +72,22 @@ bool VCMInterFrameDelay::CalculateDelay(uint32_t timestamp,
return true;
}
// Returns the current difference between incoming timestamps
uint32_t VCMInterFrameDelay::CurrentTimeStampDiffMs() const {
if (_dTS < 0) {
return 0;
}
return static_cast<uint32_t>(_dTS);
}
// Investigates if the timestamp clock has overflowed since the last timestamp
// and
// keeps track of the number of wrap arounds since reset.
// and keeps track of the number of wrap arounds since reset.
void VCMInterFrameDelay::CheckForWrapArounds(uint32_t timestamp) {
if (timestamp < _prevTimestamp) {
// This difference will probably be less than -2^31 if we have had a wrap
// around
// (e.g. timestamp = 1, _previousTimestamp = 2^32 - 1). Since it is cast to
// a Word32,
// it should be positive.
// around (e.g. timestamp = 1, _prevTimestamp = 2^32 - 1). Since it is cast
// to a int32_t, it should be positive.
if (static_cast<int32_t>(timestamp - _prevTimestamp) > 0) {
// Forward wrap around
// Forward wrap around.
_wrapArounds++;
}
// This difference will probably be less than -2^31 if we have had a
// backward
// wrap around.
// Since it is cast to a Word32, it should be positive.
// backward wrap around. Since it is cast to a int32_t, it should be
// positive.
} else if (static_cast<int32_t>(_prevTimestamp - timestamp) > 0) {
// Backward wrap around
// Backward wrap around.
_wrapArounds--;
}
}

View File

@ -26,30 +26,23 @@ class VCMInterFrameDelay {
// This method is called when the frame is complete.
//
// Input:
// - timestamp : RTP timestamp of a received frame
// - timestamp : RTP timestamp of a received frame.
// - *delay : Pointer to memory where the result should be
// stored
// stored.
// - currentWallClock : The current time in milliseconds.
// Should be -1 for normal operation, only used
// for testing.
// Return value : true if OK, false when reordered timestamps
// Return value : true if OK, false when reordered timestamps.
bool CalculateDelay(uint32_t timestamp,
int64_t* delay,
int64_t currentWallClock);
// Returns the current difference between incoming timestamps
//
// Return value : Wrap-around compensated difference between
// incoming
// timestamps.
uint32_t CurrentTimeStampDiffMs() const;
private:
// Controls if the RTP timestamp counter has had a wrap around
// between the current and the previously received frame.
// Controls if the RTP timestamp counter has had a wrap around between the
// current and the previously received frame.
//
// Input:
// - timestmap : RTP timestamp of the current frame.
// - timestamp : RTP timestamp of the current frame.
void CheckForWrapArounds(uint32_t timestamp);
int64_t _zeroWallClock; // Local timestamp of the first video packet received