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);
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__)