Add nonblocking jitter clock reads for video scheduling
This commit is contained in:
1 parent
193a549d47
commit
562bdf54a6
2 files changed
+8
No files matched your search
@@ -226,6 +226,12 @@ void call_jitter_clock(struct call_jitter* j, int64_t now_us, struct call_clock_
|
||||
*out = j->timeline.clock(now_us);
|
||||
}
|
||||
|
||||
int call_jitter_try_clock(struct call_jitter* j, int64_t now_us, struct call_clock_snapshot* out) {
|
||||
std::unique_lock<std::mutex> lock(j->mtx, std::try_to_lock);
|
||||
if (!lock.owns_lock()) return 0;
|
||||
*out = j->timeline.clock(now_us); return 1;
|
||||
}
|
||||
|
||||
void call_jitter_reset(struct call_jitter* j) {
|
||||
if (!j) return;
|
||||
std::lock_guard<std::mutex> lock(j->mtx);
|
||||
|
||||
@@ -46,6 +46,8 @@ void call_jitter_progress(struct call_jitter* j, uint64_t epoch, uint64_t positi
|
||||
void call_jitter_suspend_device(struct call_jitter* j, uint64_t epoch);
|
||||
/* Любой поток: снимок часов, включая epoch при valid=0. */
|
||||
void call_jitter_clock(struct call_jitter* j, int64_t now_us, struct call_clock_snapshot* out);
|
||||
/* Неблокирующее чтение: 1 — снимок получен, 0 — mutex занят. Аргументы должны быть валидны. */
|
||||
int call_jitter_try_clock(struct call_jitter* j, int64_t now_us, struct call_clock_snapshot* out);
|
||||
void call_jitter_get_stats(struct call_jitter* j, int* depth_ms, int* tempo_x100,
|
||||
uint32_t* dropped, uint32_t* underruns, struct call_jitter_range* range);
|
||||
|
||||
|
||||
Reference in new issue
Block a user