From 33eebc7479149fb1a31a8d458649aeddd77bc44b Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Mon, 15 Oct 2018 11:59:01 +0200 Subject: Expose audio buffer size setting See issue #672. --- src/player.c | 2 +- src/settings.c | 3 +++ src/settings.h | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/player.c b/src/player.c index 16f5553..952ff18 100644 --- a/src/player.c +++ b/src/player.c @@ -367,6 +367,7 @@ BarPlayerMode BarPlayerGetMode (player_t * const player) { */ static int play (player_t * const player) { assert (player != NULL); + const int64_t minBufferHealth = player->settings->bufferSecs; AVPacket pkt; AVCodecContext * const cctx = player->cctx; @@ -434,7 +435,6 @@ static int play (player_t * const player) { pthread_mutex_unlock (&player->aoplayLock); int64_t bufferHealth = 0; - const int64_t minBufferHealth = 4; /* in seconds */ do { pthread_mutex_lock (&player->aoplayLock); bufferHealth = av_q2d (player->st->time_base) * diff --git a/src/settings.c b/src/settings.c index 72553e3..4ee1bd6 100644 --- a/src/settings.c +++ b/src/settings.c @@ -165,6 +165,7 @@ void BarSettingsRead (BarSettings_t *settings) { settings->gainMul = 1.0; /* should be > 4, otherwise expired audio urls (403) can stop playback */ settings->maxRetry = 5; + settings->bufferSecs = 5; settings->sortOrder = BAR_SORT_NAME_AZ; settings->loveIcon = strdup (" <3"); settings->banIcon = strdup (" maxRetry = atoi (val); } else if (streq ("timeout", key)) { settings->timeout = atoi (val); + } else if (streq ("buffer_seconds", key)) { + settings->bufferSecs = atoi (val); } else if (streq ("sort", key)) { size_t i; static const char *mapping[] = {"name_az", diff --git a/src/settings.h b/src/settings.h index 9b74602..709a56f 100644 --- a/src/settings.h +++ b/src/settings.h @@ -84,7 +84,7 @@ typedef struct { typedef struct { bool autoselect; - unsigned int history, maxRetry, timeout; + unsigned int history, maxRetry, timeout, bufferSecs; int volume; float gainMul; BarStationSorting_t sortOrder; -- cgit v1.2.3