Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Side by Side Diff: webrtc/video/stream_synchronization_unittest.cc

Issue 2385763002: Add stats for frequency offset when converting RTP timestamp to NTP time. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/stream_synchronization.h ('k') | webrtc/video/video_receive_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 bool DelayedStreams(int audio_delay_ms, 91 bool DelayedStreams(int audio_delay_ms,
92 int video_delay_ms, 92 int video_delay_ms,
93 int current_audio_delay_ms, 93 int current_audio_delay_ms,
94 int* extra_audio_delay_ms, 94 int* extra_audio_delay_ms,
95 int* total_video_delay_ms) { 95 int* total_video_delay_ms) {
96 int audio_frequency = static_cast<int>(kDefaultAudioFrequency * 96 int audio_frequency = static_cast<int>(kDefaultAudioFrequency *
97 audio_clock_drift_ + 0.5); 97 audio_clock_drift_ + 0.5);
98 int audio_offset = 0; 98 int audio_offset = 0;
99 int video_frequency = static_cast<int>(kDefaultVideoFrequency * 99 int video_frequency = static_cast<int>(kDefaultVideoFrequency *
100 video_clock_drift_ + 0.5); 100 video_clock_drift_ + 0.5);
101 bool new_sr;
101 int video_offset = 0; 102 int video_offset = 0;
102 StreamSynchronization::Measurements audio; 103 StreamSynchronization::Measurements audio;
103 StreamSynchronization::Measurements video; 104 StreamSynchronization::Measurements video;
104 // Generate NTP/RTP timestamp pair for both streams corresponding to RTCP. 105 // Generate NTP/RTP timestamp pair for both streams corresponding to RTCP.
105 audio.rtcp.push_front(send_time_->GenerateRtcp(audio_frequency, 106 RtcpMeasurement rtcp =
106 audio_offset)); 107 send_time_->GenerateRtcp(audio_frequency, audio_offset);
108 EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_secs, rtcp.ntp_frac, rtcp.rtp_timestamp,
109 &audio.rtcp, &new_sr));
107 send_time_->IncreaseTimeMs(100); 110 send_time_->IncreaseTimeMs(100);
108 receive_time_->IncreaseTimeMs(100); 111 receive_time_->IncreaseTimeMs(100);
109 video.rtcp.push_front(send_time_->GenerateRtcp(video_frequency, 112 rtcp = send_time_->GenerateRtcp(video_frequency, video_offset);
110 video_offset)); 113 EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_secs, rtcp.ntp_frac, rtcp.rtp_timestamp,
114 &video.rtcp, &new_sr));
111 send_time_->IncreaseTimeMs(900); 115 send_time_->IncreaseTimeMs(900);
112 receive_time_->IncreaseTimeMs(900); 116 receive_time_->IncreaseTimeMs(900);
113 audio.rtcp.push_front(send_time_->GenerateRtcp(audio_frequency, 117 rtcp = send_time_->GenerateRtcp(audio_frequency, audio_offset);
114 audio_offset)); 118 EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_secs, rtcp.ntp_frac, rtcp.rtp_timestamp,
119 &audio.rtcp, &new_sr));
115 send_time_->IncreaseTimeMs(100); 120 send_time_->IncreaseTimeMs(100);
116 receive_time_->IncreaseTimeMs(100); 121 receive_time_->IncreaseTimeMs(100);
117 video.rtcp.push_front(send_time_->GenerateRtcp(video_frequency, 122 rtcp = send_time_->GenerateRtcp(video_frequency, video_offset);
118 video_offset)); 123 EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_secs, rtcp.ntp_frac, rtcp.rtp_timestamp,
124 &video.rtcp, &new_sr));
119 send_time_->IncreaseTimeMs(900); 125 send_time_->IncreaseTimeMs(900);
120 receive_time_->IncreaseTimeMs(900); 126 receive_time_->IncreaseTimeMs(900);
121 127
122 // Capture an audio and a video frame at the same time. 128 // Capture an audio and a video frame at the same time.
123 audio.latest_timestamp = send_time_->NowRtp(audio_frequency, 129 audio.latest_timestamp = send_time_->NowRtp(audio_frequency,
124 audio_offset); 130 audio_offset);
125 video.latest_timestamp = send_time_->NowRtp(video_frequency, 131 video.latest_timestamp = send_time_->NowRtp(video_frequency,
126 video_offset); 132 video_offset);
127 133
128 if (audio_delay_ms > video_delay_ms) { 134 if (audio_delay_ms > video_delay_ms) {
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 560
555 TEST_F(StreamSynchronizationTest, 561 TEST_F(StreamSynchronizationTest,
556 BothDelayedVideoLaterVideoClockDriftWithBaseDelay) { 562 BothDelayedVideoLaterVideoClockDriftWithBaseDelay) {
557 int base_target_delay_ms = 2000; 563 int base_target_delay_ms = 2000;
558 video_clock_drift_ = 1.05; 564 video_clock_drift_ = 1.05;
559 sync_->SetTargetBufferingDelay(base_target_delay_ms); 565 sync_->SetTargetBufferingDelay(base_target_delay_ms);
560 BothDelayedVideoLaterTest(base_target_delay_ms); 566 BothDelayedVideoLaterTest(base_target_delay_ms);
561 } 567 }
562 568
563 } // namespace webrtc 569 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/stream_synchronization.h ('k') | webrtc/video/video_receive_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698