2011-07-07 08:21:25 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-05-23 09:53:15 +02:00
|
|
|
#ifndef MODULES_VIDEO_CODING_TIMING_INTER_FRAME_DELAY_H_
|
|
|
|
|
#define MODULES_VIDEO_CODING_TIMING_INTER_FRAME_DELAY_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2018-07-25 16:05:48 +02:00
|
|
|
#include <stdint.h>
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2022-03-07 14:50:51 +01:00
|
|
|
#include "absl/types/optional.h"
|
|
|
|
|
#include "api/units/time_delta.h"
|
|
|
|
|
#include "api/units/timestamp.h"
|
|
|
|
|
#include "modules/include/module_common_types_public.h"
|
|
|
|
|
|
2015-12-21 04:12:39 -08:00
|
|
|
namespace webrtc {
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2022-05-23 09:53:15 +02:00
|
|
|
class InterFrameDelay {
|
2015-12-21 04:12:39 -08:00
|
|
|
public:
|
2022-05-23 09:53:15 +02:00
|
|
|
InterFrameDelay();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-21 04:12:39 -08:00
|
|
|
// Resets the estimate. Zeros are given as parameters.
|
2022-03-07 14:50:51 +01:00
|
|
|
void Reset();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-21 04:12:39 -08:00
|
|
|
// Calculates the delay of a frame with the given timestamp.
|
|
|
|
|
// This method is called when the frame is complete.
|
2022-03-07 14:50:51 +01:00
|
|
|
absl::optional<TimeDelta> CalculateDelay(uint32_t rtp_timestamp,
|
|
|
|
|
Timestamp now);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-21 04:12:39 -08:00
|
|
|
private:
|
2022-03-07 14:50:51 +01:00
|
|
|
// The previous rtp timestamp passed to the delay estimate
|
|
|
|
|
int64_t prev_rtp_timestamp_unwrapped_;
|
|
|
|
|
TimestampUnwrapper unwrapper_;
|
|
|
|
|
|
2015-12-21 04:12:39 -08:00
|
|
|
// The previous wall clock timestamp used by the delay estimate
|
2022-03-07 14:50:51 +01:00
|
|
|
absl::optional<Timestamp> prev_wall_clock_;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
2013-07-03 15:12:26 +00:00
|
|
|
} // namespace webrtc
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2022-05-23 09:53:15 +02:00
|
|
|
#endif // MODULES_VIDEO_CODING_TIMING_INTER_FRAME_DELAY_H_
|