[MPlayer-dev-eng] [patch] audio too high on saa7134

Josef Zlomek josef.zlomek at email.cz
Sun Jan 11 10:41:47 CET 2004


Hello,

I have a problem with mencoder 1.0pre3 and saa7134 using oss.
When recording from tv, the audio is too high (too fast).
I discovered using program "record" that the samplerate of audio is 32000 Hz
but mencoder detects 44100 Hz. The result is that the audio is too high.
I analyzed it further and found a bug in mencoder.
The problem is that when we are setting the samplerate kernel returns
a value different to value we wanted.

I used:
insmod saa7134 oss=1
mencoder -v -tv driver=v4l2:freq=511.5:adevice=/dev/dsp1 tv:// -oac lavc -ovc lavc -o test.avi

The following patch fixes the bug for me.

--- libmpdemux.old/ai_oss.c	2003-08-07 14:24:35.000000000 +0200
+++ libmpdemux/ai_oss.c	2004-01-11 10:39:34.000000000 +0100
@@ -27,7 +27,7 @@ int ai_oss_set_samplerate(audio_in_t *ai
 {
     int tmp = ai->req_samplerate;
     if (ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &tmp) == -1) return -1;
-    ai->samplerate = ai->req_samplerate;
+    ai->samplerate = tmp;
     return 0;
 }

Josef




More information about the MPlayer-dev-eng mailing list