[vlc-commits] OSS: select buffer timings
Rémi Denis-Courmont
git at videolan.org
Sun Apr 27 19:42:15 CEST 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 27 20:22:43 2014 +0300| [c1622c2c6e0e15a38fef723086ca8bf75a75b46b] | committer: Rémi Denis-Courmont
OSS: select buffer timings
This should fix stutter.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c1622c2c6e0e15a38fef723086ca8bf75a75b46b
---
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 e76f31a..4209416 100644
--- a/modules/audio_output/oss.c
+++ b/modules/audio_output/oss.c
@@ -214,6 +214,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