diff options
| author | 2026-04-13 17:01:47 -0400 | |
|---|---|---|
| committer | 2026-04-13 17:01:47 -0400 | |
| commit | 77b54c35bf9587450cd636e0d7df37e190e28bfb (patch) | |
| tree | a290efdd8b09066847199f3f52a32be70d24ef51 /src/liana | |
| parent | 20617b9c80cf8d8051ecdb53a2c22f68c012f21b (diff) | |
| download | camu-77b54c35bf9587450cd636e0d7df37e190e28bfb.tar.gz camu-77b54c35bf9587450cd636e0d7df37e190e28bfb.tar.bz2 camu-77b54c35bf9587450cd636e0d7df37e190e28bfb.zip | |
Smaller stuff that went uncommitted
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/liana')
| -rw-r--r-- | src/liana/list.c | 24 | ||||
| -rw-r--r-- | src/liana/list.h | 7 |
2 files changed, 21 insertions, 10 deletions
diff --git a/src/liana/list.c b/src/liana/list.c index cd073ad..d12caab 100644 --- a/src/liana/list.c +++ b/src/liana/list.c @@ -3,7 +3,7 @@ #include <al/log.h> #include <al/lib.h> #include <al/random.h> -#include <nnwt/thread.h> +#include <nnwt/time.h> #include "list.h" #include "list_cmp.h" @@ -355,8 +355,11 @@ static bool handle_skipto(struct lia_list *list, s32 sequence, s32 index) bool error; if (!entry_load_and_get_duration(list, target, index, &error)) { if (error) { - // On an error, sequence will address the same entry but index may not. - return handle_skipto(list, sequence, index); + // On an error, sequence will address the same entry but index might not. + // entry_load_and_get_duration() may also adjust the current cmd's sequence, + // so use cmd->sequence here. + struct lia_list_cmd *cmd = list->cmd; + return handle_skipto(list, cmd->sequence, index); } return false; } @@ -452,18 +455,25 @@ static void handle_toggle_pause(struct lia_list *list, s32 sequence, f64 pts) case LIANA_PAUSE_PAUSE: { al_assert(entry->start != LIANA_TIMESTAMP_INVALID); entry->paused_at = now + LIANA_PAUSE_DELAY; - // @TODO: There is no reason we couldn't pause during a pre-roll. if (entry->paused_at < entry->start) { entry->paused_at = entry->start; + // @TODO: Delay would need to apply to newly added sinks and skipto(). + //entry->delay = entry->start - entry->paused_at; + } else { + entry->offset += entry->paused_at - entry->start; } - entry->offset += entry->paused_at - entry->start; entry->start = LIANA_TIMESTAMP_INVALID; at = entry->paused_at; break; } case LIANA_PAUSE_RESUME: { al_assert(entry->start == LIANA_TIMESTAMP_INVALID); - entry->start = now + LIANA_PAUSE_DELAY; + if (entry->delay != LIANA_TIMESTAMP_INVALID) { + entry->start = now + MAX(entry->delay, LIANA_PAUSE_DELAY); + entry->delay = LIANA_TIMESTAMP_INVALID; + } else { + entry->start = now + LIANA_PAUSE_DELAY; + } entry->paused_at = LIANA_TIMESTAMP_INVALID; at = entry->start; break; @@ -813,6 +823,7 @@ void lia_list_add(struct lia_list *list, str *brief, void *opaque, u64 duration, entry->start = LIANA_TIMESTAMP_INVALID; entry->paused_at = LIANA_TIMESTAMP_INVALID; entry->offset = 0; + entry->delay = LIANA_TIMESTAMP_INVALID; entry->duration = duration; entry->load = load; entry->held = false; @@ -929,7 +940,6 @@ void lia_list_close(struct lia_list *list) void lia_list_free(struct lia_list *list) { - al_assert(list->closed); struct lia_list_cmd *cmd; al_array_foreach(list->command_queue, i, cmd) { al_free(cmd); diff --git a/src/liana/list.h b/src/liana/list.h index e8b1769..32715bd 100644 --- a/src/liana/list.h +++ b/src/liana/list.h @@ -8,10 +8,10 @@ #define LIANA_SEQUENCE_ANY -1 -#define LIANA_BASE_DELAY 1250000u // 1250ms -#define LIANA_BASE_PING 150000u // 150ms +#define LIANA_BASE_DELAY ((u64)2000000) // 2000ms +#define LIANA_BASE_PING ((u64)500000) // 500ms #define LIANA_PAUSE_DELAY LIANA_BASE_PING -#define LIANA_DELAY_IGNORE 0u +#define LIANA_DELAY_IGNORE ((u64)0) #define LIANA_BUFFER_AHEAD 2 @@ -79,6 +79,7 @@ struct lia_list_entry { u64 start; u64 paused_at; u64 offset; + u64 delay; u64 duration; u8 load; bool held; |