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

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

Issue 2574133003: Make class of static functions in rtp_to_ntp.h: (Closed)
Patch Set: address comments Created 4 years 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
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 23 matching lines...) Expand all
34 34
35 uint32_t ntp_secs = 0; 35 uint32_t ntp_secs = 0;
36 uint32_t ntp_frac = 0; 36 uint32_t ntp_frac = 0;
37 uint32_t rtp_timestamp = 0; 37 uint32_t rtp_timestamp = 0;
38 if (rtp_rtcp->RemoteNTP(&ntp_secs, &ntp_frac, nullptr, nullptr, 38 if (rtp_rtcp->RemoteNTP(&ntp_secs, &ntp_frac, nullptr, nullptr,
39 &rtp_timestamp) != 0) { 39 &rtp_timestamp) != 0) {
40 return false; 40 return false;
41 } 41 }
42 42
43 bool new_rtcp_sr = false; 43 bool new_rtcp_sr = false;
44 if (!UpdateRtcpList(ntp_secs, ntp_frac, rtp_timestamp, &stream->rtcp, 44 if (!stream->rtp_to_ntp.UpdateMeasurements(ntp_secs, ntp_frac, rtp_timestamp,
45 &new_rtcp_sr)) { 45 &new_rtcp_sr)) {
46 return false; 46 return false;
47 } 47 }
48 48
49 return true; 49 return true;
50 } 50 }
51 } // namespace 51 } // namespace
52 52
53 RtpStreamsSynchronizer::RtpStreamsSynchronizer( 53 RtpStreamsSynchronizer::RtpStreamsSynchronizer(
54 vcm::VideoReceiver* video_receiver, 54 vcm::VideoReceiver* video_receiver,
55 RtpStreamReceiver* rtp_stream_receiver) 55 RtpStreamReceiver* rtp_stream_receiver)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (voe_channel_id_ == -1) 176 if (voe_channel_id_ == -1)
177 return false; 177 return false;
178 178
179 uint32_t playout_timestamp = 0; 179 uint32_t playout_timestamp = 0;
180 if (voe_sync_interface_->GetPlayoutTimestamp(voe_channel_id_, 180 if (voe_sync_interface_->GetPlayoutTimestamp(voe_channel_id_,
181 playout_timestamp) != 0) { 181 playout_timestamp) != 0) {
182 return false; 182 return false;
183 } 183 }
184 184
185 int64_t latest_audio_ntp; 185 int64_t latest_audio_ntp;
186 if (!RtpToNtpMs(playout_timestamp, audio_measurement_.rtcp, 186 if (!audio_measurement_.rtp_to_ntp.Estimate(playout_timestamp,
187 &latest_audio_ntp)) { 187 &latest_audio_ntp)) {
188 return false; 188 return false;
189 } 189 }
190 190
191 int64_t latest_video_ntp; 191 int64_t latest_video_ntp;
192 if (!RtpToNtpMs(frame.timestamp(), video_measurement_.rtcp, 192 if (!video_measurement_.rtp_to_ntp.Estimate(frame.timestamp(),
193 &latest_video_ntp)) { 193 &latest_video_ntp)) {
194 return false; 194 return false;
195 } 195 }
196 196
197 int64_t time_to_render_ms = 197 int64_t time_to_render_ms =
198 frame.render_time_ms() - clock_->TimeInMilliseconds(); 198 frame.render_time_ms() - clock_->TimeInMilliseconds();
199 if (time_to_render_ms > 0) 199 if (time_to_render_ms > 0)
200 latest_video_ntp += time_to_render_ms; 200 latest_video_ntp += time_to_render_ms;
201 201
202 *stream_offset_ms = latest_audio_ntp - latest_video_ntp; 202 *stream_offset_ms = latest_audio_ntp - latest_video_ntp;
203 *estimated_freq_khz = video_measurement_.rtcp.params.frequency_khz; 203 *estimated_freq_khz = video_measurement_.rtp_to_ntp.params().frequency_khz;
204 return true; 204 return true;
205 } 205 }
206 206
207 } // namespace webrtc 207 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/system_wrappers/source/rtp_to_ntp_unittest.cc ('k') | webrtc/video/stream_synchronization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698