VCM/Timing: Setting clear names to members & methods

R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1524004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4140 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mikhal@webrtc.org 2013-05-30 16:20:18 +00:00
parent fddf6be339
commit adc64a7216
5 changed files with 39 additions and 39 deletions

View File

@ -149,7 +149,7 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(
} }
// We have a frame - Set timing and render timestamp. // We have a frame - Set timing and render timestamp.
timing_->SetRequiredDelay(jitter_buffer_.EstimatedJitterMs()); timing_->SetJitterDelay(jitter_buffer_.EstimatedJitterMs());
const int64_t now_ms = clock_->TimeInMilliseconds(); const int64_t now_ms = clock_->TimeInMilliseconds();
timing_->UpdateCurrentDelay(frame_timestamp); timing_->UpdateCurrentDelay(frame_timestamp);
next_render_time_ms = timing_->RenderTimeMs(frame_timestamp, now_ms); next_render_time_ms = timing_->RenderTimeMs(frame_timestamp, now_ms);
@ -332,7 +332,7 @@ int VCMReceiver::SetMinReceiverDelay(int desired_delay_ms) {
jitter_buffer_.SetMaxJitterEstimate(desired_delay_ms > 0); jitter_buffer_.SetMaxJitterEstimate(desired_delay_ms > 0);
max_video_delay_ms_ = desired_delay_ms + kMaxVideoDelayMs; max_video_delay_ms_ = desired_delay_ms + kMaxVideoDelayMs;
// Initializing timing to the desired delay. // Initializing timing to the desired delay.
timing_->SetMinimumTotalDelay(desired_delay_ms); timing_->set_min_playout_delay(desired_delay_ms);
return 0; return 0;
} }
@ -347,7 +347,7 @@ int VCMReceiver::RenderBufferSizeMs() {
} }
// Update timing. // Update timing.
const int64_t now_ms = clock_->TimeInMilliseconds(); const int64_t now_ms = clock_->TimeInMilliseconds();
timing_->SetRequiredDelay(jitter_buffer_.EstimatedJitterMs()); timing_->SetJitterDelay(jitter_buffer_.EstimatedJitterMs());
// Get render timestamps. // Get render timestamps.
uint32_t render_start = timing_->RenderTimeMs(timestamp_start, now_ms); uint32_t render_start = timing_->RenderTimeMs(timestamp_start, now_ms);
uint32_t render_end = timing_->RenderTimeMs(timestamp_end, now_ms); uint32_t render_end = timing_->RenderTimeMs(timestamp_end, now_ms);

View File

@ -33,8 +33,8 @@ VCMTiming::VCMTiming(Clock* clock,
ts_extrapolator_(), ts_extrapolator_(),
codec_timer_(), codec_timer_(),
render_delay_ms_(kDefaultRenderDelayMs), render_delay_ms_(kDefaultRenderDelayMs),
min_total_delay_ms_(0), min_playout_delay_ms_(0),
required_delay_ms_(0), jitter_delay_ms_(0),
current_delay_ms_(0), current_delay_ms_(0),
prev_frame_timestamp_(0) { prev_frame_timestamp_(0) {
if (master_timing == NULL) { if (master_timing == NULL) {
@ -57,8 +57,8 @@ void VCMTiming::Reset() {
ts_extrapolator_->Reset(); ts_extrapolator_->Reset();
codec_timer_.Reset(); codec_timer_.Reset();
render_delay_ms_ = kDefaultRenderDelayMs; render_delay_ms_ = kDefaultRenderDelayMs;
min_total_delay_ms_ = 0; min_playout_delay_ms_ = 0;
required_delay_ms_ = 0; jitter_delay_ms_ = 0;
current_delay_ms_ = 0; current_delay_ms_ = 0;
prev_frame_timestamp_ = 0; prev_frame_timestamp_ = 0;
} }
@ -67,28 +67,28 @@ void VCMTiming::ResetDecodeTime() {
codec_timer_.Reset(); codec_timer_.Reset();
} }
void VCMTiming::SetRenderDelay(uint32_t render_delay_ms) { void VCMTiming::set_render_delay(uint32_t render_delay_ms) {
CriticalSectionScoped cs(crit_sect_); CriticalSectionScoped cs(crit_sect_);
render_delay_ms_ = render_delay_ms; render_delay_ms_ = render_delay_ms;
} }
void VCMTiming::SetMinimumTotalDelay(uint32_t min_total_delay_ms) { void VCMTiming::set_min_playout_delay(uint32_t min_playout_delay_ms) {
CriticalSectionScoped cs(crit_sect_); CriticalSectionScoped cs(crit_sect_);
min_total_delay_ms_ = min_total_delay_ms; min_playout_delay_ms_ = min_playout_delay_ms;
} }
void VCMTiming::SetRequiredDelay(uint32_t required_delay_ms) { void VCMTiming::SetJitterDelay(uint32_t jitter_delay_ms) {
CriticalSectionScoped cs(crit_sect_); CriticalSectionScoped cs(crit_sect_);
if (required_delay_ms != required_delay_ms_) { if (jitter_delay_ms != jitter_delay_ms_) {
if (master_) { if (master_) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
VCMId(vcm_id_, timing_id_), VCMId(vcm_id_, timing_id_),
"Desired jitter buffer level: %u ms", required_delay_ms); "Desired jitter buffer level: %u ms", jitter_delay_ms);
} }
required_delay_ms_ = required_delay_ms; jitter_delay_ms_ = jitter_delay_ms;
// When in initial state, set current delay to minimum delay. // When in initial state, set current delay to minimum delay.
if (current_delay_ms_ == 0) { if (current_delay_ms_ == 0) {
current_delay_ms_ = required_delay_ms_; current_delay_ms_ = jitter_delay_ms_;
} }
} }
} }
@ -180,9 +180,9 @@ int64_t VCMTiming::RenderTimeMs(uint32_t frame_timestamp, int64_t now_ms)
if (master_) { if (master_) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(vcm_id_, WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(vcm_id_,
timing_id_), "Render frame %u at %u. Render delay %u", timing_id_), "Render frame %u at %u. Render delay %u",
"required delay %u, max decode time %u, min total delay %u", "jitter delay %u, max decode time %u, playout delay %u",
frame_timestamp, MaskWord64ToUWord32(render_time_ms), render_delay_ms_, frame_timestamp, MaskWord64ToUWord32(render_time_ms), render_delay_ms_,
required_delay_ms_, MaxDecodeTimeMs(), min_total_delay_ms_); jitter_delay_ms_, MaxDecodeTimeMs(), min_playout_delay_ms_);
} }
return render_time_ms; return render_time_ms;
} }
@ -200,8 +200,8 @@ int64_t VCMTiming::RenderTimeMsInternal(uint32_t frame_timestamp,
estimated_complete_time_ms = now_ms; estimated_complete_time_ms = now_ms;
} }
// Make sure that we have at least the total minimum delay. // Make sure that we have at least the playout delay.
uint32_t actual_delay = std::max(current_delay_ms_, min_total_delay_ms_); uint32_t actual_delay = std::max(current_delay_ms_, min_playout_delay_ms_);
return estimated_complete_time_ms + actual_delay; return estimated_complete_time_ms + actual_delay;
} }
@ -253,8 +253,8 @@ uint32_t VCMTiming::TargetVideoDelay() const {
} }
uint32_t VCMTiming::TargetDelayInternal() const { uint32_t VCMTiming::TargetDelayInternal() const {
return std::max(min_total_delay_ms_, return std::max(min_playout_delay_ms_,
required_delay_ms_ + MaxDecodeTimeMs() + render_delay_ms_); jitter_delay_ms_ + MaxDecodeTimeMs() + render_delay_ms_);
} }
} // namespace webrtc } // namespace webrtc

View File

@ -34,15 +34,15 @@ class VCMTiming {
void Reset(); void Reset();
void ResetDecodeTime(); void ResetDecodeTime();
// The amount of time needed to render an image. Defaults to 10 ms. // Set the amount of time needed to render an image. Defaults to 10 ms.
void SetRenderDelay(uint32_t render_delay_ms); void set_render_delay(uint32_t render_delay_ms);
// The minimum time the video must be delayed on the receiver to // Set the minimum time the video must be delayed on the receiver to
// get the desired jitter buffer level. // get the desired jitter buffer level.
void SetRequiredDelay(uint32_t required_delay_ms); void SetJitterDelay(uint32_t required_delay_ms);
// Minimum total delay required to sync video with audio. // Set the minimum playout delay required to sync video with audio.
void SetMinimumTotalDelay(uint32_t min_total_delay_ms); void set_min_playout_delay(uint32_t min_playout_delay);
// Increases or decreases the current delay to get closer to the target delay. // Increases or decreases the current delay to get closer to the target delay.
// Calculates how long it has been since the previous call to this function, // Calculates how long it has been since the previous call to this function,
@ -99,8 +99,8 @@ class VCMTiming {
VCMTimestampExtrapolator* ts_extrapolator_; VCMTimestampExtrapolator* ts_extrapolator_;
VCMCodecTimer codec_timer_; VCMCodecTimer codec_timer_;
uint32_t render_delay_ms_; uint32_t render_delay_ms_;
uint32_t min_total_delay_ms_; uint32_t min_playout_delay_ms_;
uint32_t required_delay_ms_; uint32_t jitter_delay_ms_;
uint32_t current_delay_ms_; uint32_t current_delay_ms_;
uint32_t prev_frame_timestamp_; uint32_t prev_frame_timestamp_;
}; };

View File

@ -39,9 +39,9 @@ TEST(ReceiverTiming, Tests) {
timing.IncomingTimestamp(timeStamp, clock.TimeInMilliseconds()); timing.IncomingTimestamp(timeStamp, clock.TimeInMilliseconds());
jitterDelayMs = 20; jitterDelayMs = 20;
timing.SetRequiredDelay(jitterDelayMs); timing.SetJitterDelay(jitterDelayMs);
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
timing.SetRenderDelay(0); timing.set_render_delay(0);
waitTime = timing.MaxWaitingTime( waitTime = timing.MaxWaitingTime(
timing.RenderTimeMs(timeStamp, clock.TimeInMilliseconds()), timing.RenderTimeMs(timeStamp, clock.TimeInMilliseconds()),
clock.TimeInMilliseconds()); clock.TimeInMilliseconds());
@ -52,7 +52,7 @@ TEST(ReceiverTiming, Tests) {
jitterDelayMs += VCMTiming::kDelayMaxChangeMsPerS + 10; jitterDelayMs += VCMTiming::kDelayMaxChangeMsPerS + 10;
timeStamp += 90000; timeStamp += 90000;
clock.AdvanceTimeMilliseconds(1000); clock.AdvanceTimeMilliseconds(1000);
timing.SetRequiredDelay(jitterDelayMs); timing.SetJitterDelay(jitterDelayMs);
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
waitTime = timing.MaxWaitingTime(timing.RenderTimeMs( waitTime = timing.MaxWaitingTime(timing.RenderTimeMs(
timeStamp, clock.TimeInMilliseconds()), clock.TimeInMilliseconds()); timeStamp, clock.TimeInMilliseconds()), clock.TimeInMilliseconds());
@ -91,7 +91,7 @@ TEST(ReceiverTiming, Tests) {
timing.IncomingTimestamp(timeStamp, clock.TimeInMilliseconds()); timing.IncomingTimestamp(timeStamp, clock.TimeInMilliseconds());
} }
maxDecodeTimeMs = 10; maxDecodeTimeMs = 10;
timing.SetRequiredDelay(jitterDelayMs); timing.SetJitterDelay(jitterDelayMs);
clock.AdvanceTimeMilliseconds(1000); clock.AdvanceTimeMilliseconds(1000);
timeStamp += 90000; timeStamp += 90000;
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
@ -101,12 +101,12 @@ TEST(ReceiverTiming, Tests) {
EXPECT_EQ(waitTime, jitterDelayMs); EXPECT_EQ(waitTime, jitterDelayMs);
uint32_t minTotalDelayMs = 200; uint32_t minTotalDelayMs = 200;
timing.SetMinimumTotalDelay(minTotalDelayMs); timing.set_min_playout_delay(minTotalDelayMs);
clock.AdvanceTimeMilliseconds(5000); clock.AdvanceTimeMilliseconds(5000);
timeStamp += 5*90000; timeStamp += 5*90000;
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);
const int kRenderDelayMs = 10; const int kRenderDelayMs = 10;
timing.SetRenderDelay(kRenderDelayMs); timing.set_render_delay(kRenderDelayMs);
waitTime = timing.MaxWaitingTime( waitTime = timing.MaxWaitingTime(
timing.RenderTimeMs(timeStamp, clock.TimeInMilliseconds()), timing.RenderTimeMs(timeStamp, clock.TimeInMilliseconds()),
clock.TimeInMilliseconds()); clock.TimeInMilliseconds());
@ -116,8 +116,8 @@ TEST(ReceiverTiming, Tests) {
// The total video delay should be equal to the min total delay. // The total video delay should be equal to the min total delay.
EXPECT_EQ(minTotalDelayMs, timing.TargetVideoDelay()); EXPECT_EQ(minTotalDelayMs, timing.TargetVideoDelay());
// Reset min total delay. // Reset playout delay.
timing.SetMinimumTotalDelay(0); timing.set_min_playout_delay(0);
clock.AdvanceTimeMilliseconds(5000); clock.AdvanceTimeMilliseconds(5000);
timeStamp += 5*90000; timeStamp += 5*90000;
timing.UpdateCurrentDelay(timeStamp); timing.UpdateCurrentDelay(timeStamp);

View File

@ -1292,7 +1292,7 @@ VideoCodingModuleImpl::IncomingPacket(const uint8_t* incomingPayload,
int32_t int32_t
VideoCodingModuleImpl::SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs) VideoCodingModuleImpl::SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs)
{ {
_timing.SetMinimumTotalDelay(minPlayoutDelayMs); _timing.set_min_playout_delay(minPlayoutDelayMs);
return VCM_OK; return VCM_OK;
} }
@ -1301,7 +1301,7 @@ VideoCodingModuleImpl::SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs)
int32_t int32_t
VideoCodingModuleImpl::SetRenderDelay(uint32_t timeMS) VideoCodingModuleImpl::SetRenderDelay(uint32_t timeMS)
{ {
_timing.SetRenderDelay(timeMS); _timing.set_render_delay(timeMS);
return VCM_OK; return VCM_OK;
} }