void CAudioOutLinuxAlsa::HandleSuspend(void) const
{
    int err = 0;

    do
    {
        err = snd_pcm_resume(m_pAlsaPCMHandle);
        if (err == 0)
        {
            break;
        }
        else if (err == -EAGAIN)
        {
            usleep(1000);
        }
    } while (err == -EAGAIN);
+    if (err == 0)
+    {
+        err = snd_pcm_prepare (m_pAlsaPCMHandle);
+        if (err < 0)
+        {
+            HXLOGL1 ( HXLOG_ADEV, "snd_pcm_prepare: %s",
+                      snd_strerror(err));
+        }
+    }
+

    if (err < 0)
    {
        HandleXRun();
    }
}


I think it would be cleaner if you stuck that new code
in the while loop just before the break; I think
the whole thing could be written something like below.


void CAudioOutLinuxAlsa::HandleSuspend(void) const
{
    int err = 0;
    do
    {
        err = snd_pcm_resume(m_pAlsaPCMHandle);
        if (err == 0)
        {
            err = snd_pcm_prepare (m_pAlsaPCMHandle);
            break;
        }
        else if (err == -EAGAIN)
        {
            usleep(1000);
        }
    } while (err == -EAGAIN);

    if (err < 0)
    {
HXLOGL1 ( HXLOG_ADEV, "snd_pcm_prepare: %s", snd_strerror (err));
        HandleXRun();
    }
}

If we could move the usleep up then you could get rid
of that 'else if' block too. Don't know if that works
for the suspend case though, so test it if you want.


void CAudioOutLinuxAlsa::HandleSuspend(void) const
{
    int err = 0;
    do
    {
        usleep(1000);
        err = snd_pcm_resume(m_pAlsaPCMHandle);
        if (err == 0)
        {
            err = snd_pcm_prepare (m_pAlsaPCMHandle);
            break;
        }
    } while (err == -EAGAIN);

    if (err < 0)
    {
HXLOGL1 ( HXLOG_ADEV, "snd_pcm_prepare: %s", snd_strerror (err));
        HandleXRun();
    }
}

--greg.


On Jun 18, 2009, at 4:44 AM, Varun Kathuria wrote:

Project: RealPlayer For Netbook

Synopsis:
Changes to fix Bug 9324:Real Player is in 'Not Responding" state after suspend/resume while playing any movie on FC10 platform.

Overview:
When we play any file on realplayer for netbook in Fedora 10 & suspend the system. When we resume it, we are not able to hear audio, only video can be seen. This is because when system goes to suspend state then audio device gives 'ESTRPIPE' signal while writing the data to the device. And when we resume the system, sometimes we need to wake up the audio device by using snd_pcm_prepare() to play the audio.

Files Added:
None

Files Modified:
/cvsroot/audio/device/platform/unix/audlinux_alsa.cpp

Image Size and Heap Use impact (Client -Only):
None.

Platforms and Profiles Affected:
None

Distribution Libraries Affected:
None

Distribution library impact and planned action:
None

Branch
atlas310, atlas347 & atlas349

Platforms and Profiles Build Verified:
BIF branch -> hxclient_3_1_0_atlas_restricted
Target(s)  -> player_all
Profile    -> helix-client-moblin
SYSTEM_ID  -> linux-2.2-libc6-gcc32-i586

Files Attached:
diff_9312.txt

Thanks & Regards,
Varun Kathuria

<diff_9324.txt>_______________________________________________
Audio-dev mailing list
Audio-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/audio-dev


_______________________________________________
Audio-dev mailing list
Audio-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/audio-dev

Reply via email to