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

Public Member Functions | |
| void | enable () |
| double | get_buffer_avg () |
| Get the average sample count per channel. | |
| double | scale_buffer_delta (int delta) |
| This function will check the buffer delta and will return a delta in the sample rate that is required in order to offset the delta. This is scaled between the class members of min_hz and max_hz. The delta also has a max and min for the scaling which are defined by the min_buffer and the max_buffer. This ensures that very large deltas cannot cause large jumps in the resample rate that are audible (and that small deltas) do not create a resampling rate that is too small to have impact on the buffer. | |
| void | set_max_hz (uint32_t max_hz) |
| Set the max hz object. | |
| void | set_min_hz (uint32_t min_hz) |
| Set the min hz object. | |
| void | set_root (module *root) |
| Set the root object. | |
| void | set_target_buffer (uint32_t target_buffer) |
| Set the target buffer object. | |
| void | update (uint32_t buffered_count, uint32_t sample_frame_count, uint32_t sampleFramesWritten) |
Private Attributes | |
| DecklinkAudioSummary | audio_summary {} |
| MovingAverage | average_buffer_samples = 250 |
| MovingAverage | average_delta = 25 |
| long long | dst_frame_rate_set = 0 |
| bool | m_enabled = false |
| struct module * | m_root = nullptr |
| uint32_t | max_avg = 3650 |
| uint32_t | max_buffer = 600 |
| uint32_t | max_hz = MAX_RESAMPLE_DELTA_DEFAULT |
| uint32_t | min_avg = 1800 |
| uint32_t | min_buffer = 100 |
| uint32_t | min_hz = MIN_RESAMPLE_DELTA_DEFAULT |
| uint32_t | neg_jitter = 5 |
| uint32_t | pos_jitter = 5 |
| uint32_t | previous_buffer = 0 |
| uint32_t | target_buffer_fill = TARGET_BUFFER_DEFAULT |
Static Private Attributes | |
| static constexpr unsigned long | BASE = (1U<<8U) |
| static const uint32_t | NEG_JITTER_DEFAULT = 600 |
| static const uint32_t | POS_JITTER_DEFAULT = 600 |
Definition at line 308 of file decklink_drift_fix.hpp.
|
inline |
Definition at line 310 of file decklink_drift_fix.hpp.
References commandline_params, LOG, LOG_LEVEL_INFO, m_enabled, and MOD_NAME.
Referenced by settings_init().
|
inline |
Get the average sample count per channel.
Definition at line 358 of file decklink_drift_fix.hpp.
References average_buffer_samples, and MovingAverage::avg().
Referenced by update().

|
inline |
This function will check the buffer delta and will return a delta in the sample rate that is required in order to offset the delta. This is scaled between the class members of min_hz and max_hz. The delta also has a max and min for the scaling which are defined by the min_buffer and the max_buffer. This ensures that very large deltas cannot cause large jumps in the resample rate that are audible (and that small deltas) do not create a resampling rate that is too small to have impact on the buffer.
| delta | The delta between the average buffer size and the target buffer size to calculate a resample delta to offset the difference. |
Definition at line 375 of file decklink_drift_fix.hpp.
References abs(), max_buffer, max_hz, min_buffer, and min_hz.
Referenced by update().

|
inline |
Set the max hz object.
| max_hz | The maximum hz delta that can be applied to fix the drift |
Definition at line 322 of file decklink_drift_fix.hpp.
References max_hz.
Referenced by settings_init().
|
inline |
Set the min hz object.
| min_hz | The minimum hz delta that can be applied to fix the drift |
Definition at line 331 of file decklink_drift_fix.hpp.
References min_hz.
Referenced by settings_init().
|
inline |
Set the root object.
| root | The root module |
Definition at line 349 of file decklink_drift_fix.hpp.
References m_root.
Referenced by display_decklink_init().
|
inline |
Set the target buffer object.
| target_buffer | The target buffer of samples per channel |
Definition at line 340 of file decklink_drift_fix.hpp.
References target_buffer_fill.
Referenced by settings_init().
|
inline |
| flag | if the audio frame should be written |
Definition at line 389 of file decklink_drift_fix.hpp.
References abs(), MovingAverage::add(), ADEC_CH_RATE_SHIFT, audio_summary, average_buffer_samples, average_delta, MovingAverage::avg(), BASE, DecklinkAudioSummary::calculate_missing(), dst_frame_rate_set, MovingAverage::filled(), free_response(), get_buffer_avg(), DecklinkAudioSummary::increment_audio_frames_played(), DecklinkAudioSummary::increment_buffer_overflow(), DecklinkAudioSummary::increment_buffer_underflow(), DecklinkAudioSummary::increment_resample_high(), DecklinkAudioSummary::increment_resample_low(), LOG, LOG_LEVEL_DEBUG, LOG_LEVEL_WARNING, m_enabled, m_root, DecklinkAudioSummary::mark_audio_time_end(), MOD_NAME, MSG_UNIVERSAL_TAG_AUDIO_DECODER, neg_jitter, NEG_JITTER_DEFAULT, pos_jitter, POS_JITTER_DEFAULT, previous_buffer, DecklinkAudioSummary::record_audio_time_diff(), DecklinkAudioSummary::report(), response_get_status(), response_get_text(), RESPONSE_SUCCESSFUL, scale_buffer_delta(), SEND_MESSAGE_FLAG_NO_STORE, send_message_sync(), DecklinkAudioSummary::set_buffer_average(), and target_buffer_fill.
Referenced by display_decklink_put_audio_frame().

|
private |
|
private |
Definition at line 475 of file decklink_drift_fix.hpp.
Referenced by get_buffer_avg(), and update().
|
private |
Definition at line 476 of file decklink_drift_fix.hpp.
Referenced by update().
|
staticconstexprprivate |
Definition at line 472 of file decklink_drift_fix.hpp.
Referenced by update().
|
private |
Definition at line 501 of file decklink_drift_fix.hpp.
Referenced by update().
|
private |
Definition at line 470 of file decklink_drift_fix.hpp.
|
private |
Definition at line 473 of file decklink_drift_fix.hpp.
Referenced by set_root(), and update().
|
private |
Definition at line 492 of file decklink_drift_fix.hpp.
|
private |
Definition at line 486 of file decklink_drift_fix.hpp.
Referenced by scale_buffer_delta().
|
private |
Definition at line 483 of file decklink_drift_fix.hpp.
Referenced by scale_buffer_delta(), and set_max_hz().
|
private |
Definition at line 493 of file decklink_drift_fix.hpp.
|
private |
Definition at line 485 of file decklink_drift_fix.hpp.
Referenced by scale_buffer_delta().
|
private |
Definition at line 482 of file decklink_drift_fix.hpp.
Referenced by scale_buffer_delta(), and set_min_hz().
|
private |
Definition at line 489 of file decklink_drift_fix.hpp.
Referenced by update().
|
staticprivate |
Definition at line 499 of file decklink_drift_fix.hpp.
Referenced by update().
|
private |
Definition at line 488 of file decklink_drift_fix.hpp.
Referenced by update().
|
staticprivate |
Definition at line 498 of file decklink_drift_fix.hpp.
Referenced by update().
|
private |
Definition at line 479 of file decklink_drift_fix.hpp.
Referenced by update().
|
private |
Definition at line 478 of file decklink_drift_fix.hpp.
Referenced by set_target_buffer(), and update().