Add channel switching delay so stream settles before switching

This commit is contained in:
markmental 2026-03-28 13:57:42 -04:00
commit ebe5b4bfcf
3 changed files with 10 additions and 1 deletions

View file

@ -12,7 +12,8 @@
#define GUIDE_BROWSE_STEP_MINUTES 30
#define GUIDE_BROWSE_MAX_AHEAD_MINUTES (12 * 60)
#define GUIDE_BROWSE_MAX_OFFSET_MINUTES (GUIDE_BROWSE_MAX_AHEAD_MINUTES - ((int) (TIMELINE_VISIBLE_SECONDS / 60.0) - 30))
#define CHANNEL_BANNER_DURATION_MS 3000
#define CHANNEL_BANNER_DURATION_MS 5000
#define CHANNEL_SWITCH_LOCK_DURATION_MS 7000
static void configure_runtime_environment(void) {
char runtime_dir[64];
@ -127,11 +128,18 @@ static int update_video_texture(App *app) {
static void tune_relative(App *app, int delta) {
int next_index;
Uint32 now;
if (app->channels.count == 0) {
return;
}
now = SDL_GetTicks();
if (now < app->channel_switch_lock_until) {
return;
}
app->channel_switch_lock_until = now + CHANNEL_SWITCH_LOCK_DURATION_MS;
next_index = app->player.current_index;
if (next_index < 0) {
next_index = 0;

View file

@ -25,6 +25,7 @@ typedef struct App {
int last_blackout_state;
Uint32 startup_handoff_until;
Uint32 channel_banner_until;
Uint32 channel_switch_lock_until;
time_t app_start_time;
Uint64 app_start_ticks;
int guide_time_offset_minutes;

BIN
src/app.o

Binary file not shown.