syncable.h (1850B)
1 /* 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 // Syncable is used by RtpStreamsSynchronizer in VideoReceiveStreamInterface, 12 // and implemented by AudioReceiveStreamInterface. 13 14 #ifndef CALL_SYNCABLE_H_ 15 #define CALL_SYNCABLE_H_ 16 17 #include <cstdint> 18 #include <optional> 19 20 #include "api/units/time_delta.h" 21 #include "api/units/timestamp.h" 22 #include "system_wrappers/include/ntp_time.h" 23 24 namespace webrtc { 25 26 class Syncable { 27 public: 28 struct Info { 29 // Local time when the the last RTP packet was received. 30 Timestamp latest_receive_time = Timestamp::Zero(); 31 // RTP timestamp of the last RTP packet received. 32 uint32_t latest_received_capture_rtp_timestamp = 0; 33 34 // NTP and RTP timestamp from the last RTCP sender report received. 35 uint32_t capture_time_rtp = 0; 36 NtpTime capture_time_ntp; 37 38 // Current playout delay for the given `Syncable`. 39 TimeDelta current_delay; 40 }; 41 42 // Mapping between capture/render time in RTP timestamps and local clock. 43 struct PlayoutInfo { 44 Timestamp time; 45 uint32_t rtp_timestamp; 46 }; 47 48 virtual ~Syncable(); 49 50 virtual uint32_t id() const = 0; 51 virtual std::optional<Info> GetInfo() const = 0; 52 virtual std::optional<PlayoutInfo> GetPlayoutRtpTimestamp() const = 0; 53 virtual bool SetMinimumPlayoutDelay(TimeDelta delay) = 0; 54 virtual void SetEstimatedPlayoutNtpTimestamp(NtpTime ntp_time, 55 Timestamp time) = 0; 56 }; 57 } // namespace webrtc 58 59 #endif // CALL_SYNCABLE_H_