mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 23:01:21 +01:00

Bug: webrtc:13982 Change-Id: I0c4fe63f47d842fc5871baeb1137aa225bc10ea4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/288960 Auto-Submit: Evan Shrubsole <eshr@webrtc.org> Commit-Queue: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39039}
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
/*
|
|
* 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.
|
|
*/
|
|
|
|
#ifndef MODULES_VIDEO_CODING_TIMING_INTER_FRAME_DELAY_H_
|
|
#define MODULES_VIDEO_CODING_TIMING_INTER_FRAME_DELAY_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "absl/types/optional.h"
|
|
#include "api/units/time_delta.h"
|
|
#include "api/units/timestamp.h"
|
|
#include "rtc_base/numerics/sequence_number_unwrapper.h"
|
|
|
|
namespace webrtc {
|
|
|
|
class InterFrameDelay {
|
|
public:
|
|
InterFrameDelay();
|
|
|
|
// Resets the estimate. Zeros are given as parameters.
|
|
void Reset();
|
|
|
|
// Calculates the delay of a frame with the given timestamp.
|
|
// This method is called when the frame is complete.
|
|
absl::optional<TimeDelta> CalculateDelay(uint32_t rtp_timestamp,
|
|
Timestamp now);
|
|
|
|
private:
|
|
// The previous rtp timestamp passed to the delay estimate
|
|
int64_t prev_rtp_timestamp_unwrapped_;
|
|
RtpTimestampUnwrapper unwrapper_;
|
|
|
|
// The previous wall clock timestamp used by the delay estimate
|
|
absl::optional<Timestamp> prev_wall_clock_;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // MODULES_VIDEO_CODING_TIMING_INTER_FRAME_DELAY_H_
|