Changeset 70881 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Feb 6, 2018 11:00:32 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120707
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r70878 r70881 1302 1302 if (cfToPlay) 1303 1303 { 1304 uint8_t auBuf[ _4K]; /** @todo Get rid of this here. */1304 uint8_t auBuf[256]; /** @todo Get rid of this here. */ 1305 1305 1306 1306 uint32_t cbLeft = AUDIOMIXBUF_F2B(&pHstStream->MixBuf, cfToPlay); … … 1311 1311 uint32_t cfRead = 0; 1312 1312 rc = AudioMixBufAcquireReadBlock(&pHstStream->MixBuf, auBuf, RT_MIN(cbChunk, cbLeft), &cfRead); 1313 if ( !cfRead 1314 || RT_FAILURE(rc)) 1315 { 1313 if (RT_FAILURE(rc)) 1316 1314 break; 1317 }1318 1315 1319 1316 uint32_t cbRead = AUDIOMIXBUF_F2B(&pHstStream->MixBuf, cfRead); 1320 1317 Assert(cbRead <= cbChunk); 1321 1318 1319 uint32_t cfPlayed = 0; 1322 1320 uint32_t cbPlayed = 0; 1323 1321 rc = pThis->pHostDrvAudio->pfnStreamPlay(pThis->pHostDrvAudio, pHstStream->pvBackend, 1324 1322 auBuf, cbRead, &cbPlayed); 1325 if ( RT_ FAILURE(rc)1326 || !cbPlayed)1323 if ( RT_SUCCESS(rc) 1324 && cbPlayed) 1327 1325 { 1326 if (pThis->Dbg.fEnabled) 1327 DrvAudioHlpFileWrite(pHstStream->Out.Dbg.pFilePlayNonInterleaved, auBuf, cbPlayed, 0 /* fFlags */); 1328 1329 if (cbRead != cbPlayed) 1330 LogRel2(("Audio: Host stream '%s' played wrong amount (%RU32 bytes read but played %RU32 (%RI32), writable was %RU32)\n", 1331 pHstStream->szName, cbRead, cbPlayed, cbRead - cbPlayed, cbWritable)); 1332 1333 cfPlayed = AUDIOMIXBUF_B2F(&pHstStream->MixBuf, cbPlayed); 1334 cfPlayedTotal += cfPlayed; 1335 1336 Assert(cbLeft >= cbPlayed); 1337 cbLeft -= cbPlayed; 1338 } 1339 1340 AudioMixBufReleaseReadBlock(&pHstStream->MixBuf, cfPlayed); 1341 1342 if (RT_FAILURE(rc)) 1328 1343 break; 1329 }1330 1331 if (pThis->Dbg.fEnabled)1332 DrvAudioHlpFileWrite(pHstStream->Out.Dbg.pFilePlayNonInterleaved, auBuf, cbPlayed, 0 /* fFlags */);1333 1334 AssertMsg(cbPlayed <= cbRead, ("Played more than available (%RU32 available but got %RU32)\n", cbRead, cbPlayed));1335 #if 0 /** @todo Also handle mono channels. Needs fixing */1336 AssertMsg(cbPlayed % 2 == 0,1337 ("Backend for stream '%s' returned uneven played bytes count (cfRead=%RU32, cbPlayed=%RU32)\n",1338 pHstStream->szName, cfRead, cbPlayed));*/1339 #endif1340 const uint32_t cfPlayed = AUDIOMIXBUF_B2F(&pHstStream->MixBuf, cbPlayed);1341 1342 cfPlayedTotal += cfPlayed;1343 Assert(cbLeft >= cbPlayed);1344 cbLeft -= cbPlayed;1345 1346 AudioMixBufReleaseReadBlock(&pHstStream->MixBuf, cfPlayed);1347 1344 } 1348 1345 }
Note:
See TracChangeset
for help on using the changeset viewer.