[vlc-commits] OSS: select buffer timings

Rémi Denis-Courmont git at videolan.org
Sun Aug 17 17:12:16 CEST 2014


vlc/vlc-2.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 27 20:22:43 2014 +0300| [3a7dba820f82879cea9504d08a2b22ad6897687b] | committer: Rémi Denis-Courmont

OSS: select buffer timings

This should fix stutter.

(cherry picked from commit c1622c2c6e0e15a38fef723086ca8bf75a75b46b)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=3a7dba820f82879cea9504d08a2b22ad6897687b
---

 modules/audio_output/oss.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c
index 1009eed..21e0b7c 100644
--- a/modules/audio_output/oss.c
+++ b/modules/audio_output/oss.c
@@ -209,6 +209,22 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     }
     aout_FormatPrepare (fmt);
 
+    /* Select timing */
+    unsigned bytes;
+    if (spdif)
+        bytes = AOUT_SPDIF_SIZE;
+    else
+        bytes = fmt->i_rate / (CLOCK_FREQ / AOUT_MIN_PREPARE_TIME)
+                * fmt->i_bytes_per_frame;
+    if (unlikely(bytes < 16))
+        bytes = 16;
+
+    int frag = (AOUT_MAX_ADVANCE_TIME / AOUT_MIN_PREPARE_TIME) << 16
+             | (32 - clz32(bytes - 1));
+    if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &frag) < 0)
+        msg_Err (aout, "cannot set 0x%08x fragment: %s", frag,
+                 vlc_strerror_c(errno));
+
     sys->fd = fd;
     VolumeSync (aout);
     sys->starting = true;



More information about the vlc-commits mailing list