![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include <decklink_drift_fix.hpp>

Public Member Functions | |
| void | calculate_missing (uint32_t buffer_samples, uint32_t samples) |
| A quick way of roughly calculating if the buffer has emptied by the size of a single audio frame to keep track of missing audio frames. This doesn't mean that the audio frame was not played, just that the length of time between audio put calls caused the buffer to empty by half of the average size of a frame. | |
| void | increment_audio_frames_played () |
| This should be called when an call to audio put has been called. | |
| void | increment_buffer_overflow () |
| This should be called when an overflow has occured. | |
| void | increment_buffer_underflow () |
| This should be called when an underflow has occured. | |
| void | increment_resample_high () |
| This should be called when a resample is requested that is higher than the original sample rate. | |
| void | increment_resample_low () |
| This should be called when a resample is requested that is lower than the original sample rate. | |
| void | mark_audio_time_end () |
| Mark the end of the put audio function. | |
| void | record_audio_time_diff () |
| This function should be called at the beginning of put audio to record the difference between calls. | |
| void | report () |
| This will detail out the longer running stats of the Decklink. It should be called on every audio frame but will only print out the report once every 30 seconds. | |
| void | set_buffer_average (double buffer_average) |
| Set the buffer average object. | |
Private Attributes | |
| long long | audio_time_diff_max = 0 |
| long long | audio_time_diff_min = std::numeric_limits<long long>().max() |
| MovingAverage | avg_added_frames {250} |
| uint32_t | buffer_average = 0 |
| uint32_t | buffer_overflow = 0 |
| uint32_t | buffer_underflow = 0 |
| uint32_t | frames_missed = 0 |
| uint32_t | frames_played = 0 |
| std::chrono::steady_clock::time_point | last_summary = std::chrono::steady_clock::now() |
| std::chrono::high_resolution_clock::time_point | prev_audio_end {} |
| int32_t | prev_buffer_samples = -1 |
| uint32_t | resample_high = 0 |
| uint32_t | resample_low = 0 |
Definition at line 139 of file decklink_drift_fix.hpp.
|
inline |
A quick way of roughly calculating if the buffer has emptied by the size of a single audio frame to keep track of missing audio frames. This doesn't mean that the audio frame was not played, just that the length of time between audio put calls caused the buffer to empty by half of the average size of a frame.
| buffer_samples | The amount of audio samples in the buffer. |
| samples | The amount of samples that will be written to the buffer. |
Definition at line 233 of file decklink_drift_fix.hpp.
References MovingAverage::add(), MovingAverage::avg(), avg_added_frames, MovingAverage::filled(), frames_missed, and prev_buffer_samples.
Referenced by AudioDriftFixer::update().

|
inline |
This should be called when an call to audio put has been called.
Definition at line 211 of file decklink_drift_fix.hpp.
References frames_played.
Referenced by AudioDriftFixer::update().
|
inline |
This should be called when an overflow has occured.
Definition at line 197 of file decklink_drift_fix.hpp.
References buffer_overflow.
Referenced by AudioDriftFixer::update().
|
inline |
This should be called when an underflow has occured.
Definition at line 204 of file decklink_drift_fix.hpp.
References buffer_underflow.
Referenced by AudioDriftFixer::update().
|
inline |
This should be called when a resample is requested that is higher than the original sample rate.
Definition at line 190 of file decklink_drift_fix.hpp.
References resample_high.
Referenced by AudioDriftFixer::update().
|
inline |
This should be called when a resample is requested that is lower than the original sample rate.
Definition at line 182 of file decklink_drift_fix.hpp.
References resample_low.
Referenced by AudioDriftFixer::update().
|
inline |
Mark the end of the put audio function.
Definition at line 273 of file decklink_drift_fix.hpp.
References prev_audio_end.
Referenced by AudioDriftFixer::update().
|
inline |
This function should be called at the beginning of put audio to record the difference between calls.
Definition at line 251 of file decklink_drift_fix.hpp.
References audio_time_diff_max, audio_time_diff_min, and prev_audio_end.
Referenced by AudioDriftFixer::update().
|
inline |
This will detail out the longer running stats of the Decklink. It should be called on every audio frame but will only print out the report once every 30 seconds.
Definition at line 145 of file decklink_drift_fix.hpp.
References audio_time_diff_max, audio_time_diff_min, MovingAverage::avg(), avg_added_frames, buffer_average, buffer_overflow, buffer_underflow, count, frames_missed, frames_played, last_summary, LOG, LOG_LEVEL_INFO, resample_high, resample_low, SBOLD, and SUNDERLINE.
Referenced by AudioDriftFixer::update().

|
inline |
Set the buffer average object.
| buffer_average | The average samples in the buffer per channel |
Definition at line 220 of file decklink_drift_fix.hpp.
References buffer_average, and round().
Referenced by AudioDriftFixer::update().

|
private |
Definition at line 294 of file decklink_drift_fix.hpp.
Referenced by record_audio_time_diff(), and report().
|
private |
Definition at line 295 of file decklink_drift_fix.hpp.
Referenced by record_audio_time_diff(), and report().
|
private |
Definition at line 283 of file decklink_drift_fix.hpp.
Referenced by calculate_missing(), and report().
|
private |
Definition at line 291 of file decklink_drift_fix.hpp.
Referenced by report(), and set_buffer_average().
|
private |
Definition at line 286 of file decklink_drift_fix.hpp.
Referenced by increment_buffer_overflow(), and report().
|
private |
Definition at line 285 of file decklink_drift_fix.hpp.
Referenced by increment_buffer_underflow(), and report().
|
private |
Definition at line 282 of file decklink_drift_fix.hpp.
Referenced by calculate_missing(), and report().
|
private |
Definition at line 280 of file decklink_drift_fix.hpp.
Referenced by increment_audio_frames_played(), and report().
|
private |
Definition at line 298 of file decklink_drift_fix.hpp.
Referenced by report().
|
private |
Definition at line 293 of file decklink_drift_fix.hpp.
Referenced by mark_audio_time_end(), and record_audio_time_diff().
|
private |
Definition at line 278 of file decklink_drift_fix.hpp.
Referenced by calculate_missing().
|
private |
Definition at line 288 of file decklink_drift_fix.hpp.
Referenced by increment_resample_high(), and report().
|
private |
Definition at line 289 of file decklink_drift_fix.hpp.
Referenced by increment_resample_low(), and report().