VirtualBox

Changeset 89473 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 2, 2021 9:14:58 PM (4 years ago)
Author:
vboxsync
Message:

DrvHostAudioAlsa.cpp: Shut up annoying -EPIPE LogRel when draining. bugref:9890

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostAudioAlsa.cpp

    r89471 r89473  
    837837        case SND_PCM_STATE_PREPARED: /* not yet started */
    838838        {
    839 #if 0       /** @todo r=bird: You want EMT to block here for potentially 200-300ms worth
    840              *        of buffer to be drained?  That's a certifiably bad idea.  */
    841             int rc2 = snd_pcm_nonblock(pStreamALSA->hPCM, 0);
    842             AssertMsg(rc2 >= 0, ("snd_pcm_nonblock(, 0) -> %d\n", rc2));
    843 #endif
     839            /* Do not change to blocking here! */
    844840            rc = snd_pcm_drain(pStreamALSA->hPCM);
    845841            if (rc >= 0 || rc == -EAGAIN)
     
    847843            else
    848844            {
    849                 LogRel(("ALSA: Error draining output of '%s': %s (%d)\n", pStreamALSA->Cfg.szName, snd_strerror(rc), rc));
    850                 rc = RTErrConvertFromErrno(-rc);
     845                snd_pcm_state_t const enmState2 = snd_pcm_state(pStreamALSA->hPCM);
     846                if (rc == -EPIPE && enmState2 == enmState)
     847                {
     848                    /* Not entirely sure, but possibly an underrun, so just disable the stream. */
     849                    LogFunc(("snd_pcm_drain failed with -EPIPE, stopping stream (%s)\n", pStreamALSA->Cfg.szName));
     850                    rc = snd_pcm_drop(pStreamALSA->hPCM);
     851                    if (rc >= 0)
     852                        rc = VINF_SUCCESS;
     853                    else
     854                    {
     855                        LogRel(("ALSA: Error draining/stopping stream '%s': %s (%d)\n", pStreamALSA->Cfg.szName, snd_strerror(rc), rc));
     856                        rc = RTErrConvertFromErrno(-rc);
     857                    }
     858                }
     859                else
     860                {
     861                    LogRel(("ALSA: Error draining output of '%s': %s (%d; %s -> %s)\n", pStreamALSA->Cfg.szName, snd_strerror(rc),
     862                            rc, snd_pcm_state_name(enmState), snd_pcm_state_name(enmState2)));
     863                    rc = RTErrConvertFromErrno(-rc);
     864                }
    851865            }
    852 #if 0
    853             rc2 = snd_pcm_nonblock(pStreamALSA->hPCM, 1);
    854             AssertMsg(rc2 >= 0, ("snd_pcm_nonblock(, 1) -> %d\n", rc2));
    855 #endif
    856866            break;
    857867        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette