Changeset 74038 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Sep 3, 2018 10:03:11 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r73833 r74038 666 666 static void ichac97R3StreamAsyncIOLock(PAC97STREAM pStream); 667 667 static void ichac97R3StreamAsyncIOUnlock(PAC97STREAM pStream); 668 static void ichac97R3StreamAsyncIOEnable(PAC97STREAM pStream, bool fEnable); 668 /*static void ichac97R3StreamAsyncIOEnable(PAC97STREAM pStream, bool fEnable); Unused */ 669 669 # endif 670 670 … … 1298 1298 RTStrPrintf2(szThreadName, sizeof(szThreadName), "ac97AIO%RU8", pStream->u8SD); 1299 1299 1300 rc = RTThreadCreate(&pAIO->Thread, ichac97 StreamAsyncIOThread, &Ctx,1300 rc = RTThreadCreate(&pAIO->Thread, ichac97R3StreamAsyncIOThread, &Ctx, 1301 1301 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, szThreadName); 1302 1302 if (RT_SUCCESS(rc)) … … 1399 1399 } 1400 1400 1401 #if 0 /* Unused */ 1401 1402 /** 1402 1403 * Enables (resumes) or disables (pauses) the async I/O thread. … … 1412 1413 ASMAtomicXchgBool(&pAIO->fEnabled, fEnable); 1413 1414 } 1415 #endif 1414 1416 1415 1417 # endif /* VBOX_WITH_AUDIO_AC97_ASYNC_IO */ … … 1479 1481 if (fDoRead) 1480 1482 { 1481 rc2 = ichac97R3StreamAsyncIONotify(p Stream);1483 rc2 = ichac97R3StreamAsyncIONotify(pThis, pStream); 1482 1484 AssertRC(rc2); 1483 1485 } … … 1513 1515 { 1514 1516 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO 1515 if (fInTimer) 1516 { 1517 rc2 = ichac97R3StreamAsyncIONotify(pThis, pStream); 1518 AssertRC(rc2); 1519 } 1520 else 1517 if (!fInTimer) 1518 { 1521 1519 # endif 1522 {1523 1520 rc2 = AudioMixerSinkUpdate(pSink); 1524 1521 AssertRC(rc2); 1525 1522 1526 1523 /* Is the sink ready to be read (host input data) from? If so, by how much? */ 1527 const uint32_t cbReadable = AudioMixerSinkGetReadable(pSink);1528 1529 /* How much (guest input) data is free at the moment? */1530 uint32_t cb ToTransfer= ichac97R3StreamGetFree(pStream);1531 1532 Log3Func(("[SD%RU8] cb Readable=%RU32, cbFree=%RU32\n", pStream->u8SD, cbReadable, cbToTransfer));1524 uint32_t cbSinkReadable = AudioMixerSinkGetReadable(pSink); 1525 1526 /* How much (guest input) data is available for writing at the moment for the AC'97 stream? */ 1527 uint32_t cbStreamFree = ichac97R3StreamGetFree(pStream); 1528 1529 Log3Func(("[SD%RU8] cbSinkReadable=%RU32, cbStreamFree=%RU32\n", pStream->u8SD, cbSinkReadable, cbStreamFree)); 1533 1530 1534 1531 /* Do not read more than the sink can provide at the moment. 1535 1532 * The host sets the overall pace. */ 1536 if (cb ToTransfer > cbReadable)1537 cb ToTransfer = cbReadable;1538 1539 if (cb ToTransfer)1533 if (cbSinkReadable > cbStreamFree) 1534 cbSinkReadable = cbStreamFree; 1535 1536 if (cbSinkReadable) 1540 1537 { 1541 1538 /* Write (guest input) data to the stream which was read from stream's sink before. */ 1542 rc2 = ichac97R3StreamWrite(pThis, pStream, pSink, cb ToTransfer, NULL /* pcbWritten */);1539 rc2 = ichac97R3StreamWrite(pThis, pStream, pSink, cbSinkReadable, NULL /* pcbWritten */); 1543 1540 AssertRC(rc2); 1544 1541 } 1545 }1546 1547 1542 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO 1548 if (fInTimer) 1543 } 1544 else /* fInTimer */ 1545 { 1549 1546 # endif 1550 { 1551 const uint32_t cbToTransfer = ichac97R3StreamGetUsed(pStream); 1552 if (cbToTransfer) 1547 1548 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO 1549 const uint64_t tsNowNs = RTTimeNanoTS(); 1550 if (tsNowNs - pStream->State.tsLastUpdateNs >= pStream->State.Cfg.Device.uSchedulingHintMs * RT_NS_1MS) 1551 { 1552 rc2 = ichac97R3StreamAsyncIONotify(pThis, pStream); 1553 AssertRC(rc2); 1554 1555 pStream->State.tsLastUpdateNs = tsNowNs; 1556 } 1557 # endif 1558 1559 const uint32_t cbStreamUsed = ichac97R3StreamGetUsed(pStream); 1560 if (cbStreamUsed) 1553 1561 { 1554 1562 /* When running synchronously, do the DMA data transfers here. 1555 1563 * Otherwise this will be done in the stream's async I/O thread. */ 1556 rc2 = ichac97R3StreamTransfer(pThis, pStream, cb ToTransfer);1564 rc2 = ichac97R3StreamTransfer(pThis, pStream, cbStreamUsed); 1557 1565 AssertRC(rc2); 1558 1566 } 1559 } 1567 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO 1568 } 1569 # endif 1560 1570 } 1561 1571 } … … 1699 1709 PDMAUDIOBACKENDCFG Cfg; 1700 1710 rc = pDrv->pConnector->pfnGetConfig(pDrv->pConnector, &Cfg); 1701 if ( RT_SUCCESS(rc) 1702 && Cfg.cMaxStreamsIn) /* At least one input source available? */ 1711 if (RT_SUCCESS(rc)) 1703 1712 { 1704 rc = AudioMixerSinkSetRecordingSource(pMixSink, pMixStrm); 1705 LogFlowFunc(("LUN#%RU8: Recording source is now '%s', rc=%Rrc\n", pDrv->uLUN, pStreamCfg->szName, rc)); 1706 LogRel2(("AC97: Set recording source to '%s'\n", pStreamCfg->szName)); 1713 if (Cfg.cMaxStreamsIn) /* At least one input source available? */ 1714 { 1715 rc = AudioMixerSinkSetRecordingSource(pMixSink, pMixStrm); 1716 LogFlowFunc(("LUN#%RU8: Recording source for '%s' -> '%s', rc=%Rrc\n", 1717 pDrv->uLUN, pStreamCfg->szName, Cfg.szName, rc)); 1718 1719 if (RT_SUCCESS(rc)) 1720 LogRel2(("AC97: Set recording source for '%s' to '%s'\n", pStreamCfg->szName, Cfg.szName)); 1721 } 1722 else 1723 LogRel(("AC97: Backend '%s' currently is not offering any recording source for '%s'\n", 1724 Cfg.szName, pStreamCfg->szName)); 1707 1725 } 1708 1726 else if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.