[FFmpeg-cvslog] ffplay: force setting alsa buffer size

Marton Balint git at videolan.org
Sat May 7 17:50:36 CEST 2016


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Wed Apr 20 23:50:38 2016 +0200| [215a2d76788feae6d43decb130bac03ef9adb7c5] | committer: Marton Balint

ffplay: force setting alsa buffer size

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=215a2d76788feae6d43decb130bac03ef9adb7c5
---

 ffplay.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ffplay.c b/ffplay.c
index 804bcbc..d5fcde8 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__)



More information about the ffmpeg-cvslog mailing list