summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2018-10-15 11:59:01 +0200
committerLars-Dominik Braun <lars@6xq.net>2018-10-15 11:59:01 +0200
commit33eebc7479149fb1a31a8d458649aeddd77bc44b (patch)
tree0d2657b2c9ead062f343ee52ee1c0accdb8c758c
parentfb587856d3fb4fe5cbb4d24357030c023b425be9 (diff)
downloadpianobar-33eebc7479149fb1a31a8d458649aeddd77bc44b.tar.gz
pianobar-33eebc7479149fb1a31a8d458649aeddd77bc44b.tar.bz2
pianobar-33eebc7479149fb1a31a8d458649aeddd77bc44b.zip
Expose audio buffer size setting
See issue #672.
-rw-r--r--contrib/pianobar.14
-rw-r--r--src/player.c2
-rw-r--r--src/settings.c3
-rw-r--r--src/settings.h2
4 files changed, 9 insertions, 2 deletions
diff --git a/contrib/pianobar.1 b/contrib/pianobar.1
index b6c743a..7462030 100644
--- a/contrib/pianobar.1
+++ b/contrib/pianobar.1
@@ -209,6 +209,10 @@ option
.B route-nopull.
.TP
+.B buffer_seconds = 5
+Audio buffer size in seconds.
+
+.TP
.B ca_bundle = /etc/ssl/certs/ca-certificates.crt
Path to CA certifiate bundle, containing the root and intermediate certificates
required to validate Pandora's SSL certificate.
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 (" </3");
@@ -343,6 +344,8 @@ void BarSettingsRead (BarSettings_t *settings) {
settings->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;