Changeset 54941 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Mar 25, 2015 3:01:04 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99189
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r54491 r54941 73 73 static int drvAudioDestroyGstIn(PDRVAUDIO pThis, PPDMAUDIOGSTSTRMIN pGstStrmIn); 74 74 75 static int drvAudioAllocHstIn(PDRVAUDIO pThis, PPDMAUDIOSTREAMCFG pCfg, PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOHSTSTRMIN *ppHstStrmIn);75 static int drvAudioAllocHstIn(PDRVAUDIO pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOHSTSTRMIN *ppHstStrmIn); 76 76 static int drvAudioDestroyHstIn(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMIN pHstStrmIn); 77 77 … … 479 479 } 480 480 481 static int drvAudioHstInAdd(PDRVAUDIO pThis, PPDMAUDIOSTREAMCFG pCfg, PDMAUDIORECSOURCE enmRecSource,481 static int drvAudioHstInAdd(PDRVAUDIO pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, PDMAUDIORECSOURCE enmRecSource, 482 482 PPDMAUDIOHSTSTRMIN *ppHstStrmIn) 483 483 { … … 487 487 488 488 PPDMAUDIOHSTSTRMIN pHstStrmIn; 489 int rc = drvAudioAllocHstIn(pThis, p Cfg, enmRecSource, &pHstStrmIn);489 int rc = drvAudioAllocHstIn(pThis, pszName, pCfg, enmRecSource, &pHstStrmIn); 490 490 if (RT_SUCCESS(rc)) 491 491 *ppHstStrmIn = pHstStrmIn; … … 501 501 if (RT_SUCCESS(rc)) 502 502 { 503 rc = audioMixBufInit(&pGstStrmOut->MixBuf, pszName, &pGstStrmOut->Props, 503 char *pszTemp; 504 if (RTStrAPrintf(&pszTemp, "%s (Guest)", pszName) <= 0) 505 return VERR_NO_MEMORY; 506 507 rc = audioMixBufInit(&pGstStrmOut->MixBuf, pszTemp, &pGstStrmOut->Props, 504 508 audioMixBufSize(&pHostStrmOut->MixBuf)); 505 509 if (RT_SUCCESS(rc)) 506 510 rc = audioMixBufLinkTo(&pGstStrmOut->MixBuf, &pHostStrmOut->MixBuf); 507 511 512 RTStrFree(pszTemp); 513 508 514 if (RT_SUCCESS(rc)) 509 515 { … … 542 548 } 543 549 544 PPDMAUDIOHSTSTRMOUT pHstStrmOut = 545 (PPDMAUDIOHSTSTRMOUT)RTMemAllocZ(pThis->BackendCfg.cbStreamOut); 550 PPDMAUDIOHSTSTRMOUT pHstStrmOut = (PPDMAUDIOHSTSTRMOUT)RTMemAllocZ(pThis->BackendCfg.cbStreamOut); 546 551 if (!pHstStrmOut) 547 552 { … … 559 564 560 565 uint32_t cSamples; 561 rc = pThis->pHostDrvAudio->pfnInitOut(pThis->pHostDrvAudio, pHstStrmOut, pCfg, 562 &cSamples); 566 rc = pThis->pHostDrvAudio->pfnInitOut(pThis->pHostDrvAudio, pHstStrmOut, pCfg, &cSamples); 563 567 if (RT_FAILURE(rc)) 564 568 { … … 569 573 fInitialized = true; 570 574 571 rc = audioMixBufInit(&pHstStrmOut->MixBuf, pszName, &pHstStrmOut->Props, cSamples); 575 char *pszTemp; 576 if (RTStrAPrintf(&pszTemp, "%s (Host)", pszName) <= 0) 577 { 578 rc = VERR_NO_MEMORY; 579 break; 580 } 581 582 rc = audioMixBufInit(&pHstStrmOut->MixBuf, pszTemp, &pHstStrmOut->Props, cSamples); 572 583 if (RT_SUCCESS(rc)) 573 584 { … … 576 587 } 577 588 589 RTStrFree(pszTemp); 590 578 591 } while (0); 579 592 … … 582 595 if (fInitialized) 583 596 { 584 int rc2 = pThis->pHostDrvAudio->pfnFiniOut(pThis->pHostDrvAudio, 585 pHstStrmOut); 597 int rc2 = pThis->pHostDrvAudio->pfnFiniOut(pThis->pHostDrvAudio, pHstStrmOut); 586 598 AssertRC(rc2); 587 599 } … … 665 677 AssertPtrReturn(pThisCfg, VERR_INVALID_POINTER); 666 678 667 PPDMAUDIOGSTSTRMIN pGstStrmIn = 668 (PPDMAUDIOGSTSTRMIN)RTMemAllocZ(sizeof(PDMAUDIOGSTSTRMIN)); 679 PPDMAUDIOGSTSTRMIN pGstStrmIn = (PPDMAUDIOGSTSTRMIN)RTMemAllocZ(sizeof(PDMAUDIOGSTSTRMIN)); 669 680 if (!pGstStrmIn) 670 681 return VERR_NO_MEMORY; 671 682 683 672 684 PPDMAUDIOHSTSTRMIN pHstStrmIn; 673 int rc = drvAudioHstInAdd(pThis, p ThisCfg, enmRecSource, &pHstStrmIn);685 int rc = drvAudioHstInAdd(pThis, pszName, pThisCfg, enmRecSource, &pHstStrmIn); 674 686 if (RT_FAILURE(rc)) 675 687 { 676 LogFunc(("Failed to add host audio input stream \"%s\", rc=%Rrc\n", 677 pszName, rc)); 688 LogFunc(("Failed to add host audio input stream \"%s\", rc=%Rrc\n", pszName, rc)); 678 689 679 690 RTMemFree(pGstStrmIn); … … 717 728 if (RT_SUCCESS(rc)) 718 729 { 719 rc = audioMixBufInit(&pGstStrmIn->MixBuf, pszName, &pHstStrmIn->Props, 730 char *pszTemp; 731 if (RTStrAPrintf(&pszTemp, "%s (Guest)", pszName) <= 0) 732 return VERR_NO_MEMORY; 733 734 rc = audioMixBufInit(&pGstStrmIn->MixBuf, pszTemp, &pHstStrmIn->Props, 720 735 audioMixBufSize(&pHstStrmIn->MixBuf)); 721 736 if (RT_SUCCESS(rc)) 722 737 rc = audioMixBufLinkTo(&pHstStrmIn->MixBuf, &pGstStrmIn->MixBuf); 723 738 739 RTStrFree(pszTemp); 740 724 741 if (RT_SUCCESS(rc)) 725 742 { 726 743 #ifdef DEBUG 727 744 drvAudioStreamCfgPrint(pCfg); 728 745 #endif 729 746 pGstStrmIn->State.fActive = false; 730 747 pGstStrmIn->State.fEmpty = true; … … 742 759 } 743 760 744 static int drvAudioAllocHstIn(PDRVAUDIO pThis, PPDMAUDIOSTREAMCFG pCfg,761 static int drvAudioAllocHstIn(PDRVAUDIO pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, 745 762 PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOHSTSTRMIN *ppHstStrmIn) 746 763 { … … 783 800 fInitialized = true; 784 801 785 rc = audioMixBufInit(&pHstStrmIn->MixBuf, "HostIn", &pHstStrmIn->Props, 786 cSamples); 802 char *pszTemp; 803 if (RTStrAPrintf(&pszTemp, "%s (Host)", pszName) <= 0) 804 { 805 rc = VERR_NO_MEMORY; 806 break; 807 } 808 809 rc = audioMixBufInit(&pHstStrmIn->MixBuf, pszTemp, &pHstStrmIn->Props, cSamples); 787 810 if (RT_SUCCESS(rc)) 788 811 { … … 790 813 pThis->cFreeInputStreams--; 791 814 } 815 816 RTStrFree(pszTemp); 792 817 793 818 } while (0); … … 1382 1407 *pcbRead = 0; 1383 1408 return VINF_SUCCESS; 1384 } 1409 } 1385 1410 1386 1411 PPDMAUDIOHSTSTRMIN pHstStrmIn = pGstStrmIn->pHstStrmIn; … … 1612 1637 1613 1638 drvAudioGstInFreeRes(pGstStrmIn); 1639 1640 char *pszTemp; 1641 if (RTStrAPrintf(&pszTemp, "%s (Guest)", pszName) <= 0) 1642 { 1643 RTMemFree(pGstStrmIn); 1644 return VERR_NO_MEMORY; 1645 } 1646 1614 1647 rc = drvAudioGstInInit(pGstStrmIn, pHstStrmIn, pszName, pCfg); 1648 1649 RTStrFree(pszTemp); 1615 1650 } 1616 1651 else
Note:
See TracChangeset
for help on using the changeset viewer.