Expose shared playback timing and stereo time stretch to Android

This commit is contained in:
evgeny committed 2026-10-13 23:03:29 +02:00
1 parent 541518db81
commit e6e276aed3
3 files changed
+114 -6

No files matched your search

+3 -3
View File
@@ -676,9 +676,6 @@ int stream_publish_open(struct UTUN_INSTANCE *inst, uint64_t group_id, const str
struct STREAM_HANDLE **out) {
int result = stream_open_check(inst, group_id, out);
if (result != STREAM_OK) return result;
struct stream_session *previous = session_find(inst->stream, group_id, inst->node_id);
if (previous && previous->source && previous->end_valid)
session_close(previous, STREAM_CLOSE_SOURCE_CHANGED, 0, 1);
struct stream_descriptor d = {.group_id = group_id, .source_node_id = inst->node_id,
.n = parameters ? parameters->n : STREAM_DEFAULT_N, .r = parameters ? parameters->r : STREAM_DEFAULT_R,
.block_size = parameters ? parameters->block_size : STREAM_RS_DEFAULT_SIZE};
@@ -688,6 +685,9 @@ int stream_publish_open(struct UTUN_INSTANCE *inst, uint64_t group_id, const str
}
} while (!d.source_epoch);
if (stream_descriptor_validate(&d) != STREAM_OK) return STREAM_ERR_ARGUMENT;
struct stream_session *previous = session_find(inst->stream, group_id, inst->node_id);
if (previous && previous->source && previous->end_valid)
session_close(previous, STREAM_CLOSE_SOURCE_CHANGED, 0, 1);
return session_open(inst, &d, inst->my_ed25519_pubkey, 1, 0, 0, out);
}
+2 -2
View File
@@ -16,8 +16,8 @@ void stream_playback_clock_reset(struct stream_playback_clock *c, uint64_t id) {
int stream_playback_clock_update(struct stream_playback_clock *c, int64_t now, int64_t position,
int64_t ready, int64_t guard, int64_t pending_gain,
int starved, struct stream_playback_state *state) {
if (!c || !state || now < 0 || position < 0 || ready < 0 || guard < 0 || guard > 1000000
|| pending_gain < 0 || pending_gain > 1000000 || (c->initialized && (now < c->last_us || position < c->last_position_us))) {
if (!c || !state || now < 0 || position < 0 || ready < 0 || guard < 0 || guard > 60000000
|| pending_gain < 0 || pending_gain > 60000000 || (c->initialized && (now < c->last_us || position < c->last_position_us))) {
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "playback clock invalid id=%llu now=%lld pts=%lld ready=%lld guard=%lld pending=%lld",
c ? (unsigned long long)c->id : 0, (long long)now, (long long)position, (long long)ready,
(long long)guard, (long long)pending_gain);