Handle multiple calls to set initial delay
BUG= 1419 Review URL: https://webrtc-codereview.appspot.com/1113005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3562 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
7bf7326d0b
commit
0d8d010017
@ -249,13 +249,15 @@ bool StreamSynchronization::ComputeDelays(int relative_delay_ms,
|
||||
}
|
||||
|
||||
void StreamSynchronization::SetTargetBufferingDelay(int target_delay_ms) {
|
||||
// Initial extra delay for audio (accounting for existing extra delay).
|
||||
channel_delay_->extra_audio_delay_ms +=
|
||||
target_delay_ms - base_target_delay_ms_;
|
||||
// The video delay is compared to the last value (and how much we can update
|
||||
// is limited by that as well).
|
||||
channel_delay_->last_video_delay_ms +=
|
||||
target_delay_ms - base_target_delay_ms_;
|
||||
// Video is already delayed by the desired amount.
|
||||
base_target_delay_ms_ = target_delay_ms;
|
||||
// Setting initial extra delay for audio.
|
||||
channel_delay_->extra_audio_delay_ms += target_delay_ms;
|
||||
// The video delay is compared to the last value (and how much we can updated
|
||||
// is limited by that as well).
|
||||
channel_delay_->last_video_delay_ms += target_delay_ms;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -490,6 +490,27 @@ TEST_F(StreamSynchronizationTest, BaseDelay) {
|
||||
&extra_audio_delay_ms, &total_video_delay_ms));
|
||||
EXPECT_EQ(base_target_delay_ms, extra_audio_delay_ms);
|
||||
EXPECT_EQ(base_target_delay_ms, total_video_delay_ms);
|
||||
// Triggering another call with the same values. Delay should not be modified.
|
||||
base_target_delay_ms = 2000;
|
||||
current_audio_delay_ms = base_target_delay_ms;
|
||||
total_video_delay_ms = base_target_delay_ms;
|
||||
sync_->SetTargetBufferingDelay(base_target_delay_ms);
|
||||
EXPECT_TRUE(DelayedStreams(base_target_delay_ms, base_target_delay_ms,
|
||||
current_audio_delay_ms,
|
||||
&extra_audio_delay_ms, &total_video_delay_ms));
|
||||
EXPECT_EQ(base_target_delay_ms, extra_audio_delay_ms);
|
||||
EXPECT_EQ(base_target_delay_ms, total_video_delay_ms);
|
||||
// Changing delay value - intended to test this module only. In practice it
|
||||
// would take VoE time to adapt.
|
||||
base_target_delay_ms = 5000;
|
||||
current_audio_delay_ms = base_target_delay_ms;
|
||||
total_video_delay_ms = base_target_delay_ms;
|
||||
sync_->SetTargetBufferingDelay(base_target_delay_ms);
|
||||
EXPECT_TRUE(DelayedStreams(base_target_delay_ms, base_target_delay_ms,
|
||||
current_audio_delay_ms,
|
||||
&extra_audio_delay_ms, &total_video_delay_ms));
|
||||
EXPECT_EQ(base_target_delay_ms, extra_audio_delay_ms);
|
||||
EXPECT_EQ(base_target_delay_ms, total_video_delay_ms);
|
||||
}
|
||||
|
||||
TEST_F(StreamSynchronizationTest, BothDelayedAudioLaterWithBaseDelay) {
|
||||
|
Loading…
Reference in New Issue
Block a user