VirtualBox

Changeset 67909 in vbox


Ignore:
Timestamp:
Jul 11, 2017 2:38:55 PM (7 years ago)
Author:
vboxsync
Message:

Audio/DrvHostPulseAudio.cpp: Added additional check for writable size in drvHostPulseAudioStreamPlay().

File:
1 edited

Legend:

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

    r67576 r67909  
    889889        }
    890890
    891         size_t cbToWrite = RT_MIN(cbWriteable, cbBuf);
    892 
    893         uint32_t cbWritten;
    894         while (cbToWrite)
    895         {
    896             cbWritten = cbToWrite;
    897             if (pa_stream_write(pPAStream->pStream, (uint8_t *)pvBuf + cbWrittenTotal, cbWritten, NULL /* Cleanup callback */,
     891        size_t cbLeft = RT_MIN(cbWriteable, cbBuf);
     892
     893        while (cbLeft)
     894        {
     895            size_t cbToWrite = RT_MIN(cbLeft, pa_stream_writable_size(pPAStream->pStream));
     896            if (cbToWrite <= (size_t)0)
     897                break;
     898
     899            if (pa_stream_write(pPAStream->pStream, (uint8_t *)pvBuf + cbWrittenTotal, cbToWrite, NULL /* Cleanup callback */,
    898900                                0, PA_SEEK_RELATIVE) < 0)
    899901            {
     
    902904            }
    903905
    904             Assert(cbToWrite >= cbWritten);
    905             cbToWrite      -= cbWritten;
    906             cbWrittenTotal += cbWritten;
     906            Assert(cbLeft  >= cbToWrite);
     907            cbLeft         -= cbToWrite;
     908            cbWrittenTotal += cbToWrite;
    907909        }
    908910
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