Change NetEq::GetPlayoutTimestamp to return an rtc::Optional<uint32_t>
This is in preparation for changes to when the playout timestamp is valid. BUG=webrtc:5669 Review URL: https://codereview.webrtc.org/1853183002 Cr-Commit-Position: refs/heads/master@{#12256}
This commit is contained in:
committed by
Commit bot
parent
05255b0e8a
commit
9a410dd082
@ -666,7 +666,6 @@ void APITest::TestDelay(char side) {
|
||||
EventTimerWrapper* myEvent = EventTimerWrapper::Create();
|
||||
|
||||
uint32_t inTimestamp = 0;
|
||||
uint32_t outTimestamp = 0;
|
||||
double estimDelay = 0;
|
||||
|
||||
double averageEstimDelay = 0;
|
||||
@ -688,7 +687,8 @@ void APITest::TestDelay(char side) {
|
||||
CHECK_ERROR_MT(myACM->SetMinimumPlayoutDelay(*myMinDelay));
|
||||
|
||||
inTimestamp = myChannel->LastInTimestamp();
|
||||
CHECK_ERROR_MT(myACM->PlayoutTimestamp(&outTimestamp));
|
||||
rtc::Optional<uint32_t> outTimestamp = myACM->PlayoutTimestamp();
|
||||
CHECK_ERROR_MT(outTimestamp ? 0 : -1);
|
||||
|
||||
if (!_randomTest) {
|
||||
myEvent->StartTimer(true, 30);
|
||||
@ -698,11 +698,12 @@ void APITest::TestDelay(char side) {
|
||||
myEvent->Wait(1000);
|
||||
|
||||
inTimestamp = myChannel->LastInTimestamp();
|
||||
CHECK_ERROR_MT(myACM->PlayoutTimestamp(&outTimestamp));
|
||||
outTimestamp = myACM->PlayoutTimestamp();
|
||||
CHECK_ERROR_MT(outTimestamp ? 0 : -1);
|
||||
|
||||
//std::cout << outTimestamp << std::endl << std::flush;
|
||||
estimDelay = (double) ((uint32_t)(inTimestamp - outTimestamp))
|
||||
/ ((double) myACM->ReceiveFrequency() / 1000.0);
|
||||
estimDelay = (double)((uint32_t)(inTimestamp - *outTimestamp)) /
|
||||
((double)myACM->ReceiveFrequency() / 1000.0);
|
||||
|
||||
estimDelayCB.Update(estimDelay);
|
||||
|
||||
|
||||
@ -180,7 +180,6 @@ class DelayTest {
|
||||
|
||||
int num_frames = 0;
|
||||
int in_file_frames = 0;
|
||||
uint32_t playout_ts;
|
||||
uint32_t received_ts;
|
||||
double average_delay = 0;
|
||||
double inst_delay_sec = 0;
|
||||
@ -209,10 +208,11 @@ class DelayTest {
|
||||
out_file_b_.Write10MsData(
|
||||
audio_frame.data_,
|
||||
audio_frame.samples_per_channel_ * audio_frame.num_channels_);
|
||||
acm_b_->PlayoutTimestamp(&playout_ts);
|
||||
received_ts = channel_a2b_->LastInTimestamp();
|
||||
inst_delay_sec = static_cast<uint32_t>(received_ts - playout_ts)
|
||||
/ static_cast<double>(encoding_sample_rate_hz_);
|
||||
rtc::Optional<uint32_t> playout_timestamp = acm_b_->PlayoutTimestamp();
|
||||
ASSERT_TRUE(playout_timestamp);
|
||||
inst_delay_sec = static_cast<uint32_t>(received_ts - *playout_timestamp) /
|
||||
static_cast<double>(encoding_sample_rate_hz_);
|
||||
|
||||
if (num_frames > 10)
|
||||
average_delay = 0.95 * average_delay + 0.05 * inst_delay_sec;
|
||||
|
||||
Reference in New Issue
Block a user