Changeset 57398 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Aug 17, 2015 3:33:05 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 102162
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r57393 r57398 318 318 return; 319 319 320 Log2Func(("pPCMInfo=%p, pvBuf=%p, cbBuf=%zu, fSigned=%RTbool, cBits=%RU8, cShift=%RU8\n", 321 pPCMInfo, pvBuf, cbBuf, pPCMInfo->fSigned, pPCMInfo->cBits, pPCMInfo->cShift)); 322 320 323 if (pPCMInfo->fSigned) 321 324 { … … 368 371 } 369 372 } 373 } 374 375 static int drvAudioControlHstIn(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMIN pHstStrmIn, PDMAUDIOSTREAMCMD enmStreamCmd, 376 uint32_t uFlags) 377 { 378 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 379 AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER); 380 381 int rc; 382 383 switch (enmStreamCmd) 384 { 385 case PDMAUDIOSTREAMCMD_ENABLE: 386 { 387 if (!pHstStrmIn->fEnabled) 388 { 389 rc = pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn, PDMAUDIOSTREAMCMD_ENABLE); 390 if (RT_SUCCESS(rc)) 391 { 392 pHstStrmIn->fEnabled = true; 393 } 394 else 395 LogFlowFunc(("Backend reported an error when opening input stream, rc=%Rrc\n", rc)); 396 } 397 else 398 rc = VINF_SUCCESS; 399 400 break; 401 } 402 403 case PDMAUDIOSTREAMCMD_DISABLE: 404 { 405 if (pHstStrmIn->fEnabled) 406 { 407 rc = pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn, PDMAUDIOSTREAMCMD_DISABLE); 408 if (RT_SUCCESS(rc)) 409 { 410 pHstStrmIn->fEnabled = false; 411 AudioMixBufClear(&pHstStrmIn->MixBuf); 412 } 413 else 414 LogFlowFunc(("Backend vetoed closing output stream, rc=%Rrc\n", rc)); 415 } 416 else 417 rc = VINF_SUCCESS; 418 419 break; 420 } 421 422 default: 423 AssertMsgFailed(("Command %ld not implemented\n", enmStreamCmd)); 424 rc = VERR_NOT_IMPLEMENTED; 425 break; 426 } 427 428 return rc; 429 } 430 431 static int drvAudioControlHstOut(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMOUT pHstStrmOut, PDMAUDIOSTREAMCMD enmStreamCmd, 432 uint32_t uFlags) 433 { 434 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 435 AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER); 436 437 int rc; 438 439 switch (enmStreamCmd) 440 { 441 case PDMAUDIOSTREAMCMD_ENABLE: 442 { 443 if (!pHstStrmOut->fEnabled) 444 { 445 rc = pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut, PDMAUDIOSTREAMCMD_ENABLE); 446 if (RT_SUCCESS(rc)) 447 { 448 pHstStrmOut->fEnabled = true; 449 } 450 else 451 LogFlowFunc(("Backend reported an error when opening output stream, rc=%Rrc\n", rc)); 452 } 453 else 454 rc = VINF_SUCCESS; 455 456 break; 457 } 458 459 case PDMAUDIOSTREAMCMD_DISABLE: 460 { 461 if (pHstStrmOut->fEnabled) 462 { 463 rc = pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut, PDMAUDIOSTREAMCMD_DISABLE); 464 if (RT_SUCCESS(rc)) 465 { 466 pHstStrmOut->fEnabled = false; 467 AudioMixBufClear(&pHstStrmOut->MixBuf); 468 } 469 else 470 LogFlowFunc(("Backend vetoed closing output stream, rc=%Rrc\n", rc)); 471 } 472 else 473 rc = VINF_SUCCESS; 474 475 break; 476 } 477 478 default: 479 AssertMsgFailed(("Command %ld not implemented\n", enmStreamCmd)); 480 rc = VERR_NOT_IMPLEMENTED; 481 break; 482 } 483 484 return rc; 370 485 } 371 486 … … 1045 1160 { 1046 1161 /* Stop playing the current (pending) stream. */ 1047 int rc2 = pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut, 1048 PDMAUDIOSTREAMCMD_DISABLE); 1162 int rc2 = drvAudioControlHstOut(pThis, pHstStrmOut, PDMAUDIOSTREAMCMD_DISABLE, 0 /* Flags */); 1049 1163 if (RT_SUCCESS(rc2)) 1050 1164 { 1051 pHstStrmOut->fEnabled = false;1052 1165 pHstStrmOut->fPendingDisable = false; 1053 1166 … … 1294 1407 PPDMAUDIOHSTSTRMOUT pHstStrmOut = NULL; 1295 1408 while ((pHstStrmOut = drvAudioHstFindAnyEnabledOut(pThis, pHstStrmOut))) 1296 pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut, enmCmd);1409 drvAudioControlHstOut(pThis, pHstStrmOut, enmCmd, 0 /* Flags */); 1297 1410 1298 1411 PPDMAUDIOHSTSTRMIN pHstStrmIn = NULL; 1299 1412 while ((pHstStrmIn = drvAudioFindNextEnabledHstIn(pThis, pHstStrmIn))) 1300 pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn, enmCmd);1413 drvAudioControlHstIn(pThis, pHstStrmIn, enmCmd, 0 /* Flags */); 1301 1414 } 1302 1415 … … 1451 1564 PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface); 1452 1565 1566 int rc = VINF_SUCCESS; 1567 1453 1568 if (pGstStrmOut) 1454 1569 { 1455 1570 PPDMAUDIOHSTSTRMOUT pHstStrmOut = pGstStrmOut->pHstStrmOut; 1456 1571 AssertPtr(pHstStrmOut); 1457 1458 LogFlowFunc(("%s: fEnable=%RTbool\n", pGstStrmOut->MixBuf.pszName, fEnable));1459 1572 1460 1573 if (pGstStrmOut->State.fActive != fEnable) … … 1464 1577 pHstStrmOut->fPendingDisable = false; 1465 1578 if (!pHstStrmOut->fEnabled) 1466 { 1467 pHstStrmOut->fEnabled = true; 1468 pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut, 1469 PDMAUDIOSTREAMCMD_ENABLE); 1470 /** @todo Check rc. */ 1471 } 1579 rc = drvAudioControlHstOut(pThis, pHstStrmOut, PDMAUDIOSTREAMCMD_ENABLE, 0 /* Flags */); 1472 1580 } 1473 1581 else … … 1488 1596 } 1489 1597 1490 pGstStrmOut->State.fActive = fEnable; 1491 } 1492 } 1493 1494 return VINF_SUCCESS; 1598 if (RT_SUCCESS(rc)) 1599 pGstStrmOut->State.fActive = fEnable; 1600 1601 LogFlowFunc(("%s: fEnable=%RTbool, rc=%Rrc\n", pGstStrmOut->MixBuf.pszName, fEnable, rc)); 1602 } 1603 } 1604 1605 return rc; 1495 1606 } 1496 1607 … … 1503 1614 PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface); 1504 1615 1616 int rc = VINF_SUCCESS; 1617 1505 1618 if (pGstStrmIn) 1506 1619 { … … 1512 1625 if (pGstStrmIn->State.fActive != fEnable) 1513 1626 { 1514 if (fEnable) 1515 { 1516 if (!pHstStrmIn->fEnabled) 1517 { 1518 int rc2 = pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn, 1519 PDMAUDIOSTREAMCMD_ENABLE); 1520 if (RT_LIKELY(RT_SUCCESS(rc2))) 1521 pHstStrmIn->fEnabled = true; 1522 else 1523 LogFlowFunc(("Error opening host input stream in backend, rc=%Rrc\n", rc2)); 1524 } 1525 } 1526 else 1527 { 1528 if (pHstStrmIn->fEnabled) 1529 { 1530 int rc2 = pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn, 1531 PDMAUDIOSTREAMCMD_DISABLE); 1532 if (RT_LIKELY(RT_SUCCESS(rc2))) /* Did the backend veto? */ 1533 pHstStrmIn->fEnabled = false; 1534 else 1535 LogFlowFunc(("Backend vetoed closing input stream, rc=%Rrc\n", rc2)); 1536 } 1537 } 1538 1539 pGstStrmIn->State.fActive = fEnable; 1540 } 1541 } 1542 1543 return VINF_SUCCESS; 1627 rc = drvAudioControlHstIn(pThis, pHstStrmIn, 1628 fEnable ? PDMAUDIOSTREAMCMD_ENABLE : PDMAUDIOSTREAMCMD_DISABLE, 0 /* Flags */); 1629 if (RT_SUCCESS(rc)) 1630 pGstStrmIn->State.fActive = fEnable; 1631 1632 LogFlowFunc(("%s: fEnable=%RTbool, rc=%Rrc\n", pGstStrmIn->MixBuf.pszName, fEnable, rc)); 1633 } 1634 } 1635 1636 return rc; 1544 1637 } 1545 1638 … … 1778 1871 while ((pHstStrmOut = drvAudioFindAnyHstOut(pThis, pHstStrmOut))) 1779 1872 { 1780 pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut, PDMAUDIOSTREAMCMD_DISABLE);1873 drvAudioControlHstOut(pThis, pHstStrmOut, PDMAUDIOSTREAMCMD_DISABLE, 0 /* Flags */); 1781 1874 pThis->pHostDrvAudio->pfnFiniOut(pThis->pHostDrvAudio, pHstStrmOut); 1782 1875 } … … 1786 1879 while ((pHstStrmIn = drvAudioFindNextHstIn(pThis, pHstStrmIn))) 1787 1880 { 1788 pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn, PDMAUDIOSTREAMCMD_DISABLE);1881 drvAudioControlHstIn(pThis, pHstStrmIn, PDMAUDIOSTREAMCMD_DISABLE, 0 /* Flags */); 1789 1882 pThis->pHostDrvAudio->pfnFiniIn(pThis->pHostDrvAudio, pHstStrmIn); 1790 1883 } -
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r57383 r57398 549 549 if (pDSoundStrmOut->pDSB != NULL) 550 550 { 551 DWORD dwStatus;552 551 /* This performs some restore, so call it anyway and ignore result. */ 553 dsoundPlayGetStatus(pDSoundStrmOut->pDSB, &dwStatus);552 dsoundPlayGetStatus(pDSoundStrmOut->pDSB, NULL /* Status */); 554 553 555 554 LogFlowFunc(("Playback stopped\n")); 556 555 557 556 HRESULT hr = IDirectSoundBuffer8_Stop(pDSoundStrmOut->pDSB); 558 if (FAILED(hr)) 557 if (SUCCEEDED(hr)) 558 { 559 dsoundPlayClearSamples(pDSoundStrmOut); 560 } 561 else 559 562 LogRelMax(s_cMaxRelLogEntries, ("DSound: Errpor stopping playback buffer: %Rhrc\n", hr)); 560 563 }
Note:
See TracChangeset
for help on using the changeset viewer.