Changeset 65660 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Feb 7, 2017 1:53:14 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 113352
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r65627 r65660 599 599 PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfgHost, PPDMAUDIOSTREAMCFG pCfgGuest) 600 600 { 601 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 602 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 601 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 602 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 603 AssertPtrReturn(pCfgHost, VERR_INVALID_POINTER); 604 AssertPtrReturn(pCfgGuest, VERR_INVALID_POINTER); 603 605 604 606 PPDMAUDIOSTREAM pHstStream = drvAudioGetHostStream(pStream); … … 609 611 * Init host stream. 610 612 */ 613 614 /* Set the host's default audio data layout. */ 615 pCfgHost->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED; 611 616 612 617 #ifdef DEBUG … … 631 636 #else 632 637 LogRel2(("Audio: Acquired %s host format for '%s': %RU32Hz, %RU8%s, %RU8 %s\n", 633 pCfgGuest->enmDir == PDMAUDIODIR_IN ? "recording" : "playback", pStream->szName,634 pCfgHost->Props.uHz, pCfgHost->Props.cBits, pCfgHost->Props.fSigned ? "S" : "U",638 CfgHostAcq.enmDir == PDMAUDIODIR_IN ? "recording" : "playback", pStream->szName, 639 CfgHostAcq.Props.uHz, CfgHostAcq.Props.cBits, CfgHostAcq.Props.fSigned ? "S" : "U", 635 640 CfgHostAcq.Props.cChannels, CfgHostAcq.Props.cChannels == 0 ? "Channel" : "Channels")); 636 641 #endif … … 658 663 659 664 /* Make a copy of the acquired host stream configuration. */ 660 rc2 = DrvAudioHlpStreamCfgCopy(&pHstStream->Cfg, pCfgHost);665 rc2 = DrvAudioHlpStreamCfgCopy(&pHstStream->Cfg, &CfgHostAcq); 661 666 AssertRC(rc2); 662 667 … … 667 672 /* Destroy any former mixing buffer. */ 668 673 AudioMixBufDestroy(&pGstStream->MixBuf); 674 675 /* Set the guests's default audio data layout. */ 676 pCfgHost->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED; 669 677 670 678 /* Make sure to (re-)set the guest buffer's shift size. */ … … 1305 1313 && (stsBackend & PDMAUDIOSTRMSTS_FLAG_DATA_WRITABLE)) 1306 1314 { 1307 uint8_t u8Buf[_4K]; /** @todo Get rid of this here. */1308 1309 uint32_t cRead = 0;1310 int rc2 = AudioMixBufReadCirc(&pHstStream->MixBuf, u8Buf, sizeof(u8Buf), &cRead);1311 AssertRC(rc2);1312 1313 uint32_t cbBuf = AUDIOMIXBUF_S2B(&pHstStream->MixBuf, cRead);1314 1315 uint32_t cbPlayed = 0; 1315 1316 1316 1317 AssertPtr(pThis->pHostDrvAudio->pfnStreamPlay); 1317 rc = pThis->pHostDrvAudio->pfnStreamPlay(pThis->pHostDrvAudio, pHstStream->pvBackend, u8Buf, cbBuf, &cbPlayed); 1318 1319 if (RT_LIKELY(pHstStream->Cfg.enmLayout == PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED)) 1320 { 1321 uint8_t u8Buf[_4K]; /** @todo Get rid of this here. */ 1322 1323 uint32_t csRead = 0; 1324 int rc2 = AudioMixBufReadCirc(&pHstStream->MixBuf, u8Buf, sizeof(u8Buf), &csRead); 1325 AssertRC(rc2); 1326 1327 rc = pThis->pHostDrvAudio->pfnStreamPlay(pThis->pHostDrvAudio, pHstStream->pvBackend, 1328 u8Buf, AUDIOMIXBUF_S2B(&pHstStream->MixBuf, csRead), 1329 &cbPlayed); 1330 AssertMsg(cbPlayed % 2 == 0, 1331 ("Backend for stream '%s' returned uneven played bytes count (csRead=%RU32, cbPlayed=%RU32)\n", 1332 pHstStream->szName, csRead, cbPlayed)); 1333 1334 csPlayed = AUDIOMIXBUF_B2S(&pHstStream->MixBuf, cbPlayed); 1335 } 1336 else if (pHstStream->Cfg.enmLayout == PDMAUDIOSTREAMLAYOUT_RAW) 1337 { 1338 PDMAUDIOSAMPLE aSampleBuf[128]; /** @todo Get rid of this here. */ 1339 1340 uint32_t csRead = 0; 1341 int rc2 = AudioMixBufPeek(&pHstStream->MixBuf, csLive, aSampleBuf, 1342 RT_MIN(csLive, RT_ELEMENTS(aSampleBuf)), &csRead); 1343 AssertRC(rc2); 1344 1345 Assert(csRead <= RT_ELEMENTS(aSampleBuf)); 1346 1347 rc = pThis->pHostDrvAudio->pfnStreamPlay(pThis->pHostDrvAudio, pHstStream->pvBackend, 1348 aSampleBuf, csRead, &csPlayed); 1349 } 1350 else 1351 AssertFailedStmt(rc = VERR_NOT_IMPLEMENTED); 1352 1318 1353 if (RT_SUCCESS(rc)) 1319 1354 { 1320 AssertMsg(cbPlayed % 2 == 0,1321 ("Backend for stream '%s' returned uneven played bytes count (%RU32)\n", pHstStream->szName, cbPlayed));1322 1323 csPlayed = AUDIOMIXBUF_B2S(&pHstStream->MixBuf, cbPlayed);1324 1325 1355 AudioMixBufFinish(&pHstStream->MixBuf, csPlayed); 1326 1356
Note:
See TracChangeset
for help on using the changeset viewer.