aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2016-04-20 23:50:38 +0200
committerMarton Balint <cus@passwd.hu>2016-05-07 17:18:26 +0200
commit215a2d76788feae6d43decb130bac03ef9adb7c5 (patch)
tree7c8f5809910cc2b17788514be2cdd95f5a22f0a7
parent1e109bbbf13324562b6186fb0ef758c9cef5cfd3 (diff)
downloadffmpeg-215a2d76788feae6d43decb130bac03ef9adb7c5.tar.gz
ffplay: force setting alsa buffer size
Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r--ffplay.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ffplay.c b/ffplay.c
index 804bcbc33f..d5fcde8e48 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -3781,6 +3781,7 @@ int main(int argc, char **argv)
int flags;
VideoState *is;
char dummy_videodriver[] = "SDL_VIDEODRIVER=dummy";
+ char alsa_bufsize[] = "SDL_AUDIO_ALSA_SET_BUFFER_SIZE=1";
av_log_set_flags(AV_LOG_SKIP_REPEATED);
parse_loglevel(argc, argv, options);
@@ -3818,6 +3819,12 @@ int main(int argc, char **argv)
flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
if (audio_disable)
flags &= ~SDL_INIT_AUDIO;
+ else {
+ /* Try to work around an occasional ALSA buffer underflow issue when the
+ * period size is NPOT due to ALSA resampling by forcing the buffer size. */
+ if (!SDL_getenv("SDL_AUDIO_ALSA_SET_BUFFER_SIZE"))
+ SDL_putenv(alsa_bufsize);
+ }
if (display_disable)
SDL_putenv(dummy_videodriver); /* For the event queue, we always need a video driver. */
#if !defined(_WIN32) && !defined(__APPLE__)