Chromium Code Reviews| Index: webrtc/system_wrappers/include/rtp_to_ntp.h |
| diff --git a/webrtc/system_wrappers/include/rtp_to_ntp.h b/webrtc/system_wrappers/include/rtp_to_ntp.h |
| index 0c91928626dd8701599c0744f3a046661126cb76..866144116c89bf39364c56369377a5e2774f01a2 100644 |
| --- a/webrtc/system_wrappers/include/rtp_to_ntp.h |
| +++ b/webrtc/system_wrappers/include/rtp_to_ntp.h |
| @@ -20,26 +20,47 @@ namespace webrtc { |
| struct RtcpMeasurement { |
| RtcpMeasurement(); |
| RtcpMeasurement(uint32_t ntp_secs, uint32_t ntp_frac, uint32_t timestamp); |
| + bool IsEqual(const RtcpMeasurement& other) const; |
| + |
| uint32_t ntp_secs; |
| uint32_t ntp_frac; |
| uint32_t rtp_timestamp; |
| }; |
| -typedef std::list<RtcpMeasurement> RtcpList; |
| +struct RtcpMeasurements { |
|
stefan-webrtc
2016/11/01 13:48:55
Maybe this should be a class now that it has so ma
åsapersson
2016/11/01 14:03:11
Yes, I thought about making a class with UpdateRtc
stefan-webrtc
2016/11/01 15:19:26
Sure sgtm
|
| + RtcpMeasurements(); |
| + ~RtcpMeasurements(); |
| + bool Contains(const RtcpMeasurement& other) const; |
| + bool IsValid(const RtcpMeasurement& other) const; |
| + void UpdateParameters(); |
| + |
| + // Estimated parameters from RTP and NTP timestamp pairs in |list|. |
| + struct RtpToNtpParameters { |
| + double frequency_khz = 0.0; |
| + double offset_ms = 0.0; |
| + bool calculated = false; |
| + }; |
| + |
| + std::list<RtcpMeasurement> list; |
| + RtpToNtpParameters params; |
| +}; |
| -// Updates |rtcp_list| with timestamps from the latest RTCP SR. |
| +// Updates |list| in |rtcp_measurements| with timestamps from the RTCP SR. |
| // |new_rtcp_sr| will be set to true if these are the timestamps which have |
| -// never be added to |rtcp_list|. |
| +// never be added to |list|. |
| +// |rtcp_measurements.params| are estimated from the RTP and NTP timestamp pairs |
| +// in the |list| when a new RTCP SR is inserted. |
| bool UpdateRtcpList(uint32_t ntp_secs, |
| uint32_t ntp_frac, |
| uint32_t rtp_timestamp, |
| - RtcpList* rtcp_list, |
| + RtcpMeasurements* rtcp_measurements, |
| bool* new_rtcp_sr); |
| -// Converts an RTP timestamp to the NTP domain in milliseconds using two |
| -// (RTP timestamp, NTP timestamp) pairs. |
| -bool RtpToNtpMs(int64_t rtp_timestamp, const RtcpList& rtcp, |
| - int64_t* timestamp_in_ms); |
| +// Converts an RTP timestamp to the NTP domain in milliseconds using the |
| +// estimated |rtcp_measurements.params|. |
| +bool RtpToNtpMs(int64_t rtp_timestamp, |
| + const RtcpMeasurements& rtcp_measurements, |
| + int64_t* rtp_timestamp_in_ms); |
| // Returns 1 there has been a forward wrap around, 0 if there has been no wrap |
| // around and -1 if there has been a backwards wrap around (i.e. reordering). |