[mythtv] More nforce questions

Billy Macdonald whmac33 at comcast.net
Fri Dec 26 00:46:26 EST 2003


Drew Bernat wrote:

>On Thu, 25 Dec 2003, Billy Macdonald wrote:
>
>  
>
>>Drew, I was wondering if you were ever able to resolve this issue, I'm
>>having the same problem.
>>    
>>
>
>I wasn't able to figure out a solution and ended up giving up -- just 
>using analog out for Myth. 
>
>I've been meaning to give it another try with Myth 0.13 and ALSA 1.0pre 
>whatever.
>
>Drew
>
>  
>
Well I checked out the current cvs today and hacked the alsa functions a 
bit to handle any buffer overruns.  I basically looked at the mplayer, 
aplay and some alsa sine player source example online for some direction.

Attached is a patch against 12/25 cvs using alsa 1.0.0pre2 that allows 
non choppy playback on spdif and analog outs using the native alsa 
support.   It's the first patch I've ever done so be gentle :)

Billy


-------------- next part --------------
? mypatch.diff
Index: audiooutputalsa.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/audiooutputalsa.cpp,v
retrieving revision 1.2
diff -u -w -r1.2 audiooutputalsa.cpp
--- audiooutputalsa.cpp	17 Jun 2003 00:51:23 -0000	1.2
+++ audiooutputalsa.cpp	26 Dec 2003 05:14:26 -0000
@@ -229,10 +229,14 @@
         return;
     
 //    printf("Trying to write %d i frames to soundbuffer\n", frames);
+    while (frames > 0) {
     err = snd_pcm_mmap_writei(pcm_handle, buffer, frames);
-    if (err == -EAGAIN || (err >= 0 && err != frames))
-        printf("Audio buffer overflow, audio data lost!\n");
-    else if (err < 0) {
+        if (err >= 0) {
+            buffer += err * audio_bytes_per_sample;
+            frames -= err;
+        } else if (err == -EAGAIN) {
+            snd_pcm_wait(pcm_handle, 10);
+	} else if (err < 0) {
         if (xrun_recovery(pcm_handle, err) < 0) {
             printf("Write error: %s\n", snd_strerror(err));
             printf("Disabling sound output.\n");
@@ -241,6 +245,7 @@
         }
         goto retry;
     }
+    }
     
     if(timecode < 0) 
         timecode = audbuf_timecode; // add to current timecode



More information about the mythtv-dev mailing list