VirtualBox

Changeset 53567 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Dec 18, 2014 12:42:45 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
97327
Message:

PDM/Audio: Update.

Location:
trunk/src/VBox/Devices/Audio
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/AudioMixBuffer.cpp

    r53486 r53567  
    10511051void audioMixBufUnlink(PPDMAUDIOMIXBUF pMixBuf)
    10521052{
    1053     if (!pMixBuf)
     1053    if (!pMixBuf || !pMixBuf->pszName)
    10541054        return;
    10551055
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r53512 r53567  
    5555#endif
    5656
     57#ifdef DEBUG
    5758//#define DEBUG_LUN
    58 #ifdef DEBUG_LUN
    59 # define DEBUG_LUN_NUM 1
    60 #endif
     59# ifdef DEBUG_LUN
     60#  define DEBUG_LUN_NUM 1
     61# endif
     62#endif /* DEBUG */
    6163
    6264#define AC97_SSM_VERSION 1
     
    218220    /** Pointer to AC97 controller (state). */
    219221    PAC97STATE                         pAC97State;
     222    /** Driver flags. */
     223    PDMAUDIODRVFLAGS                   Flags;
    220224    /** LUN # to which this driver has been assigned. */
    221225    uint8_t                            uLUN;
     
    20872091            pDrv->uLUN = uLUN;
    20882092
    2089             LogFlowFunc(("LUN #%u is using connector %p\n", uLUN, pDrv->pConnector));
    2090 
     2093            /*
     2094             * For now we always set the driver at LUN 0 as our primary
     2095             * host backend. This might change in the future.
     2096             */
     2097            if (pDrv->uLUN == 0)
     2098                pDrv->Flags |= PDMAUDIODRVFLAG_PRIMARY;
     2099
     2100            LogFunc(("LUN #%u: pCon=%p, drvFlags=0x%x\n",
     2101                     uLUN, pDrv->pConnector, pDrv->Flags));
     2102           
    20912103            pThis->paDrv[uLUN] = pDrv;
    20922104            pThis->cLUNs++;
     
    21052117    RTStrFree(pszDesc);
    21062118
    2107     LogFlowFunc(("iLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc));
     2119    LogFunc(("iLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc));
    21082120    return rc;
    21092121}
     
    21952207    rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->IBase, &pThis->pDrvBase, "Audio Driver Port");
    21962208    if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
    2197         Log(("ac97: No attached driver!\n"));
     2209        LogFunc(("ac97: No attached driver!\n"));
    21982210    else if (RT_FAILURE(rc))
    21992211    {
     
    22212233    for (uint8_t lun = 0; lun < pThis->cLUNs; lun++)
    22222234    {
    2223         if (   !pThis->paDrv[lun]->pConnector->pfnIsInputOK(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmIn)
    2224             && !pThis->paDrv[lun]->pConnector->pfnIsOutputOK(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmOut)
    2225             && !pThis->paDrv[lun]->pConnector->pfnIsInputOK(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmMic))
    2226         {
    2227             /* Was not able initialize *any* stream. Select the NULL audio driver instead. */
    2228             pThis->paDrv[lun]->pConnector->pfnCloseIn(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmIn);
    2229             pThis->paDrv[lun]->pConnector->pfnCloseOut(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmOut);
    2230             pThis->paDrv[lun]->pConnector->pfnCloseIn(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmMic);
    2231 
    2232             pThis->paDrv[lun]->pStrmOut = NULL;
    2233             pThis->paDrv[lun]->pStrmIn = NULL;
    2234             pThis->paDrv[lun]->pStrmMic = NULL;
    2235 
    2236             pThis->paDrv[lun]->pConnector->pfnInitNull(pThis->paDrv[lun]->pConnector);
     2235        PAC97DRIVER pDrv = pThis->paDrv[lun];
     2236        AssertPtr(pDrv);
     2237
     2238        /* Only primary drivers are critical for the VM to run. Everything else
     2239         * might not worth showing an own error message box in the GUI. */
     2240        if (!(pDrv->Flags & PDMAUDIODRVFLAG_PRIMARY))
     2241            continue;
     2242
     2243        PPDMIAUDIOCONNECTOR pCon = pThis->paDrv[lun]->pConnector;
     2244        AssertPtr(pCon);
     2245        if (   !pCon->pfnIsInputOK (pCon, pDrv->pStrmIn)
     2246            && !pCon->pfnIsOutputOK(pCon, pDrv->pStrmOut)
     2247            && !pCon->pfnIsInputOK (pCon, pDrv->pStrmMic))
     2248        {
     2249            LogRel(("AC97: Selecting NULL driver\n"));
     2250
     2251            /* Was not able initialize *any* stream.
     2252             * Select the NULL audio driver instead. */
     2253            pCon->pfnCloseIn (pCon, pDrv->pStrmIn);
     2254            pCon->pfnCloseOut(pCon, pDrv->pStrmOut);
     2255            pCon->pfnCloseIn (pCon, pDrv->pStrmMic);
     2256
     2257            pDrv->pStrmOut = NULL;
     2258            pDrv->pStrmIn = NULL;
     2259            pDrv->pStrmMic = NULL;
     2260
     2261            pCon->pfnInitNull(pCon);
    22372262            ac97Reset(pDevIns);
    22382263
     
    22412266                   "with the consequence that no sound is audible"));
    22422267        }
    2243         else if (   !pThis->paDrv[lun]->pConnector->pfnIsInputOK(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmIn)
    2244                  || !pThis->paDrv[lun]->pConnector->pfnIsOutputOK(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmOut)
    2245                  || !pThis->paDrv[lun]->pConnector->pfnIsInputOK(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmMic))
     2268        else if (   !pCon->pfnIsInputOK (pCon, pDrv->pStrmIn)
     2269                 || !pCon->pfnIsOutputOK(pCon, pDrv->pStrmOut)
     2270                 || !pCon->pfnIsInputOK (pCon, pDrv->pStrmMic))
    22462271        {
    22472272            char   szMissingStreams[128];
    22482273            size_t len = 0;
    2249             if (!pThis->paDrv[lun]->pConnector->pfnIsInputOK(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmIn))
    2250                 len = RTStrPrintf(szMissingStreams, sizeof(szMissingStreams), "PCM Input");
    2251             if (!pThis->paDrv[lun]->pConnector->pfnIsOutputOK(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmOut))
    2252                 len += RTStrPrintf(szMissingStreams + len, sizeof(szMissingStreams) - len, len ? ", PCM Output" : "PCM Output");
    2253             if (!pThis->paDrv[lun]->pConnector->pfnIsInputOK(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pStrmMic))
    2254                 len += RTStrPrintf(szMissingStreams + len, sizeof(szMissingStreams) - len, len ? ", PCM Mic" : "PCM Mic");
     2274            if (!pCon->pfnIsInputOK (pCon, pDrv->pStrmIn))
     2275                len = RTStrPrintf(szMissingStreams,
     2276                                  sizeof(szMissingStreams), "PCM Input");
     2277            if (!pCon->pfnIsOutputOK(pCon, pDrv->pStrmOut))
     2278                len += RTStrPrintf(szMissingStreams + len,
     2279                                   sizeof(szMissingStreams) - len, len ? ", PCM Output" : "PCM Output");
     2280            if (!pCon->pfnIsInputOK (pCon, pDrv->pStrmMic))
     2281                len += RTStrPrintf(szMissingStreams + len,
     2282                                   sizeof(szMissingStreams) - len, len ? ", PCM Mic" : "PCM Mic");
    22552283
    22562284            PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
  • trunk/src/VBox/Devices/Audio/DevIchHda.cpp

    r53507 r53567  
    5757#include "DevIchHdaCodec.h"
    5858
     59#ifdef DEBUG
     60#define DEBUG_LUN
     61# ifdef DEBUG_LUN
     62#  define DEBUG_LUN_NUM 0
     63# endif
     64#endif /* DEBUG */
     65
    5966/*******************************************************************************
    6067*   Defined Constants And Macros                                               *
     
    6269//#define HDA_AS_PCI_EXPRESS
    6370#define VBOX_WITH_INTEL_HDA
     71
     72#if (defined(DEBUG) && defined(DEBUG_andy))
     73/* Enables experimental support for separate mic-in handling.
     74   Do not enable this yet for regular builds, as this needs more testing first! */
     75# define VBOX_WITH_HDA_MIC_IN
     76#endif
    6477
    6578#if defined(VBOX_WITH_HP_HDA)
     
    560573    /** Pointer to HDA controller (state). */
    561574    PHDASTATE                          pHDAState;
     575    /** Driver flags. */
     576    PDMAUDIODRVFLAGS                   Flags;
    562577    /** LUN to which this driver has been assigned. */
    563578    uint8_t                            uLUN;
     
    14841499                break;
    14851500#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     1501# ifdef VBOX_WITH_HDA_MIC_IN
    14861502            case HDA_REG_SD2CTL:
    14871503                u8Strm = 2;
    14881504                pBdle = &pThis->StMicBdle;
    14891505                break;
     1506# endif
    14901507#endif
    14911508            case HDA_REG_SD4CTL:
     
    15241541                    break;
    15251542#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     1543# ifdef VBOX_WITH_HDA_MIC_IN
    15261544                case HDA_REG_SD2CTL:
    15271545                    for (uint8_t lun = 0; lun < pThis->cLUNs; lun++)
    15281546                        pThis->paDrv[lun]->pConnector->pfnEnableIn(pThis->paDrv[lun]->pConnector,
    15291547                                                                   pThis->paDrv[lun]->pStrmMic, fRun);
    1530 #else
    1531 
     1548# endif
    15321549#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
    15331550                    break;
     
    17571774                rc = hdaCodecOpenStream(pThis->pCodec, PI_INDEX, &as);
    17581775            break;
    1759         case HDA_REG_SD4FMT:
     1776#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     1777# ifdef VBOX_WITH_HDA_MIC_IN
     1778        case HDA_REG_SD2FMT:
    17601779            for (uint8_t lun = 0; lun < pThis->cLUNs; lun++)
    1761                 rc = hdaCodecOpenStream(pThis->pCodec, PO_INDEX, &as);
     1780                rc = hdaCodecOpenStream(pThis->pCodec, MC_INDEX, &as);
    17621781            break;
     1782# endif
     1783#endif
    17631784        default:
    17641785            LogFunc(("Warning: Attempt to change format on register %d\n", iReg));
     
    20212042     * where it might happen.
    20222043     */
    2023     Assert((cbCopied == pBdle->cbUnderFifoW + cbArranged2Copy)); /* we assume that we write the entire buffer including unreported bytes */
     2044    AssertMsg((cbCopied == pBdle->cbUnderFifoW + cbArranged2Copy), /* we assume that we write the entire buffer including unreported bytes */
     2045              ("cbCopied=%RU32 != pBdle->cbUnderFifoW=%RU32 + cbArranged2Copy=%RU32\n",
     2046               cbCopied, pBdle->cbUnderFifoW, cbArranged2Copy));
    20242047    if (   pBdle->cbUnderFifoW
    20252048        && pBdle->cbUnderFifoW <= cbCopied)
     
    22722295            int rc;
    22732296            uint32_t cbWritten;
    2274             for (uint8_t lun = 0; lun < pThis->cLUNs; lun++)
     2297# ifdef DEBUG_LUN
     2298            uint8_t lun = DEBUG_LUN_NUM;
     2299# else
     2300            for (uint8_t lun = 0; lun < 1; lun++)
    22752301            {
     2302# endif
    22762303                rc = pThis->paDrv[lun]->pConnector->pfnWrite(pThis->paDrv[lun]->pConnector, pThis->paDrv[lun]->pGstStrmOut,
    22772304                                                             pBdle->au8HdaBuffer, cb2Copy + pBdle->cbUnderFifoW,
    22782305                                                             &cbWritten);
     2306# ifndef DEBUG_LUN
    22792307                if (RT_FAILURE(rc))
    22802308                    continue;
    2281 
     2309# endif
    22822310                cbWrittenMax = RT_MAX(cbWrittenMax, cbWritten);
     2311# ifndef DEBUG_LUN
    22832312            }
     2313# endif
    22842314#else
    22852315            cbWrittenMax = AUD_write (pThis->pCodec->SwVoiceOut, pBdle->au8HdaBuffer, cb2Copy + pBdle->cbUnderFifoW);
     
    23522382
    23532383#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     2384# ifdef VBOX_WITH_HDA_MIC_IN
    23542385static void hdaMicInputCallback(void *pvDrv, uint32_t cbAvail)
    23552386{
     
    23572388    hdaTransfer(pThis, MC_INDEX, cbAvail);
    23582389}
     2390# endif /* VBOX_WITH_HDA_MIC_IN */
    23592391
    23602392static void hdaLineInputCallback(void *pvDrv, uint32_t cbAvail)
     
    23792411    switch (enmRecSource)
    23802412    {
     2413# ifdef VBOX_WITH_HDA_MIC_IN
    23812414        case PDMAUDIORECSOURCE_MIC:
    23822415            pfnCallback = hdaMicInputCallback;
    23832416            pSink = pThis->pSinkMicIn;
    23842417            break;
     2418# endif
    23852419        case PDMAUDIORECSOURCE_LINE_IN:
    23862420            pfnCallback = hdaLineInputCallback;
     
    24902524        }
    24912525
     2526#ifdef VBOX_WITH_HDA_MIC_IN
    24922527        case MC_INDEX:
    24932528        {
     
    24962531            break;
    24972532        }
    2498 
     2533#endif
    24992534        case PO_INDEX:
    25002535        {
     
    25242559
    25252560        *StreamDesc.pu32Sts |= HDA_REG_FIELD_FLAG_MASK(SDSTS, FIFORDY);
    2526         Assert((cbAvail >= 0 && (StreamDesc.u32Cbl >= (*StreamDesc.pu32Lpib)))); /* sanity */
     2561        Assert((StreamDesc.u32Cbl >= (*StreamDesc.pu32Lpib))); /* sanity */
    25272562        uint32_t u32CblLimit = StreamDesc.u32Cbl - (*StreamDesc.pu32Lpib);
    25282563        Assert((u32CblLimit > hdaFifoWToSz(pThis, &StreamDesc)));
     
    25522587                break;
    25532588#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     2589# ifdef VBOX_WITH_HDA_MIC_IN
    25542590            case MC_INDEX:
    25552591                pSink = pThis->pSinkMicIn;
    25562592                cb = hdaReadAudio(pThis, pSink, pBdle, &StreamDesc, &cbAvail, &fStop, u32CblLimit);
    25572593                break;
     2594# endif
    25582595#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
    25592596            default:
     
    35243561            pDrv->uLUN = uLUN;
    35253562
     3563            /*
     3564             * For now we always set the driver at LUN 0 as our primary
     3565             * host backend. This might change in the future.
     3566             */
     3567            if (pDrv->uLUN == 0)
     3568                pDrv->Flags |= PDMAUDIODRVFLAG_PRIMARY;
     3569
     3570            LogFunc(("LUN #%u: pCon=%p, drvFlags=0x%x\n",
     3571                     uLUN, pDrv->pConnector, pDrv->Flags));
     3572
    35263573            pThis->paDrv[uLUN] = pDrv;
    35273574            pThis->cLUNs++;
     
    35403587    RTStrFree(pszDesc);
    35413588
    3542     LogFlowFunc(("iLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc));
     3589    LogFunc(("iLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc));
    35433590    return rc;
    35443591}
  • trunk/src/VBox/Devices/Audio/DevIchHdaCodec.cpp

    r53442 r53567  
    23052305        case PI_INDEX:
    23062306#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    2307             /* old and new stream settings are not same. Then only call open */
    2308             //if (!hdaCodecCompareAudioSettings(&(pThis->SwVoiceIn)->info, pAudioSettings) && !pThis->SwVoiceIn)
    23092307                rc = pThis->pfnOpenIn(pThis->pHDAState, "hda.in",
    23102308                                      PDMAUDIORECSOURCE_LINE_IN, pCfg);
     
    23252323
    23262324#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     2325# ifdef VBOX_WITH_HDA_MIC_IN
    23272326        case MC_INDEX:
    2328             /* old and new stream settings are not same. Then only call open */
    2329             //if (!hdaCodecCompareAudioSettings(&(pThis->SwVoiceIn)->info, pAudioSettings) && !pThis->SwVoiceIn)
    2330                 rc = pThis->pfnOpenIn(pThis->pHDAState, "hda.mc",
    2331                                       PDMAUDIORECSOURCE_MIC, pCfg);
    2332             break;
     2327            rc = pThis->pfnOpenIn(pThis->pHDAState, "hda.mc",
     2328                                  PDMAUDIORECSOURCE_MIC, pCfg);
     2329            break;
     2330# endif
    23332331#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
    23342332
     
    24812479    hdaCodecOpenStream(pThis, PI_INDEX, &as);
    24822480    hdaCodecOpenStream(pThis, PO_INDEX, &as);
     2481#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     2482# ifdef VBOX_WITH_HDA_MIC_IN
     2483    hdaCodecOpenStream(pThis, MC_INDEX, &as);
     2484# endif
     2485#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
    24832486
    24842487    pThis->paNodes[1].node.au32F00_param[0xA] |= CODEC_F00_0A_44_1KHZ;
     
    24942497    hdaCodecToAudVolume(pThis, &pThis->paNodes[pThis->u8DacLineOut].dac.B_params, PDMAUDIOMIXERCTL_VOLUME);
    24952498    hdaCodecToAudVolume(pThis, &pThis->paNodes[pThis->u8AdcVolsLineIn].adcvol.B_params, PDMAUDIOMIXERCTL_LINE_IN);
     2499
     2500
    24962501#else
    24972502    hdaCodecToAudVolume(&pThis->paNodes[pThis->u8DacLineOut].dac.B_params, AUD_MIXER_VOLUME);
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r53442 r53567  
    573573        if (RT_FAILURE(rc))
    574574        {
    575             LogFlowFunc(("Initializing host driver failed with rc=%Rrc\n", rc));
     575            LogFlowFunc(("Initializing host backend failed with rc=%Rrc\n", rc));
    576576            break;
    577577        }
     
    682682    if (RT_FAILURE(rc))
    683683    {
    684         LogFlowFunc(("Failed to add host audio input stream, rc=%Rrc\n", rc));
     684        LogFunc(("Failed to add host audio input stream \"%s\", rc=%Rrc\n",
     685                 pszName, rc));
    685686
    686687        RTMemFree(pGstStrmIn);
     
    876877    if (RT_SUCCESS(rc))
    877878    {
     879        /* Return the number of samples which actually have been mixed
     880         * down to the parent, regardless how much samples were written
     881         * into the children buffer. */
    878882        if (pcbWritten)
    879883            *pcbWritten = AUDIOMIXBUF_S2B(&pGstStrmOut->MixBuf, cMixed);
     
    993997            cSamplesLive = 0;
    994998
    995         /* Has this steam marked as disabled but there still were guest streams relying
     999        /* Has this stream marked as disabled but there still were guest streams relying
    9961000         * on it? Check if this stream now can be closed and do so, if possible. */
    9971001        if (   pHstStrmOut->fPendingDisable
     
    15891593}
    15901594
    1591 static DECLCALLBACK(bool) drvAudioIsInputOK(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn)
    1592 {
    1593     if (pGstStrmIn == NULL)
    1594         return false;
    1595 
    1596     return true;
    1597 }
    1598 
    1599 static DECLCALLBACK(bool) drvAudioIsOutputOK(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut)
    1600 {
    1601     if (pGstStrmOut == NULL)
    1602         return false;
    1603 
    1604     return true;
     1595static DECLCALLBACK(bool) drvAudioIsInputOK(PPDMIAUDIOCONNECTOR pInterface,
     1596                                            PPDMAUDIOGSTSTRMIN  pGstStrmIn)
     1597{
     1598    return (pGstStrmIn != NULL);
     1599}
     1600
     1601static DECLCALLBACK(bool) drvAudioIsOutputOK(PPDMIAUDIOCONNECTOR pInterface,
     1602                                             PPDMAUDIOGSTSTRMOUT pGstStrmOut)
     1603{
     1604    return (pGstStrmOut != NULL);
    16051605}
    16061606
     
    16151615    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
    16161616    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
     1617    AssertPtrReturn(ppGstStrmIn, VERR_INVALID_POINTER);
    16171618
    16181619    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
     
    16791680    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
    16801681    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
     1682    AssertPtrReturn(ppGstStrmOut, VERR_INVALID_POINTER);
    16811683
    16821684    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
     
    17001702
    17011703#if 0
     1704    /* Any live samples that need to be updated after
     1705     * we set the new parameters? */
    17021706    PPDMAUDIOGSTSTRMOUT pOldGstStrmOut = NULL;
    17031707    uint32_t cLiveSamples = 0;
     
    17241728    }
    17251729
     1730    int rc;
    17261731    if (pGstStrmOut)
    17271732    {
     
    17311736        drvAudioGstOutFreeRes(pGstStrmOut);
    17321737
    1733         int rc2 = drvAudioGstOutInit(pGstStrmOut, pHstStrmOut, pszName, pCfg);
    1734         if (RT_FAILURE(rc2))
    1735             return rc2;
     1738        rc = drvAudioGstOutInit(pGstStrmOut, pHstStrmOut, pszName, pCfg);
    17361739    }
    17371740    else
    17381741    {
    1739         int rc2 = drvAudioCreateStreamPairOut(pThis, pszName, pCfg, &pGstStrmOut);
    1740         if (RT_FAILURE(rc2))
    1741         {
    1742             LogFunc(("Failed to create output stream \"%s\", rc=%Rrc\n", pszName, rc2));
    1743             return rc2;
    1744         }
    1745     }
    1746 
    1747     if (pGstStrmOut)
    1748     {
    1749         pGstStrmOut->State.uVolumeLeft = nominal_volume.l;
     1742        rc = drvAudioCreateStreamPairOut(pThis, pszName, pCfg, &pGstStrmOut);
     1743        if (RT_FAILURE(rc))
     1744            LogFunc(("Failed to create output stream \"%s\", rc=%Rrc\n", pszName, rc));
     1745    }
     1746
     1747    if (RT_SUCCESS(rc))
     1748    {
     1749        AssertPtr(pGstStrmOut);
     1750        pGstStrmOut->State.uVolumeLeft  = nominal_volume.l;
    17501751        pGstStrmOut->State.uVolumeRight = nominal_volume.r;
    1751         pGstStrmOut->State.fMuted = RT_BOOL(nominal_volume.mute);
    1752         pGstStrmOut->Callback.fn = fnCallback;
     1752        pGstStrmOut->State.fMuted       = RT_BOOL(nominal_volume.mute);
     1753        pGstStrmOut->Callback.fn        = fnCallback;
    17531754        pGstStrmOut->Callback.pvContext = pvCallback;
    17541755
     1756        *ppGstStrmOut = pGstStrmOut;
    17551757#if 0
     1758        /* Update remaining live samples with new rate. */
    17561759        if (cLiveSamples)
    17571760        {
     
    17661769        }
    17671770#endif
    1768     }
    1769 
    1770     *ppGstStrmOut = pGstStrmOut;
    1771 
    1772     return VINF_SUCCESS;
     1771    }   
     1772
     1773    LogFlowFuncLeaveRC(rc);
     1774    return rc;
    17731775}
    17741776
  • trunk/src/VBox/Devices/Audio/DrvHostOSSAudio.cpp

    r53562 r53567  
    213213    if (close(*phFile))
    214214    {
    215         LogRel(("Audio: Closing descriptor failed: %s\n",
     215        LogRel(("OSS: Closing descriptor failed: %s\n",
    216216                strerror(errno)));
    217217        rc = VERR_GENERAL_FAILURE; /** @todo */
     
    242242        if (!pszDev)
    243243        {
    244             LogRel(("Audio: Invalid or no %s device name set\n",
     244            LogRel(("OSS: Invalid or no %s device name set\n",
    245245                    fIn ? "input" : "output"));
    246246            rc = VERR_INVALID_PARAMETER;
     
    251251        if (hFile == -1)
    252252        {
    253             LogRel(("Audio: Failed to open %s: %s\n", pszDev, strerror(errno)));
     253            LogRel(("OSS: Failed to open %s: %s\n", pszDev, strerror(errno)));
    254254            rc = RTErrConvertFromErrno(errno);
    255255            break;
     
    259259        if (ioctl(hFile, SNDCTL_DSP_SAMPLESIZE, &iFormat))
    260260        {
    261             LogRel(("Audio: Failed to set audio format to %ld\n",
     261            LogRel(("OSS: Failed to set audio format to %ld\n",
    262262                    iFormat, strerror(errno)));
    263263            rc = RTErrConvertFromErrno(errno);
     
    268268        if (ioctl(hFile, SNDCTL_DSP_CHANNELS, &cChannels))
    269269        {
    270             LogRel(("Audio: Failed to set number of audio channels (%d): %s\n",
     270            LogRel(("OSS: Failed to set number of audio channels (%d): %s\n",
    271271                     pReq->cChannels, strerror(errno)));
    272272            rc = RTErrConvertFromErrno(errno);
     
    277277        if (ioctl(hFile, SNDCTL_DSP_SPEED, &freq))
    278278        {
    279             LogRel(("Audio: Failed to set audio frequency (%dHZ): %s\n",
     279            LogRel(("OSS: Failed to set audio frequency (%dHZ): %s\n",
    280280                    pReq->uFreq, strerror(errno)));
    281281            rc = RTErrConvertFromErrno(errno);
     
    287287        if (ioctl(hFile, SNDCTL_DSP_NONBLOCK))
    288288        {
    289             LogRel(("Audio: Failed to set non-blocking mode: %s\n",
     289            LogRel(("OSS: Failed to set non-blocking mode: %s\n",
    290290                    strerror(errno)));
    291291            rc = RTErrConvertFromErrno(errno);
     
    296296        if (ioctl(hFile, SNDCTL_DSP_SETFRAGMENT, &mmmmssss))
    297297        {
    298             LogRel(("Audio: Failed to set %RU16 fragments to %RU32 bytes each: %s\n",
     298            LogRel(("OSS: Failed to set %RU16 fragments to %RU32 bytes each: %s\n",
    299299                    pReq->cFragments, pReq->cbFragmentSize, strerror(errno)));
    300300            rc = RTErrConvertFromErrno(errno);
     
    306306                  &abinfo))
    307307        {
    308             LogRel(("Audio: Failed to retrieve buffer length: %s\n", strerror(errno)));
     308            LogRel(("OSS: Failed to retrieve buffer length: %s\n", strerror(errno)));
    309309            rc = RTErrConvertFromErrno(errno);
    310310            break;
     
    370370            if (ioctl(pThisStrmOut->hFile, SNDCTL_DSP_SETTRIGGER, &mask) < 0)
    371371            {
    372                 LogRel(("Audio: Failed to enable output stream: %s\n",
     372                LogRel(("OSS: Failed to enable output stream: %s\n",
    373373                        strerror(errno)));
    374374                rc = RTErrConvertFromErrno(errno);
     
    383383            if (ioctl(pThisStrmOut->hFile, SNDCTL_DSP_SETTRIGGER, &mask) < 0)
    384384            {
    385                 LogRel(("Audio: Failed to disable output stream: %s\n",
     385                LogRel(("OSS: Failed to disable output stream: %s\n",
    386386                       strerror(errno)));
    387387                rc = RTErrConvertFromErrno(errno);
     
    588588        {
    589589            if (obtStream.cFragments * obtStream.cbFragmentSize & pHstStrmIn->Props.uAlign)
    590                 LogRel(("Audio: Warning: Misaligned DAC output buffer: Size = %zu, Alignment = %u\n",
     590                LogRel(("OSS: Warning: Misaligned DAC output buffer: Size = %zu, Alignment = %u\n",
    591591                        obtStream.cFragments * obtStream.cbFragmentSize,
    592592                        pHstStrmIn->Props.uAlign + 1));
     
    616616            if (!pThisStrmIn->pvBuf)
    617617            {
    618                 LogRel(("Audio: Failed allocating ADC buffer with %RU32 samples, each %d bytes\n",
     618                LogRel(("OSS: Failed allocating ADC buffer with %RU32 samples, each %d bytes\n",
    619619                        cSamples, 1 << pHstStrmIn->Props.cShift));
    620620                rc = VERR_NO_MEMORY;
     
    665665        {
    666666            if (obtStream.cFragments * obtStream.cbFragmentSize & pHstStrmOut->Props.uAlign)
    667                 LogRel(("Audio: Warning: Misaligned DAC output buffer: Size = %zu, Alignment = %u\n",
     667                LogRel(("OSS: Warning: Misaligned DAC output buffer: Size = %zu, Alignment = %u\n",
    668668                        obtStream.cFragments * obtStream.cbFragmentSize,
    669669                        pHstStrmOut->Props.uAlign + 1));
     
    693693                if (pThisStrmOut->pvPCMBuf == MAP_FAILED)
    694694                {
    695                     LogRel(("Audio: Failed to memory map %zu bytes of DAC output file: %s\n",
     695                    LogRel(("OSS: Failed to memory map %zu bytes of DAC output file: %s\n",
    696696                            cSamples << pHstStrmOut->Props.cShift, strerror(errno)));
    697697                    rc = RTErrConvertFromErrno(errno);
     
    703703                    if (ioctl(hFile, SNDCTL_DSP_SETTRIGGER, &mask) < 0)
    704704                    {
    705                         LogRel(("Audio: Failed to retrieve initial trigger mask: %s\n",
     705                        LogRel(("OSS: Failed to retrieve initial trigger mask: %s\n",
    706706                                strerror(errno)));
    707707                        rc = RTErrConvertFromErrno(errno);
     
    713713                        if (ioctl (hFile, SNDCTL_DSP_SETTRIGGER, &mask) < 0)
    714714                        {
    715                             LogRel(("Audio: Failed to retrieve PCM_ENABLE_OUTPUT mask: %s\n",
    716                                 strerror(errno)));
     715                            LogRel(("OSS: Failed to retrieve PCM_ENABLE_OUTPUT mask: %s\n",
     716                                    strerror(errno)));
    717717                            rc = RTErrConvertFromErrno(errno);
    718718                            /* Note: No break here, need to unmap file first! */
     
    727727                                         cSamples << pHstStrmOut->Props.cShift);
    728728                        if (rc2)
    729                             LogRel(("Audio: Failed to unmap DAC output file: %s\n",
     729                            LogRel(("OSS: Failed to unmap DAC output file: %s\n",
    730730                                    strerror(errno)));
    731731
     
    745745                if (!pThisStrmOut->pvPCMBuf)
    746746                {
    747                     LogRel(("Audio: Failed allocating DAC buffer with %RU32 samples, each %d bytes\n",
     747                    LogRel(("OSS: Failed allocating DAC buffer with %RU32 samples, each %d bytes\n",
    748748                            cSamples, 1 << pHstStrmOut->Props.cShift));
    749749                    rc = VERR_NO_MEMORY;
     
    793793            if (!rc2)
    794794            {
    795                 LogRel(("Audio: Failed to retrieve current playback pointer: %s\n",
     795                LogRel(("OSS: Failed to retrieve current playback pointer: %s\n",
    796796                        strerror(errno)));
    797797                rc = RTErrConvertFromErrno(errno);
     
    820820            if (rc2 < 0)
    821821            {
    822                 LogRel(("Audio: Failed to retrieve current playback buffer: %s\n",
     822                LogRel(("OSS: Failed to retrieve current playback buffer: %s\n",
    823823                        strerror(errno)));
    824824                rc = RTErrConvertFromErrno(errno);
     
    865865            if (cbWritten == -1)
    866866            {
    867                 LogRel(("Audio: Failed writing output data %s\n", strerror(errno)));
     867                LogRel(("OSS: Failed writing output data %s\n", strerror(errno)));
    868868                rc = RTErrConvertFromErrno(errno);
    869869                break;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette