Delete internal locking in TimestampExtrapolator class.
Only use, in VCMTiming, protects it with its own mutex. Bug: webrtc:12102 Change-Id: I9c09976f9d938565b3e2908eca6cfee0c4063f6f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190721 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32529}
This commit is contained in:
parent
4efa9d0a5f
commit
d3a3e9ef36
@ -118,8 +118,10 @@ class VCMTiming {
|
||||
mutable Mutex mutex_;
|
||||
Clock* const clock_;
|
||||
bool master_ RTC_GUARDED_BY(mutex_);
|
||||
TimestampExtrapolator* ts_extrapolator_ RTC_GUARDED_BY(mutex_);
|
||||
std::unique_ptr<VCMCodecTimer> codec_timer_ RTC_GUARDED_BY(mutex_);
|
||||
TimestampExtrapolator* ts_extrapolator_ RTC_GUARDED_BY(mutex_)
|
||||
RTC_PT_GUARDED_BY(mutex_);
|
||||
std::unique_ptr<VCMCodecTimer> codec_timer_ RTC_GUARDED_BY(mutex_)
|
||||
RTC_PT_GUARDED_BY(mutex_);
|
||||
int render_delay_ms_ RTC_GUARDED_BY(mutex_);
|
||||
// Best-effort playout delay range for frames from capture to render.
|
||||
// The receiver tries to keep the delay between |min_playout_delay_ms_|
|
||||
|
||||
@ -15,8 +15,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
TimestampExtrapolator::TimestampExtrapolator(int64_t start_ms)
|
||||
: _rwLock(RWLockWrapper::CreateRWLock()),
|
||||
_startMs(0),
|
||||
: _startMs(0),
|
||||
_firstTimestamp(0),
|
||||
_wrapArounds(0),
|
||||
_prevUnwrappedTimestamp(-1),
|
||||
@ -34,12 +33,7 @@ TimestampExtrapolator::TimestampExtrapolator(int64_t start_ms)
|
||||
Reset(start_ms);
|
||||
}
|
||||
|
||||
TimestampExtrapolator::~TimestampExtrapolator() {
|
||||
delete _rwLock;
|
||||
}
|
||||
|
||||
void TimestampExtrapolator::Reset(int64_t start_ms) {
|
||||
WriteLockScoped wl(*_rwLock);
|
||||
_startMs = start_ms;
|
||||
_prevMs = _startMs;
|
||||
_firstTimestamp = 0;
|
||||
@ -58,13 +52,10 @@ void TimestampExtrapolator::Reset(int64_t start_ms) {
|
||||
}
|
||||
|
||||
void TimestampExtrapolator::Update(int64_t tMs, uint32_t ts90khz) {
|
||||
_rwLock->AcquireLockExclusive();
|
||||
if (tMs - _prevMs > 10e3) {
|
||||
// Ten seconds without a complete frame.
|
||||
// Reset the extrapolator
|
||||
_rwLock->ReleaseLockExclusive();
|
||||
Reset(tMs);
|
||||
_rwLock->AcquireLockExclusive();
|
||||
} else {
|
||||
_prevMs = tMs;
|
||||
}
|
||||
@ -100,7 +91,6 @@ void TimestampExtrapolator::Update(int64_t tMs, uint32_t ts90khz) {
|
||||
if (_prevUnwrappedTimestamp >= 0 &&
|
||||
unwrapped_ts90khz < _prevUnwrappedTimestamp) {
|
||||
// Drop reordered frames.
|
||||
_rwLock->ReleaseLockExclusive();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -131,11 +121,9 @@ void TimestampExtrapolator::Update(int64_t tMs, uint32_t ts90khz) {
|
||||
if (_packetCount < _startUpFilterDelayInPackets) {
|
||||
_packetCount++;
|
||||
}
|
||||
_rwLock->ReleaseLockExclusive();
|
||||
}
|
||||
|
||||
int64_t TimestampExtrapolator::ExtrapolateLocalTime(uint32_t timestamp90khz) {
|
||||
ReadLockScoped rl(*_rwLock);
|
||||
int64_t localTimeMs = 0;
|
||||
CheckForWrapArounds(timestamp90khz);
|
||||
double unwrapped_ts90khz =
|
||||
|
||||
@ -13,14 +13,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "rtc_base/synchronization/rw_lock_wrapper.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// Not thread safe.
|
||||
class TimestampExtrapolator {
|
||||
public:
|
||||
explicit TimestampExtrapolator(int64_t start_ms);
|
||||
~TimestampExtrapolator();
|
||||
void Update(int64_t tMs, uint32_t ts90khz);
|
||||
int64_t ExtrapolateLocalTime(uint32_t timestamp90khz);
|
||||
void Reset(int64_t start_ms);
|
||||
@ -28,7 +26,6 @@ class TimestampExtrapolator {
|
||||
private:
|
||||
void CheckForWrapArounds(uint32_t ts90khz);
|
||||
bool DelayChangeDetection(double error);
|
||||
RWLockWrapper* _rwLock;
|
||||
double _w[2];
|
||||
double _pP[2][2];
|
||||
int64_t _startMs;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user