VirtualBox

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


Ignore:
Timestamp:
Jan 17, 2019 11:07:07 AM (6 years ago)
Author:
vboxsync
Message:

Audio/DrvAudio: Documented and log configuration precedence for (pre-)buffering stuff.

File:
1 edited

Legend:

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

    r76778 r76846  
    29772977 * @param   pCfgReq             Requested audio stream configuration to use for stream creation.
    29782978 * @param   pCfgAcq             Acquired audio stream configuration returned by the backend.
     2979 *
     2980 * @note    Configuration precedence for requested audio stream configuration (first has highest priority, if set):
     2981 *          - per global extra-data
     2982 *          - per-VM extra-data
     2983 *          - requested configuration (by pCfgReq)
     2984 *          - default value
    29792985 */
    29802986static int drvAudioStreamCreateInternalBackend(PDRVAUDIO pThis,
     
    29953001     * All parameters in principle can be changed and returned by the backend via the acquired configuration. */
    29963002
     3003    char szWhat[64]; /* Log where a value came from. */
     3004
    29973005    /*
    29983006     * Period size
    29993007     */
    30003008    if (pDrvCfg->uPeriodSizeMs)
     3009    {
    30013010        pCfgReq->Backend.cfPeriod = DrvAudioHlpMilliToFrames(pDrvCfg->uPeriodSizeMs, &pCfgReq->Props);
    3002     else /* Set default period size. */
     3011        RTStrPrintf(szWhat, sizeof(szWhat), "global / per-VM");
     3012    }
     3013
     3014    if (!pCfgReq->Backend.cfPeriod) /* Set default period size if nothing explicitly is set. */
     3015    {
    30033016        pCfgReq->Backend.cfPeriod = DrvAudioHlpMilliToFrames(50 /* ms */, &pCfgReq->Props);
     3017        RTStrPrintf(szWhat, sizeof(szWhat), "default");
     3018    }
     3019    else
     3020        RTStrPrintf(szWhat, sizeof(szWhat), "device-specific");
    30043021
    30053022    LogRel2(("Audio: Using %s period size (%RU64ms, %RU32 frames) for stream '%s'\n",
    3006              pDrvCfg->uPeriodSizeMs ? "custom" : "default", DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPeriod, &pCfgReq->Props),
    3007              pCfgReq->Backend.cfPeriod, pStream->szName));
     3023             szWhat,
     3024             DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPeriod, &pCfgReq->Props), pCfgReq->Backend.cfPeriod, pStream->szName));
    30083025
    30093026    /*
     
    30113028     */
    30123029    if (pDrvCfg->uBufferSizeMs)
     3030    {
    30133031        pCfgReq->Backend.cfBufferSize = DrvAudioHlpMilliToFrames(pDrvCfg->uBufferSizeMs, &pCfgReq->Props);
    3014     else /* Set default buffer size. */
     3032        RTStrPrintf(szWhat, sizeof(szWhat), "global / per-VM");
     3033    }
     3034
     3035    if (!pCfgReq->Backend.cfBufferSize) /* Set default period size if nothing explicitly is set. */
     3036    {
    30153037        pCfgReq->Backend.cfBufferSize = DrvAudioHlpMilliToFrames(250 /* ms */, &pCfgReq->Props);
     3038        RTStrPrintf(szWhat, sizeof(szWhat), "default");
     3039    }
     3040    else
     3041        RTStrPrintf(szWhat, sizeof(szWhat), "device-specific");
    30163042
    30173043    LogRel2(("Audio: Using %s buffer size (%RU64ms, %RU32 frames) for stream '%s'\n",
    3018              pDrvCfg->uBufferSizeMs ? "custom" : "default", DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props),
    3019              pCfgReq->Backend.cfBufferSize, pStream->szName));
     3044             szWhat,
     3045             DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props), pCfgReq->Backend.cfBufferSize, pStream->szName));
    30203046
    30213047    /*
     
    30253051    {
    30263052        pCfgReq->Backend.cfPreBuf = DrvAudioHlpMilliToFrames(pDrvCfg->uPreBufSizeMs, &pCfgReq->Props);
    3027     }
    3028     else /* Set default pre-buffering size. */
     3053        RTStrPrintf(szWhat, sizeof(szWhat), "global / per-VM");
     3054    }
     3055
     3056    if (pCfgReq->Backend.cfPreBuf == UINT32_MAX) /* Set default period size if nothing explicitly is set. */
    30293057    {
    30303058        /* For pre-buffering to finish the buffer at least must be full one time. */
    30313059        pCfgReq->Backend.cfPreBuf = pCfgReq->Backend.cfBufferSize;
    3032     }
     3060        RTStrPrintf(szWhat, sizeof(szWhat), "default");
     3061    }
     3062    else
     3063        RTStrPrintf(szWhat, sizeof(szWhat), "device-specific");
    30333064
    30343065    LogRel2(("Audio: Using %s pre-buffering size (%RU64ms, %RU32 frames) for stream '%s'\n",
    3035              pDrvCfg->uPreBufSizeMs != UINT32_MAX ? "custom" : "default", DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPreBuf, &pCfgReq->Props),
    3036              pCfgReq->Backend.cfPreBuf, pStream->szName));
     3066             szWhat,
     3067             DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPreBuf, &pCfgReq->Props), pCfgReq->Backend.cfPreBuf, pStream->szName));
    30373068
    30383069    /*
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