Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
loss_estimator.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 Roc Streaming authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_rtcp/loss_estimator.h
10 //! @brief Loss estimator.
11 
12 #ifndef ROC_RTCP_LOSS_ESTIMATOR_H_
13 #define ROC_RTCP_LOSS_ESTIMATOR_H_
14 
15 #include "roc_core/stddefs.h"
16 
17 namespace roc {
18 namespace rtcp {
19 
20 //! Computes fractions loss ration since last report.
22 public:
23  //! Initialize.
25 
26  //! Update and return fractional loss ration since previous update.
27  //! @p total_packets defines total count of packets expected.
28  //! @p lost_packets defines count of packets not received,
29  //! probably negative dues to duplicates.
30  float update(uint64_t total_packets, int64_t lost_packets);
31 
32 private:
33  uint64_t prev_total_;
34  int64_t prev_lost_;
35 };
36 
37 } // namespace rtcp
38 } // namespace roc
39 
40 #endif // ROC_RTCP_LOSS_ESTIMATOR_H_
Computes fractions loss ration since last report.
LossEstimator()
Initialize.
float update(uint64_t total_packets, int64_t lost_packets)
Update and return fractional loss ration since previous update. total_packets defines total count of ...
Root namespace.
Commonly used types and functions.