From bbbdd99fdaacfe0a3c9a1237fa0d086907c1286f Mon Sep 17 00:00:00 2001 From: edward-p Date: Sat, 15 Sep 2018 13:57:39 +0200 Subject: Implement audio buffering Prevent stuttering on low-power devices like Android phones by moving playback to its own thread and decoupling it from decoding through a reasonably sized buffer. Fixes #665. --- src/player.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/player.h') diff --git a/src/player.h b/src/player.h index e9482c4..3179785 100644 --- a/src/player.h +++ b/src/player.h @@ -51,9 +51,8 @@ typedef enum { typedef struct { /* public attributes protected by mutex */ - pthread_mutex_t lock; - pthread_cond_t cond; /* broadcast changes to doPause */ - + pthread_mutex_t lock, aoplayLock; + pthread_cond_t cond, aoplayCond; /* broadcast changes to doPause */ bool doQuit, doPause; /* measured in seconds */ @@ -86,6 +85,7 @@ typedef struct { enum {PLAYER_RET_OK = 0, PLAYER_RET_HARDFAIL = 1, PLAYER_RET_SOFTFAIL = 2}; void *BarPlayerThread (void *data); +void *BarAoPlayThread (void *data); void BarPlayerSetVolume (player_t * const player); void BarPlayerInit (player_t * const p, const BarSettings_t * const settings); void BarPlayerReset (player_t * const p); -- cgit v1.2.3