VirtualBox

Changeset 65596 in vbox for trunk


Ignore:
Timestamp:
Feb 3, 2017 10:55:10 AM (8 years ago)
Author:
vboxsync
Message:

Main/DrvAudioVRDE.cpp: Try to fix crashes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r65586 r65596  
    281281     */
    282282    uint32_t cbWritten = 0;
    283 
    284283    while (cbToWrite)
    285284    {
    286         uint32_t cbChunk = cbToWrite; /** @todo For now write all at once. */
    287 
    288         pDrv->pConsoleVRDPServer->SendAudioSamples((uint8_t *)pvBuf + cbWritten, cbChunk, format);
    289 
     285        /* Make sure that this is even, as we send the number of samples to the VRDP server. */
     286        uint32_t cbChunk = (cbToWrite % 2 == 0) ? cbToWrite : cbToWrite - 1; /** @todo For now write all at once. */
     287        Assert(cbChunk % 2 == 0);
     288
     289        if (!cbChunk) /* Nothing to send. Bail out. */
     290            break;
     291
     292        pDrv->pConsoleVRDPServer->SendAudioSamples((uint8_t *)pvBuf + cbWritten,
     293                                                   PDMAUDIOPCMPROPS_B2S(&pStreamVRDE->Props, cbChunk) /* Samples */, format);
    290294        cbWritten += cbChunk;
    291295        Assert(cbWritten <= cbBuf);
     
    297301    if (RT_SUCCESS(rc))
    298302    {
    299         /*
    300          * Always report back all samples acquired, regardless of whether the
    301          * VRDP server actually did process those.
    302          */
     303        Assert(cbWritten % 2 == 0); /* Paranoia. */
     304
    303305        if (pcbWritten)
    304             *pcbWritten = cbToWrite;
     306            *pcbWritten = cbWritten;
    305307    }
    306308
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