VirtualBox

Changeset 89449 in vbox


Ignore:
Timestamp:
Jun 1, 2021 11:37:30 PM (3 years ago)
Author:
vboxsync
Message:

DrvHostAudioAlsa: Need to call snd_pcm_drain again when draining in non-blocking mode, otherwise we won't get out of it. Using the status getter for that, as it'll yield quicker results for the caller than the play function. Removed the channel count restrictions. bugref:9890

File:
1 edited

Legend:

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

    r89258 r89449  
    501501    AssertLogRelMsgReturn(err >= 0, ("ALSA: Failed to get start threshold: %s\n", snd_strerror(err)), err);
    502502
    503     LogRel2(("ALSA: SW params: %ul frames threshold, %ul frame avail minimum\n",
     503    LogRel2(("ALSA: SW params: %lu frames threshold, %lu frame avail minimum\n",
    504504             pCfgObt->threshold, pCfgReq->period_size));
    505505    return 0;
     
    548548    err = snd_pcm_hw_params_set_channels_near(hPCM, pHWParms, &cChannels);
    549549    AssertLogRelMsgReturn(err >= 0, ("ALSA: Failed to set number of channels to %d\n", pCfgReq->cChannels), err);
    550     AssertLogRelMsgReturn(cChannels == 1 || cChannels == 2, ("ALSA: Number of audio channels (%u) not supported\n", cChannels), -1);
    551550    pCfgObt->cChannels = cChannels;
    552551
     
    11291128    PDMHOSTAUDIOSTREAMSTATE enmStreamState = PDMHOSTAUDIOSTREAMSTATE_OKAY;
    11301129    snd_pcm_state_t         enmAlsaState   = snd_pcm_state(pStreamALSA->hPCM);
     1130    if (enmAlsaState == SND_PCM_STATE_DRAINING)
     1131    {
     1132        /* We're operating in non-blocking mode, so we must (at least for a demux
     1133           config) call snd_pcm_drain again to drive it forward.  Otherwise we
     1134           might be stuck in the drain state forever. */
     1135        Log5Func(("Calling snd_pcm_drain again...\n"));
     1136        snd_pcm_drain(pStreamALSA->hPCM);
     1137        enmAlsaState = snd_pcm_state(pStreamALSA->hPCM);
     1138    }
     1139
    11311140    if (enmAlsaState == SND_PCM_STATE_DRAINING)
    11321141        enmStreamState = PDMHOSTAUDIOSTREAMSTATE_DRAINING;
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