VirtualBox

Changeset 67505 in vbox


Ignore:
Timestamp:
Jun 20, 2017 1:31:15 PM (8 years ago)
Author:
vboxsync
Message:

Audio/DevHDA.cpp: Fixes for hdaStreamUpdate().

File:
1 edited

Legend:

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

    r67504 r67505  
    54815481    if (hdaGetDirFromSD(pStream->u8SD) == PDMAUDIODIR_OUT) /* Output (SDO). */
    54825482    {
    5483         /* Is the sink ready to be written (guest output data) to? If so, by how much? */
    5484         const uint32_t cbWritable = AudioMixerSinkGetWritable(pSink);
     5483        /* Is the HDA stream ready to be written (guest output data) to? If so, by how much? */
     5484        const uint32_t cbFree = hdaStreamGetFree(pStream);
    54855485
    54865486        if (   fInTimer
    5487             && cbWritable)
    5488         {
    5489             Log3Func(("[SD%RU8] cbWritable=%RU32\n", pStream->u8SD, cbWritable));
    5490 
    5491             /* When running synchronously, do the DMA data transfers here.
    5492              * Otherwise this will be done in the device timer. */
    5493             rc2 = hdaStreamTransfer(pThis, pStream, cbWritable);
     5487            && cbFree)
     5488        {
     5489            Log3Func(("[SD%RU8] cbFree=%RU32\n", pStream->u8SD, cbFree));
     5490
     5491            /* Do the DMA transfer. */
     5492            rc2 = hdaStreamTransfer(pThis, pStream, cbFree);
    54945493            AssertRC(rc2);
     5494        }
     5495
     5496        /* How much (guest output) data is available at the moment for the HDA stream? */
     5497        uint32_t cbUsed = hdaStreamGetUsed(pStream);
    54955498
    54965499#ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
     5500        if (   fInTimer
     5501            && cbUsed)
     5502        {
    54975503            rc2 = hdaStreamAsyncIONotify(pThis, pStream);
    54985504            AssertRC(rc2);
    5499 #endif
    5500         }
    5501 
    5502 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    5503         if (!fInTimer)
    5504         {
    5505 #endif
    5506             /* How much (guest output) data is available at the moment? */
    5507             uint32_t cbAvailable = hdaStreamGetUsed(pStream);
     5505        }
     5506        else
     5507        {
     5508#endif
     5509            const uint32_t cbSinkWritable = AudioMixerSinkGetWritable(pSink);
    55085510
    55095511            /* Do not write more than the sink can hold at the moment.
    55105512             * The host sets the overall pace. */
    5511             if (cbAvailable > cbWritable)
    5512                 cbAvailable = cbWritable;
    5513 
    5514             if (cbAvailable)
     5513            if (cbUsed > cbSinkWritable)
     5514                cbUsed = cbSinkWritable;
     5515
     5516            if (cbUsed)
    55155517            {
    55165518                /* Read (guest output) data and write it to the stream's sink. */
    5517                 rc2 = hdaStreamRead(pThis, pStream, cbAvailable, NULL /* pcbRead */);
     5519                rc2 = hdaStreamRead(pThis, pStream, cbUsed, NULL /* pcbRead */);
    55185520                AssertRC(rc2);
    55195521            }
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