VirtualBox

Changeset 59470 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 26, 2016 11:32:46 AM (9 years ago)
Author:
vboxsync
Message:

Audio: Warn on non-available audio streams based on the host audio backend's capabilities -- now the device emulation can ask the backend for its configuration to figure out how many input/output streams are supported by that backend. As the device emulation knows how many channels it finally implements, we there then can decide how to deal with the missing streams.

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

Legend:

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

    r59376 r59470  
    22392239    }
    22402240    else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
    2241     {
    22422241        LogFunc(("No attached driver for LUN #%u\n", uLUN));
    2243     }
    2244     else if (RT_FAILURE(rc))
    2245         AssertMsgFailed(("Failed to attach AC'97 LUN #%u (\"%s\"), rc=%Rrc\n",
    2246                         uLUN, pszDesc, rc));
    22472242
    22482243    if (RT_FAILURE(rc))
     
    25392534            AssertPtr(pCon);
    25402535
    2541             uint8_t cFailed = 0;
    2542             if (!pCon->pfnIsValidIn (pCon, pDrv->LineIn.pStrmIn))
    2543                 cFailed++;
    2544             if (!pCon->pfnIsValidIn (pCon, pDrv->MicIn.pStrmIn))
    2545                 cFailed++;
    2546             if (!pCon->pfnIsValidOut(pCon, pDrv->Out.pStrmOut))
    2547                 cFailed++;
    2548 
    2549             if (cFailed == 3)
     2536            bool fValidLineIn = pCon->pfnIsValidIn(pCon, pDrv->LineIn.pStrmIn);
     2537            bool fValidMicIn  = pCon->pfnIsValidIn (pCon, pDrv->MicIn.pStrmIn);
     2538            bool fValidOut    = pCon->pfnIsValidOut(pCon, pDrv->Out.pStrmOut);
     2539
     2540            if (    !fValidLineIn
     2541                 && !fValidMicIn
     2542                 && !fValidOut)
    25502543            {
    25512544                LogRel(("AC97: Falling back to NULL backend (no sound audible)\n"));
     
    25582551                       "with the consequence that no sound is audible"));
    25592552            }
    2560             else if (cFailed)
     2553            else
    25612554            {
    2562                 if (!pDrv->pConnector->pfnIsValidIn (pCon, pDrv->LineIn.pStrmIn))
    2563                     LogRel(("AC97: WARNING: Unable to open PCM line input for LUN #%RU32!\n",       pDrv->uLUN));
    2564                 if (!pDrv->pConnector->pfnIsValidIn (pCon, pDrv->MicIn.pStrmIn))
    2565                     LogRel(("AC97: WARNING: Unable to open PCM microphone input for LUN #%RU32!\n", pDrv->uLUN));
    2566                 if (!pDrv->pConnector->pfnIsValidOut(pCon, pDrv->Out.pStrmOut))
    2567                     LogRel(("AC97: WARNING: Unable to open PCM output for LUN #%RU32!\n",           pDrv->uLUN));
    2568 
    2569                 char   szMissingStreams[255];
    2570                 size_t len = 0;
    2571                 if (!pCon->pfnIsValidIn (pCon, pDrv->LineIn.pStrmIn))
    2572                     len = RTStrPrintf(szMissingStreams,
    2573                                       sizeof(szMissingStreams), "PCM Input");
    2574                 if (!pCon->pfnIsValidIn (pCon, pDrv->MicIn.pStrmIn))
    2575                     len += RTStrPrintf(szMissingStreams + len,
    2576                                        sizeof(szMissingStreams) - len, len ? ", PCM Microphone" : "PCM Microphone");
    2577                 if (!pCon->pfnIsValidOut(pCon, pDrv->Out.pStrmOut))
    2578                     len += RTStrPrintf(szMissingStreams + len,
    2579                                        sizeof(szMissingStreams) - len, len ? ", PCM Output" : "PCM Output");
    2580 
    2581                 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
    2582                     N_("Some AC'97 audio streams (%s) could not be opened. Guest applications generating audio "
    2583                     "output or depending on audio input may hang. Make sure your host audio device "
    2584                     "is working properly. Check the logfile for error messages of the audio "
    2585                     "subsystem"), szMissingStreams);
     2555                bool fWarn = false;
     2556
     2557                PDMAUDIOBACKENDCFG backendCfg;
     2558                int rc2 = pCon->pfnGetConfiguration(pCon, &backendCfg);
     2559                if (RT_SUCCESS(rc2))
     2560                {
     2561                    if (backendCfg.cMaxHstStrmsIn)
     2562                    {
     2563                        /* If the audio backend supports two or more input streams at once,
     2564                         * warn if one of our two inputs (microphone-in and line-in) failed to initialize. */
     2565                        if (backendCfg.cMaxHstStrmsIn >= 2)
     2566                            fWarn = !fValidLineIn || !fValidMicIn;
     2567                        /* If the audio backend only supports one input stream at once (e.g. pure ALSA, and
     2568                         * *not* ALSA via PulseAudio plugin!), only warn if both of our inputs failed to initialize.
     2569                         * One of the two simply is not in use then. */
     2570                        else if (backendCfg.cMaxHstStrmsIn == 1)
     2571                            fWarn = !fValidLineIn && !fValidMicIn;
     2572                        /* Don't warn if our backend is not able of supporting any input streams at all. */
     2573                    }
     2574
     2575                    if (   !fWarn
     2576                        && backendCfg.cMaxHstStrmsOut)
     2577                    {
     2578                        fWarn = !fValidOut;
     2579                    }
     2580                }
     2581                else
     2582                    AssertReleaseMsgFailed(("Unable to retrieve audio backend configuration for LUN #%RU8, rc=%Rrc\n",
     2583                                            pDrv->uLUN, rc2));
     2584
     2585                if (fWarn)
     2586                {
     2587                    char   szMissingStreams[255];
     2588                    size_t len = 0;
     2589                    if (!fValidLineIn)
     2590                    {
     2591                        LogRel(("AC97: WARNING: Unable to open PCM line input for LUN #%RU8!\n", pDrv->uLUN));
     2592                        len = RTStrPrintf(szMissingStreams, sizeof(szMissingStreams), "PCM Input");
     2593                    }
     2594                    if (!fValidMicIn)
     2595                    {
     2596                        LogRel(("AC97: WARNING: Unable to open PCM microphone input for LUN #%RU8!\n", pDrv->uLUN));
     2597                        len += RTStrPrintf(szMissingStreams + len,
     2598                                           sizeof(szMissingStreams) - len, len ? ", PCM Microphone" : "PCM Microphone");
     2599                    }
     2600                    if (!fValidOut)
     2601                    {
     2602                        LogRel(("AC97: WARNING: Unable to open PCM output for LUN #%RU8!\n", pDrv->uLUN));
     2603                        len += RTStrPrintf(szMissingStreams + len,
     2604                                           sizeof(szMissingStreams) - len, len ? ", PCM Output" : "PCM Output");
     2605                    }
     2606
     2607                    PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
     2608                                               N_("Some AC'97 audio streams (%s) could not be opened. Guest applications generating audio "
     2609                                                  "output or depending on audio input may hang. Make sure your host audio device "
     2610                                                  "is working properly. Check the logfile for error messages of the audio "
     2611                                                  "subsystem"), szMissingStreams);
     2612                }
    25862613            }
    25872614        }
  • trunk/src/VBox/Devices/Audio/DevIchHda.cpp

    r59457 r59470  
    44194419    }
    44204420    else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
    4421     {
    44224421        LogFunc(("No attached driver for LUN #%u\n", uLUN));
    4423     }
    4424     else if (RT_FAILURE(rc))
    4425         AssertMsgFailed(("Failed to attach HDA LUN #%u (\"%s\"), rc=%Rrc\n",
    4426                         uLUN, pszDesc, rc));
    44274422
    44284423    if (RT_FAILURE(rc))
     
    47834778            AssertPtr(pCon);
    47844779
    4785             uint8_t cFailed = 0;
    4786             if (!pCon->pfnIsValidIn (pCon, pDrv->LineIn.pStrmIn))
    4787                 cFailed++;
     4780            bool fValidLineIn = pCon->pfnIsValidIn(pCon, pDrv->LineIn.pStrmIn);
    47884781#ifdef VBOX_WITH_HDA_MIC_IN
    4789             if (!pCon->pfnIsValidIn (pCon, pDrv->MicIn.pStrmIn))
    4790                 cFailed++;
    4791 #endif
    4792             if (!pCon->pfnIsValidOut(pCon, pDrv->Out.pStrmOut))
    4793                 cFailed++;
    4794 
     4782            bool fValidMicIn  = pCon->pfnIsValidIn (pCon, pDrv->MicIn.pStrmIn);
     4783#endif
     4784            bool fValidOut    = pCon->pfnIsValidOut(pCon, pDrv->Out.pStrmOut);
     4785
     4786            if (    !fValidLineIn
    47954787#ifdef VBOX_WITH_HDA_MIC_IN
    4796             if (cFailed == 3)
    4797 #else
    4798             if (cFailed == 2)
    4799 #endif
     4788                 && !fValidMicIn
     4789#endif
     4790                 && !fValidOut)
    48004791            {
    48014792                LogRel(("HDA: Falling back to NULL backend (no sound audible)\n"));
     
    48084799                       "with the consequence that no sound is audible"));
    48094800            }
    4810             else if (cFailed)
     4801            else
    48114802            {
    4812                 if (!pDrv->pConnector->pfnIsValidIn (pDrv->pConnector, pDrv->LineIn.pStrmIn))
    4813                     LogRel(("HDA: WARNING: Unable to open PCM line input for LUN #%RU32!\n",       pDrv->uLUN));
     4803                bool fWarn = false;
     4804
     4805                PDMAUDIOBACKENDCFG backendCfg;
     4806                int rc2 = pCon->pfnGetConfiguration(pCon, &backendCfg);
     4807                if (RT_SUCCESS(rc2))
     4808                {
     4809                    if (backendCfg.cMaxHstStrmsIn)
     4810                    {
    48144811#ifdef VBOX_WITH_HDA_MIC_IN
    4815                 if (!pDrv->pConnector->pfnIsValidIn (pDrv->pConnector, pDrv->MicIn.pStrmIn))
    4816                     LogRel(("HDA: WARNING: Unable to open PCM microphone input for LUN #%RU32!\n", pDrv->uLUN));
    4817 #endif
    4818                 if (!pDrv->pConnector->pfnIsValidOut(pDrv->pConnector, pDrv->Out.pStrmOut))
    4819                     LogRel(("HDA: WARNING: Unable to open PCM output for LUN #%RU32!\n",           pDrv->uLUN));
    4820 
    4821                 char   szMissingStreams[255];
    4822                 size_t len = 0;
    4823                 if (!pCon->pfnIsValidIn (pCon, pDrv->LineIn.pStrmIn))
    4824                     len = RTStrPrintf(szMissingStreams,
    4825                                       sizeof(szMissingStreams), "PCM Input");
     4812                        /* If the audio backend supports two or more input streams at once,
     4813                         * warn if one of our two inputs (microphone-in and line-in) failed to initialize. */
     4814                        if (backendCfg.cMaxHstStrmsIn >= 2)
     4815                            fWarn = !fValidLineIn || !fValidMicIn;
     4816                        /* If the audio backend only supports one input stream at once (e.g. pure ALSA, and
     4817                         * *not* ALSA via PulseAudio plugin!), only warn if both of our inputs failed to initialize.
     4818                         * One of the two simply is not in use then. */
     4819                        else if (backendCfg.cMaxHstStrmsIn == 1)
     4820                            fWarn = !fValidLineIn && !fValidMicIn;
     4821                        /* Don't warn if our backend is not able of supporting any input streams at all. */
     4822#else
     4823                        /* We only have line-in as input source. */
     4824                        fWarn = !fValidLineIn;
     4825#endif
     4826                    }
     4827
     4828                    if (   !fWarn
     4829                        && backendCfg.cMaxHstStrmsOut)
     4830                    {
     4831                        fWarn = !fValidOut;
     4832                    }
     4833                }
     4834                else
     4835                    AssertReleaseMsgFailed(("Unable to retrieve audio backend configuration for LUN #%RU8, rc=%Rrc\n",
     4836                                            pDrv->uLUN, rc2));
     4837
     4838                if (fWarn)
     4839                {
     4840                    char   szMissingStreams[255];
     4841                    size_t len = 0;
     4842                    if (!fValidLineIn)
     4843                    {
     4844                        LogRel(("HDA: WARNING: Unable to open PCM line input for LUN #%RU8!\n", pDrv->uLUN));
     4845                        len = RTStrPrintf(szMissingStreams, sizeof(szMissingStreams), "PCM Input");
     4846                    }
    48264847#ifdef VBOX_WITH_HDA_MIC_IN
    4827                 if (!pCon->pfnIsValidIn (pCon, pDrv->MicIn.pStrmIn))
    4828                     len += RTStrPrintf(szMissingStreams + len,
    4829                                        sizeof(szMissingStreams) - len, len ? ", PCM Microphone" : "PCM Microphone");
    4830 #endif
    4831                 if (!pCon->pfnIsValidOut(pCon, pDrv->Out.pStrmOut))
    4832                     len += RTStrPrintf(szMissingStreams + len,
    4833                                        sizeof(szMissingStreams) - len, len ? ", PCM Output" : "PCM Output");
    4834 
    4835                 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
    4836                     N_("Some HDA audio streams (%s) could not be opened. Guest applications generating audio "
    4837                     "output or depending on audio input may hang. Make sure your host audio device "
    4838                     "is working properly. Check the logfile for error messages of the audio "
    4839                     "subsystem"), szMissingStreams);
     4848                    if (!fValidMicIn)
     4849                    {
     4850                        LogRel(("HDA: WARNING: Unable to open PCM microphone input for LUN #%RU8!\n", pDrv->uLUN));
     4851                        len += RTStrPrintf(szMissingStreams + len,
     4852                                           sizeof(szMissingStreams) - len, len ? ", PCM Microphone" : "PCM Microphone");
     4853                    }
     4854#endif
     4855                    if (!fValidOut)
     4856                    {
     4857                        LogRel(("HDA: WARNING: Unable to open PCM output for LUN #%RU8!\n", pDrv->uLUN));
     4858                        len += RTStrPrintf(szMissingStreams + len,
     4859                                           sizeof(szMissingStreams) - len, len ? ", PCM Output" : "PCM Output");
     4860                    }
     4861
     4862                    PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
     4863                                               N_("Some HDA audio streams (%s) could not be opened. Guest applications generating audio "
     4864                                                  "output or depending on audio input may hang. Make sure your host audio device "
     4865                                                  "is working properly. Check the logfile for error messages of the audio "
     4866                                                  "subsystem"), szMissingStreams);
     4867                }
    48404868            }
    48414869        }
  • trunk/src/VBox/Devices/Audio/DevSB16.cpp

    r59376 r59470  
    23172317        AssertPtr(pCon);
    23182318
    2319         uint8_t cFailed = 0;
    2320         if (!pCon->pfnIsValidOut(pCon, pDrv->Out.pStrmOut))
    2321             cFailed++;
    2322 
    2323         if (cFailed)
     2319        /* Note: No input streams available for SB16 yet. */
     2320        bool fValidOut = pCon->pfnIsValidOut(pCon, pDrv->Out.pStrmOut);
     2321        if (fValidOut)
    23242322        {
    23252323            LogRel(("SB16: Falling back to NULL backend (no sound audible)\n"));
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r59420 r59470  
    88
    99/*
    10  * Copyright (C) 2006-2015 Oracle Corporation
     10 * Copyright (C) 2006-2016 Oracle Corporation
    1111 *
    1212 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    16361636
    16371637    uint32_t cMaxHstStrmsOut = pThis->BackendCfg.cMaxHstStrmsOut;
    1638     uint32_t cbHstStrmsOut = pThis->BackendCfg.cbStreamOut;
     1638    uint32_t cbHstStrmsOut   = pThis->BackendCfg.cbStreamOut;
    16391639
    16401640    if (cbHstStrmsOut)
    16411641    {
    1642         pThis->cFreeOutputStreams = 1; /** @todo Make this configurable. */
    1643         if (pThis->cFreeOutputStreams > cMaxHstStrmsOut)
    1644         {
    1645             LogRel(("Audio: Warning: %RU32 output streams were requested, host driver only supports %RU32\n",
    1646                     pThis->cFreeOutputStreams, cMaxHstStrmsOut));
    1647             pThis->cFreeOutputStreams = cMaxHstStrmsOut;
    1648         }
     1642        pThis->cFreeOutputStreams = cMaxHstStrmsOut;
    16491643    }
    16501644    else
     
    16521646
    16531647    uint32_t cMaxHstStrmsIn = pThis->BackendCfg.cMaxHstStrmsIn;
    1654     uint32_t cbHstStrmIn = pThis->BackendCfg.cbStreamIn;
     1648    uint32_t cbHstStrmIn    = pThis->BackendCfg.cbStreamIn;
    16551649
    16561650    if (cbHstStrmIn)
     
    16581652        /*
    16591653         * Note:
    1660          *  - Our AC'97 emulation has two inputs, line (P.IN) and microphone (P.MIC).
    1661          ** @todo Document HDA.
     1654         *  - Our AC'97 emulation has two inputs, line (ac97.pi) and microphone (ac97.mc).
     1655         *  - Our HDA emulation currently has only line input (hda.pi).
    16621656         */
    1663         pThis->cFreeInputStreams = 2; /** @todo Make this configurable. */
    1664         if (pThis->cFreeInputStreams > cMaxHstStrmsIn)
    1665         {
    1666             LogRel(("Audio: Warning: %RU32 input streams were requested, host driver only supports %RU32\n",
    1667                     pThis->cFreeInputStreams, cMaxHstStrmsIn));
    1668             pThis->cFreeInputStreams = cMaxHstStrmsIn;
    1669         }
     1657        pThis->cFreeInputStreams = cMaxHstStrmsIn;
    16701658    }
    16711659    else
     
    16771665    LogFlowFunc(("cFreeInputStreams=%RU8, cFreeOutputStreams=%RU8\n",
    16781666                 pThis->cFreeInputStreams, pThis->cFreeOutputStreams));
     1667
     1668    LogRel(("Audio: Host audio backend supports %RU32 output streams and %RU32 input streams at once\n",
     1669            /* Clamp for logging. Unlimited streams are defined by UINT32_MAX. */
     1670            RT_MIN(64, cMaxHstStrmsOut), RT_MIN(64, cMaxHstStrmsIn)));
    16791671
    16801672    LogFlowFuncLeave();
     
    20312023        rc = drvAudioCreateStreamPairIn(pThis, pszName, enmRecSource, pCfg, &pGstStrmIn);
    20322024
    2033     if (pGstStrmIn)
    2034         *ppGstStrmIn = pGstStrmIn;
     2025    if (RT_SUCCESS(rc))
     2026    {
     2027        if (pGstStrmIn)
     2028            *ppGstStrmIn = pGstStrmIn;
     2029    }
     2030    else
     2031    {
     2032        switch (rc)
     2033        {
     2034            case VERR_NO_MORE_HANDLES: /** @todo Find a better rc. */
     2035                LogRel(("Audio: Skipping to create input stream \"%s\", " \
     2036                        "as the host audio backend reached its maximum of concurrent audio input streams\n", pszName));
     2037                break;
     2038
     2039            default:
     2040                break;
     2041        }
     2042    }
    20352043
    20362044    int rc2 = RTCritSectLeave(&pThis->CritSect);
     
    21282136    if (RT_SUCCESS(rc))
    21292137    {
    2130         AssertPtr(pGstStrmOut);
    2131         *ppGstStrmOut = pGstStrmOut;
     2138        if (pGstStrmOut)
     2139            *ppGstStrmOut = pGstStrmOut;
    21322140#if 0
    21332141        /* Update remaining live samples with new rate. */
     
    21452153#endif
    21462154    }
     2155    else
     2156    {
     2157        switch (rc)
     2158        {
     2159            case VERR_NO_MORE_HANDLES: /** @todo Find a better rc. */
     2160                LogRel(("Audio: Skipping to create output stream \"%s\", " \
     2161                        "as the host audio backend reached its maximum of concurrent audio output streams\n", pszName));
     2162                break;
     2163
     2164            default:
     2165                break;
     2166        }
     2167    }
     2168
     2169    int rc2 = RTCritSectLeave(&pThis->CritSect);
     2170    if (RT_SUCCESS(rc))
     2171        rc = rc2;
     2172
     2173    LogFlowFuncLeaveRC(rc);
     2174    return rc;
     2175}
     2176
     2177static DECLCALLBACK(int) drvAudioGetConfiguration(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOBACKENDCFG pCfg)
     2178{
     2179    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
     2180    AssertPtrReturn(pCfg,       VERR_INVALID_POINTER);
     2181
     2182    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
     2183
     2184    int rc = RTCritSectEnter(&pThis->CritSect);
     2185    if (RT_FAILURE(rc))
     2186        return rc;
     2187
     2188    memcpy(pCfg, &pThis->BackendCfg, sizeof(PDMAUDIOBACKENDCFG));
    21472189
    21482190    int rc2 = RTCritSectLeave(&pThis->CritSect);
     
    23102352    pThis->IAudioConnector.pfnRead                   = drvAudioRead;
    23112353    pThis->IAudioConnector.pfnWrite                  = drvAudioWrite;
     2354    pThis->IAudioConnector.pfnGetConfiguration       = drvAudioGetConfiguration;
    23122355    pThis->IAudioConnector.pfnIsActiveIn             = drvAudioIsActiveIn;
    23132356    pThis->IAudioConnector.pfnIsActiveOut            = drvAudioIsActiveOut;
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r59420 r59470  
    9494    /** List of host output streams. */
    9595    RTLISTANCHOR            lstHstStrmOut;
    96     /** Max. number of free input streams. */
    97     uint8_t                 cFreeInputStreams;
    98     /** Max. number of free output streams. */
    99     uint8_t                 cFreeOutputStreams;
     96    /** Max. number of free input streams.
     97     *  UINT32_MAX for unlimited streams. */
     98    uint32_t                cFreeInputStreams;
     99    /** Max. number of free output streams.
     100     *  UINT32_MAX for unlimited streams. */
     101    uint32_t                cFreeOutputStreams;
    100102    /** Audio configuration settings retrieved from the backend. */
    101103    PDMAUDIOBACKENDCFG      BackendCfg;
  • trunk/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp

    r59375 r59470  
    171171    if (rc2)
    172172    {
    173         LogRel(("ALSA: Closing PCM descriptor failed: %s\n",
    174                  snd_strerror(rc2)));
     173        LogRel(("ALSA: Closing PCM descriptor failed: %s\n", snd_strerror(rc2)));
    175174        rc = VERR_GENERAL_FAILURE; /** @todo */
    176175    }
     
    386385        if (!pszDev)
    387386        {
    388             LogRel(("ALSA: Invalid or no %s device name set\n",
    389                     fIn ? "input" : "output"));
     387            LogRel(("ALSA: Invalid or no %s device name set\n", fIn ? "input" : "output"));
    390388            rc = VERR_INVALID_PARAMETER;
    391389            break;
     
    397395        if (err < 0)
    398396        {
    399             LogRel(("ALSA: Failed to open \"%s\" as %s: %s\n", pszDev,
    400                     fIn ? "ADC" : "DAC", snd_strerror(err)));
     397            LogRel(("ALSA: Failed to open \"%s\" as %s device: %s\n", pszDev, fIn ? "input" : "output", snd_strerror(err)));
    401398            rc = VERR_AUDIO_BACKEND_INIT_FAILED;
    402399            break;
    403400        }
     401
     402        LogRel(("ALSA: Using %s device \"%s\"\n", fIn ? "input" : "output", pszDev));
    404403
    405404        snd_pcm_hw_params_t *pHWParms;
     
    408407        if (err < 0)
    409408        {
    410             LogRel(("ALSA: Failed to initialize hardware parameters: %s\n",
    411                     snd_strerror(err)));
     409            LogRel(("ALSA: Failed to initialize hardware parameters: %s\n", snd_strerror(err)));
    412410            rc = VERR_AUDIO_BACKEND_INIT_FAILED;
    413411            break;
     
    426424        if (err < 0)
    427425        {
    428             LogRel(("ALSA: Failed to set audio format to %d: %s\n",
    429                     pCfgReq->fmt, snd_strerror(err)));
     426            LogRel(("ALSA: Failed to set audio format to %d: %s\n", pCfgReq->fmt, snd_strerror(err)));
    430427            rc = VERR_AUDIO_BACKEND_INIT_FAILED;
    431428            break;
     
    435432        if (err < 0)
    436433        {
    437             LogRel(("ALSA: Failed to set frequency to %dHz: %s\n",
    438                     pCfgReq->freq, snd_strerror(err)));
     434            LogRel(("ALSA: Failed to set frequency to %uHz: %s\n", pCfgReq->freq, snd_strerror(err)));
    439435            rc = VERR_AUDIO_BACKEND_INIT_FAILED;
    440436            break;
     
    706702    if (err < 0)
    707703    {
    708         LogFunc(("Failed to recover stream %p: %s\n",
    709                  phPCM, snd_strerror(err)));
     704        LogFunc(("Failed to recover stream %p: %s\n", phPCM, snd_strerror(err)));
    710705        return VERR_ACCESS_DENIED; /** @todo Find a better rc. */
    711706    }
     
    721716    if (err < 0)
    722717    {
    723         LogFunc(("Failed to resume stream %p: %s\n",
    724                  phPCM, snd_strerror(err)));
     718        LogFunc(("Failed to resume stream %p: %s\n", phPCM, snd_strerror(err)));
    725719        return VERR_ACCESS_DENIED; /** @todo Find a better rc. */
    726720    }
     
    737731        if (err < 0)
    738732        {
    739             LogFlow(("Error stopping stream %p: %s\n",
    740                      phPCM, snd_strerror(err)));
     733            LogRel(("ALSA: Error stopping stream %p: %s\n", phPCM, snd_strerror(err)));
    741734            return VERR_ACCESS_DENIED;
    742735        }
     
    744737    else
    745738    {
    746         err = snd_pcm_prepare (phPCM);
     739        err = snd_pcm_prepare(phPCM);
    747740        if (err < 0)
    748741        {
    749             LogFlow(("Error preparing stream %p: %s\n",
    750                      phPCM, snd_strerror(err)));
     742            LogRel(("ALSA: Error preparing stream %p: %s\n", phPCM, snd_strerror(err)));
    751743            return VERR_ACCESS_DENIED;
    752744        }
     
    856848
    857849                case -EAGAIN:
     850                {
    858851                    /*
    859852                     * Don't set error here because EAGAIN means there are no further frames
     
    863856                    cbToRead = 0;
    864857                    break;
     858                }
    865859
    866860                case -EPIPE:
     
    875869
    876870                default:
     871                {
    877872                    LogFunc(("Failed to read input frames: %s\n", snd_strerror(cRead)));
    878                     rc = VERR_AUDIO_BACKEND_INIT_FAILED;
    879                     VERR_GENERAL_FAILURE; /** @todo Fudge! */
     873                    rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
    880874                    break;
     875                }
    881876            }
    882877        }
     
    12951290    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
    12961291
    1297     pCfg->cbStreamOut = sizeof(ALSAAUDIOSTREAMOUT);
    1298     pCfg->cbStreamIn = sizeof(ALSAAUDIOSTREAMIN);
    1299     pCfg->cMaxHstStrmsOut = INT_MAX;
    1300     pCfg->cMaxHstStrmsIn = INT_MAX;
     1292    pCfg->cbStreamIn      = sizeof(ALSAAUDIOSTREAMIN);
     1293    pCfg->cbStreamOut     = sizeof(ALSAAUDIOSTREAMOUT);
     1294
     1295    /* ALSA only allows one input and one output used at a time for
     1296     * the selected device. */
     1297    pCfg->cMaxHstStrmsIn  = 1;
     1298    pCfg->cMaxHstStrmsOut = 1;
    13011299
    13021300    return VINF_SUCCESS;
  • trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp

    r59434 r59470  
    55
    66/*
    7  * Copyright (C) 2010-2015 Oracle Corporation
     7 * Copyright (C) 2010-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
  • trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp

    r59421 r59470  
    55
    66/*
    7  * Copyright (C) 2006-2015 Oracle Corporation
     7 * Copyright (C) 2006-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
  • trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp

    r59375 r59470  
    55
    66/*
    7  * Copyright (C) 2006-2015 Oracle Corporation
     7 * Copyright (C) 2006-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    11021102    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
    11031103
    1104     pCfg->cbStreamOut = sizeof(PULSEAUDIOSTREAM);
    1105     pCfg->cbStreamIn = sizeof(PULSEAUDIOSTREAM);
    1106     pCfg->cMaxHstStrmsOut = INT_MAX;
    1107     pCfg->cMaxHstStrmsIn = INT_MAX;
     1104    pCfg->cbStreamOut     = sizeof(PULSEAUDIOSTREAM);
     1105    pCfg->cbStreamIn      = sizeof(PULSEAUDIOSTREAM);
     1106    pCfg->cMaxHstStrmsOut = UINT32_MAX;
     1107    pCfg->cMaxHstStrmsIn  = UINT32_MAX;
    11081108
    11091109    return VINF_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.

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