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:
@ -16,7 +16,7 @@ VCMInterFrameDelay::VCMInterFrameDelay(int64_t currentWallClock) {
|
|||||||
Reset(currentWallClock);
|
Reset(currentWallClock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resets the delay estimate
|
// Resets the delay estimate.
|
||||||
void VCMInterFrameDelay::Reset(int64_t currentWallClock) {
|
void VCMInterFrameDelay::Reset(int64_t currentWallClock) {
|
||||||
_zeroWallClock = currentWallClock;
|
_zeroWallClock = currentWallClock;
|
||||||
_wrapArounds = 0;
|
_wrapArounds = 0;
|
||||||
@ -31,7 +31,7 @@ bool VCMInterFrameDelay::CalculateDelay(uint32_t timestamp,
|
|||||||
int64_t* delay,
|
int64_t* delay,
|
||||||
int64_t currentWallClock) {
|
int64_t currentWallClock) {
|
||||||
if (_prevWallClock == 0) {
|
if (_prevWallClock == 0) {
|
||||||
// First set of data, initialization, wait for next frame
|
// First set of data, initialization, wait for next frame.
|
||||||
_prevWallClock = currentWallClock;
|
_prevWallClock = currentWallClock;
|
||||||
_prevTimestamp = timestamp;
|
_prevTimestamp = timestamp;
|
||||||
*delay = 0;
|
*delay = 0;
|
||||||
@ -41,30 +41,29 @@ bool VCMInterFrameDelay::CalculateDelay(uint32_t timestamp,
|
|||||||
int32_t prevWrapArounds = _wrapArounds;
|
int32_t prevWrapArounds = _wrapArounds;
|
||||||
CheckForWrapArounds(timestamp);
|
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;
|
int32_t wrapAroundsSincePrev = _wrapArounds - prevWrapArounds;
|
||||||
|
|
||||||
// Account for reordering in jitter variance estimate in the future?
|
// Account for reordering in jitter variance estimate in the future?
|
||||||
// Note that this also captures incomplete frames which are grabbed
|
// Note that this also captures incomplete frames which are grabbed for
|
||||||
// for decoding after a later frame has been complete, i.e. real
|
// decoding after a later frame has been complete, i.e. real packet losses.
|
||||||
// packet losses.
|
|
||||||
if ((wrapAroundsSincePrev == 0 && timestamp < _prevTimestamp) ||
|
if ((wrapAroundsSincePrev == 0 && timestamp < _prevTimestamp) ||
|
||||||
wrapAroundsSincePrev < 0) {
|
wrapAroundsSincePrev < 0) {
|
||||||
*delay = 0;
|
*delay = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the compensated timestamp difference and convert it to ms and
|
// Compute the compensated timestamp difference and convert it to ms and round
|
||||||
// round it to closest integer.
|
// it to closest integer.
|
||||||
_dTS = static_cast<int64_t>(
|
_dTS = static_cast<int64_t>(
|
||||||
(timestamp + wrapAroundsSincePrev * (static_cast<int64_t>(1) << 32) -
|
(timestamp + wrapAroundsSincePrev * (static_cast<int64_t>(1) << 32) -
|
||||||
_prevTimestamp) /
|
_prevTimestamp) /
|
||||||
90.0 +
|
90.0 +
|
||||||
0.5);
|
0.5);
|
||||||
|
|
||||||
// frameDelay is the difference of dT and dTS -- i.e. the difference of
|
// frameDelay is the difference of dT and dTS -- i.e. the difference of the
|
||||||
// the wall clock time difference and the timestamp difference between
|
// wall clock time difference and the timestamp difference between two
|
||||||
// two following frames.
|
// following frames.
|
||||||
*delay = static_cast<int64_t>(currentWallClock - _prevWallClock - _dTS);
|
*delay = static_cast<int64_t>(currentWallClock - _prevWallClock - _dTS);
|
||||||
|
|
||||||
_prevTimestamp = timestamp;
|
_prevTimestamp = timestamp;
|
||||||
@ -73,34 +72,22 @@ bool VCMInterFrameDelay::CalculateDelay(uint32_t timestamp,
|
|||||||
return true;
|
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
|
// Investigates if the timestamp clock has overflowed since the last timestamp
|
||||||
// and
|
// and keeps track of the number of wrap arounds since reset.
|
||||||
// keeps track of the number of wrap arounds since reset.
|
|
||||||
void VCMInterFrameDelay::CheckForWrapArounds(uint32_t timestamp) {
|
void VCMInterFrameDelay::CheckForWrapArounds(uint32_t timestamp) {
|
||||||
if (timestamp < _prevTimestamp) {
|
if (timestamp < _prevTimestamp) {
|
||||||
// This difference will probably be less than -2^31 if we have had a wrap
|
// This difference will probably be less than -2^31 if we have had a wrap
|
||||||
// around
|
// around (e.g. timestamp = 1, _prevTimestamp = 2^32 - 1). Since it is cast
|
||||||
// (e.g. timestamp = 1, _previousTimestamp = 2^32 - 1). Since it is cast to
|
// to a int32_t, it should be positive.
|
||||||
// a Word32,
|
|
||||||
// it should be positive.
|
|
||||||
if (static_cast<int32_t>(timestamp - _prevTimestamp) > 0) {
|
if (static_cast<int32_t>(timestamp - _prevTimestamp) > 0) {
|
||||||
// Forward wrap around
|
// Forward wrap around.
|
||||||
_wrapArounds++;
|
_wrapArounds++;
|
||||||
}
|
}
|
||||||
// This difference will probably be less than -2^31 if we have had a
|
// This difference will probably be less than -2^31 if we have had a
|
||||||
// backward
|
// backward wrap around. Since it is cast to a int32_t, it should be
|
||||||
// wrap around.
|
// positive.
|
||||||
// Since it is cast to a Word32, it should be positive.
|
|
||||||
} else if (static_cast<int32_t>(_prevTimestamp - timestamp) > 0) {
|
} else if (static_cast<int32_t>(_prevTimestamp - timestamp) > 0) {
|
||||||
// Backward wrap around
|
// Backward wrap around.
|
||||||
_wrapArounds--;
|
_wrapArounds--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,30 +26,23 @@ class VCMInterFrameDelay {
|
|||||||
// This method is called when the frame is complete.
|
// This method is called when the frame is complete.
|
||||||
//
|
//
|
||||||
// Input:
|
// Input:
|
||||||
// - timestamp : RTP timestamp of a received frame
|
// - timestamp : RTP timestamp of a received frame.
|
||||||
// - *delay : Pointer to memory where the result should be
|
// - *delay : Pointer to memory where the result should be
|
||||||
// stored
|
// stored.
|
||||||
// - currentWallClock : The current time in milliseconds.
|
// - currentWallClock : The current time in milliseconds.
|
||||||
// Should be -1 for normal operation, only used
|
// Should be -1 for normal operation, only used
|
||||||
// for testing.
|
// 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,
|
bool CalculateDelay(uint32_t timestamp,
|
||||||
int64_t* delay,
|
int64_t* delay,
|
||||||
int64_t currentWallClock);
|
int64_t currentWallClock);
|
||||||
|
|
||||||
// Returns the current difference between incoming timestamps
|
|
||||||
//
|
|
||||||
// Return value : Wrap-around compensated difference between
|
|
||||||
// incoming
|
|
||||||
// timestamps.
|
|
||||||
uint32_t CurrentTimeStampDiffMs() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Controls if the RTP timestamp counter has had a wrap around
|
// Controls if the RTP timestamp counter has had a wrap around between the
|
||||||
// between the current and the previously received frame.
|
// current and the previously received frame.
|
||||||
//
|
//
|
||||||
// Input:
|
// Input:
|
||||||
// - timestmap : RTP timestamp of the current frame.
|
// - timestamp : RTP timestamp of the current frame.
|
||||||
void CheckForWrapArounds(uint32_t timestamp);
|
void CheckForWrapArounds(uint32_t timestamp);
|
||||||
|
|
||||||
int64_t _zeroWallClock; // Local timestamp of the first video packet received
|
int64_t _zeroWallClock; // Local timestamp of the first video packet received
|
||||||
|
Reference in New Issue
Block a user