List Info

Thread: Help with ALSA Needed...




Help with ALSA Needed...
user name
2006-11-06 21:58:39
At 01:02 PM 11/5/2006, Tony Espy wrote:
>hi -
>
>i'm having problems getting splay to work with ASLA on
the Pepper Pad 3 ( 
>AMD Geode / FC4-based system ).  i had this working last
week, but did a 
>clean build on the cayenne_1_5_0 branch this weekend and
now i can't get 
>MP3 playback to work via ALSA.

Hi Tony,

If this is a Helix ALSA device-related problem, I'll work
with you to 
resolve it.

What is the version of your ALSA?
rpm -q --info alsa-lib


There were two check-ins 11 days ago to Helix ALSA device
code:
http://lists.helixcommunity.org/pipe
rmail/audio-dev/2006-October/000776.html
http://lists.helixcommunity.org/pipe
rmail/audio-dev/2006-October/000775.html

Could you do the following steps to trouble-shoot the
problem?

1. Check if your system's ALSA configuration is working:
speaker-test -c1 --device default
speaker-test -c2 --device default

speaker-test -c2 --device default --rate 48000
speaker-test -c2 --device default --rate 44100

2. A quick check if ALSA on your system is not set to
48000Hz Sampling Rate.
Change/Add the last line in this block to the relevant file
used by your 
player:
~/.helix/HelixSDK_1_0:
~/.helix/HelixSDK_10_0:
~/.realplayerrc:
~/.hxplayerrc:
AlsaVaryingSampleRate=1

Now, play a clip to check if this fixed the playback using
ALSA.

3. Reverse the two check-ins to verify that it indeed is the
checkins that 
is causing the problem:

cd audio/device
cvs -q update -D 2006-10-25 platform/unix/audlinux_alsa.cpp 
platform/unix/audlinux_oss.cpp platform/unix/audUnix.cpp 
pub/platform/unix/audlinux_alsa.h
pub/platform/unix/audlinux_oss.h 
pub/platform/unix/audUnix.h


Alternatively:
cvs -q update -r 1.4.6.2 platform/unix/audlinux_alsa.cpp
cvs -q update -r 1.10 platform/unix/audlinux_oss.cpp
cvs -q update -r 1.7 platform/unix/audUnix.cpp

cvs -q update -r 1.4 pub/platform/unix/audlinux_alsa.h
cvs -q update -r 1.5 pub/platform/unix/audlinux_oss.h
cvs -q update -r 1.4 pub/platform/unix/audUnix.h

Then, rebuild and test.

4. Check if one of the check in is causing the problem:

There is more than an hour gap between the two checkins. I'm
trying to find 
a "cvs update" command that will take both date
and time.



5. The most detail: It is possible that one of these diffs
is causing the 
problem, but we'll have to find out why:

 -499,7
+617,7 
      unsigned int sample_rate = 0;
      unsigned int channels = 0;
      unsigned int buffer_time = 500000;          /* 0.5
seconds */
-    unsigned int period_time = buffer_time / 4; /* 4
interrupts per buffer */
+    unsigned int period_time;                     /* To set
to 4 
interrupts per buffer */

      switch (pFormat->uBitsPerSample)
      {


 -624,20
+742,20 

      if (err == 0)
      {
-        unsigned int period_time_out;
-        period_time_out = period_time;
+        unsigned int period_time_out;   // Output parameter
(plus input).
+        period_time_out = period_time = buffer_time / 4 ;

          err =
snd_pcm_hw_params_set_period_time_near(m_pAlsaPCMHandle, 
hwparams, &period_time_out, 0);
          if (err < 0)
          {



 -715,18
+833,18 

      if (err == 0)
      {
-        err =
snd_pcm_sw_params_set_avail_min(m_pAlsaPCMHandle, swparams, 
period_size);
+        err =
snd_pcm_sw_params_set_avail_min(m_pAlsaPCMHandle, swparams, 
(snd_pcm_uframes_t)1);
          if (err < 0)
          {
              HXLOGL1 ( HXLOG_ADEV,
"snd_pcm_sw_params_set_avail_min: %s",
                        snd_strerror(err));


 -1025,21
+1256,50 
      int err = 0;
      snd_pcm_sframes_t frame_delay = 0;

+    // Check that it is not SND_PCM_STATE_XRUN.
+    snd_pcm_state_t state;
+    state = snd_pcm_state(m_pAlsaPCMHandle);
+
+    if(state == SND_PCM_STATE_XRUN)
+    {
+        HXLOGL1 ( HXLOG_ADEV, "XRUN in
GetBytesActuallyPlayedUsingDelay()");
+    }
+
+    // snd_pcm_sframes_t frame_ready;
+    // frame_ready =
snd_pcm_avail_update(m_pAlsaPCMHandle);
+    // HXLOGL4 ( HXLOG_ADEV, "snd_pcm_avail_update
frame_ready : %d", 
frame_ready);
+
      err = snd_pcm_delay (m_pAlsaPCMHandle,
&frame_delay);
+    // HXLOGL4 ( HXLOG_ADEV, "frame_delay  : %d",
frame_delay);
      if (err < 0)
      {
-        HXLOGL1 ( HXLOG_ADEV, "snd_pcm_status:
%s", 
snd_strerror(err));
+        HXLOGL1 ( HXLOG_ADEV, "snd_pcm_delay:
%s", snd_strerror(err));
+    }
+    else if (frame_delay < 0)
+    {
+        HXLOGL1 ( HXLOG_ADEV, "XRUN! frame_delay:
%d", frame_delay);
+        nBytesPlayed = m_ulTotalWritten;
+        retVal = HXR_OK; // Is this really OK?
      }
      else
      {
-        int bytes_delay;
+        UINT64 bytes_delay;
          bytes_delay = snd_pcm_frames_to_bytes
(m_pAlsaPCMHandle, 
frame_delay);
-
+        if (bytes_delay > m_ulTotalWritten)
+        {
+            // We have only written m_ulTotalWritten bytes,
but ALSA is 
telling us that we have a delay of bytes_delay!
+            HXLOGL4 ( HXLOG_ADEV, "WARNING: Bytes
Delay > Total Written! 
bytes_delay = %d, m_ulTotalWritten = %d", bytes_delay,
m_ulTotalWritten);
+            bytes_delay = m_ulTotalWritten; // Avoid a
negative result or 
a large unsigned number below.
+        }
+        else
+        {
+            HXLOGL3 ( HXLOG_ADEV,
"snd_pcm_frames_to_bytes bytes_delay = 
%d", bytes_delay);
+        }
          nBytesPlayed = m_ulTotalWritten - bytes_delay;
          retVal = HXR_OK;
      }

-//    HXLOGL4 ( HXLOG_ADEV, "nBytesPlayed: %llu,
m_ulTotalWritten: 
%llun", nBytesPlayed, m_ulTotalWritten);
+    HXLOGL4 ( HXLOG_ADEV, 
"GetBytesActuallyPlayedUsingDelay()  nBytesPlayed: 
%llu,   m_ulTotalWritten: %llu n", nBytesPlayed,
m_ulTotalWritten);

      return retVal;
  }


Thanks.
-- 
Daniel Yek

>i have HELIX_FEATURE_ALSA defined in my .pf file.
>
>when I run splay, no sound is output.
>
>i see the following ALSA related output when I run
splay:
>
>Opening ALSA PCM device default
>
>the "===Stream 0===" output shows NumChannels
and Channels both are set to 2.
>
>i've also confirmed via 'lsof' that splay has the
correct PCM device open 
>( /dev/snd/PCMC0D0p ).
>
>OSS output works just fine.
>
>any help would be much appreciated.
>
>thanks,
>/tony




_______________________________________________
Audio-dev mailing list
Audio-devhelixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/audio
-dev
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )