VirtualBox

Changeset 65014 in vbox


Ignore:
Timestamp:
Dec 27, 2016 12:08:21 PM (8 years ago)
Author:
vboxsync
Message:

Audio/DevIchAc97.cpp: Try to fix the test box hangs.

File:
1 edited

Legend:

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

    r65005 r65014  
    836836{
    837837    RT_NOREF(pThis);
     838    AssertPtrReturn(pDstStream,  VERR_INVALID_POINTER);
     839    AssertPtrReturn(pSrcMixSink, VERR_INVALID_POINTER);
     840    AssertReturn(cbToWrite,      VERR_INVALID_PARAMETER);
     841    /* pcbWritten is optional. */
    838842
    839843    PRTCIRCBUF pCircBuf = pDstStream->State.pCircBuf;
     
    883887{
    884888    RT_NOREF(pThis);
     889    AssertPtrReturn(pSrcStream,  VERR_INVALID_POINTER);
     890    AssertPtrReturn(pDstMixSink, VERR_INVALID_POINTER);
     891    AssertReturn(cbToRead,       VERR_INVALID_PARAMETER);
     892    /* pcbRead is optional. */
    885893
    886894    PRTCIRCBUF pCircBuf = pSrcStream->State.pCircBuf;
     
    11151123    PAC97STREAMSTATEAIO pAIO = &pStream->State.AIO;
    11161124
     1125    if (!ASMAtomicReadBool(&pAIO->fStarted))
     1126        return;
     1127
    11171128    int rc2 = RTCritSectEnter(&pAIO->CritSect);
    11181129    AssertRC(rc2);
     
    11271138{
    11281139    PAC97STREAMSTATEAIO pAIO = &pStream->State.AIO;
     1140
     1141    if (!ASMAtomicReadBool(&pAIO->fStarted))
     1142        return;
    11291143
    11301144    int rc2 = RTCritSectLeave(&pAIO->CritSect);
     
    11761190            STAM_PROFILE_START(&pThis->StatOut, a);
    11771191
     1192            /*
     1193             * Read from DMA.
     1194             */
     1195
    11781196            void *pvDst;
    11791197            size_t cbDst;
     
    11901208            RTCircBufReleaseWriteBlock(pCircBuf, cbProcessed);
    11911209
    1192             if (cbProcessed)
     1210            /*
     1211             * Process backends.
     1212             */
     1213
     1214            /* Do we have data left to write to the backends? */
     1215            uint32_t cbUsed = (uint32_t)RTCircBufUsed(pCircBuf);
     1216            if (cbUsed)
    11931217            {
    11941218#ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     
    11961220                ichac97StreamAsyncIONotify(pThis, pStream);
    11971221#else
     1222                /* Read audio data from the AC'97 stream and write to the backends. */
    11981223                rc2 = ichac97StreamRead(pThis, pStream, pMixSink, cbProcessed, NULL /* pcbRead */);
    11991224                AssertRC(rc2);
     
    12011226            }
    12021227
     1228            /* All DMA transfers done for now? */
    12031229            if (   !cbProcessed
    12041230#ifndef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     1231            /* All data read *and* processed for now? */
    12051232                && RTCircBufUsed(pCircBuf) == 0
    12061233#endif
     
    12101237            }
    12111238
     1239#ifndef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     1240            rc2 = AudioMixerSinkUpdate(pMixSink);
     1241            AssertRC(rc2);
     1242#endif
    12121243            STAM_PROFILE_STOP(&pThis->StatOut, a);
    12131244        }
     
    12171248            STAM_PROFILE_START(&pThis->StatIn, a);
    12181249
     1250            /*
     1251             * Process backends.
     1252             */
     1253
     1254#ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     1255            /* Let the asynchronous thread know that there is some new data to process. */
     1256            ichac97StreamAsyncIONotify(pThis, pStream);
     1257#else
     1258            rc2 = AudioMixerSinkUpdate(pMixSink);
     1259            AssertRC(rc2);
     1260
     1261            /* Write read data from the backend to the AC'97 stream. */
     1262            rc2 = ichac97StreamWrite(pThis, pStream, pMixSink, 256 /** @todo Fix this! */, NULL /* pcbWritten */);
     1263            AssertRC(rc2);
     1264#endif
     1265            /*
     1266             * Write to DMA.
     1267             */
     1268
    12191269            void *pvSrc;
    12201270            size_t cbSrc;
    12211271
    1222             RTCircBufAcquireReadBlock(pCircBuf, 256 /** @todo */, &pvSrc, &cbSrc);
     1272            RTCircBufAcquireReadBlock(pCircBuf, 256 /** @todo Fix this! */, &pvSrc, &cbSrc);
    12231273
    12241274            if (cbSrc)
     
    12311281            RTCircBufReleaseReadBlock(pCircBuf, cbProcessed);
    12321282
    1233             if (cbProcessed)
    1234             {
    1235 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    1236                 /* Let the asynchronous thread know that there is some new data to process. */
    1237                 ichac97StreamAsyncIONotify(pThis, pStream);
    1238 #else
    1239                 rc2 = ichac97StreamWrite(pThis, pStream, pMixSink, cbProcessed, NULL /* pcbWritten */);
    1240                 AssertRC(rc2);
    1241 #endif
    1242             }
    1243 
    1244             /** @todo: Check this! */
    1245             if (   !cbProcessed
    1246 #ifndef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    1247                 && RTCircBufUsed(pCircBuf) == 0
    1248 #endif
    1249                )
    1250             {
     1283            /* All DMA transfers done for now? */
     1284            if (!cbProcessed)
    12511285                fDone = true;
    1252             }
    12531286
    12541287            STAM_PROFILE_STOP(&pThis->StatIn, a);
     
    12571290            AssertFailed();
    12581291
    1259 #ifndef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    1260         rc2 = AudioMixerSinkUpdate(pMixSink);
    1261         AssertRC(rc2);
    1262 #endif
    12631292        if (fDone)
    12641293            break;
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