VirtualBox

Changeset 89638 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jun 11, 2021 10:03:42 PM (4 years ago)
Author:
vboxsync
Message:

DevHda: Validate config values when reading them. Marked a bunch obsolete w/o actually removing them yet. Renamed a couple of members. doxygen. bugref:9890

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

Legend:

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

    r89611 r89638  
    46464646                                  "");
    46474647
    4648     /* Note: Error checking of this value happens in hdaR3StreamSetUp(). */
    4649     int rc = pHlp->pfnCFGMQueryU16Def(pCfg, "BufSizeInMs", &pThis->cbCircBufInMs, 0 /* Default value, if not set. */);
     4648    /** @devcfgm{hda,BufSizeInMs,uint16_t,0,2000,0,ms}
     4649     * The size of the DMA buffer for input streams expressed in milliseconds. */
     4650    int rc = pHlp->pfnCFGMQueryU16Def(pCfg, "BufSizeInMs", &pThis->cMsCircBufIn, 0);
    46504651    if (RT_FAILURE(rc))
    46514652        return PDMDEV_SET_ERROR(pDevIns, rc,
    4652                                 N_("HDA configuration error: failed to read input buffer size (ms) as unsigned integer"));
    4653 
    4654     /* Note: Error checking of this value happens in hdaR3StreamSetUp(). */
    4655     rc = pHlp->pfnCFGMQueryU16Def(pCfg, "BufSizeOutMs", &pThis->cbCircBufOutMs, 0 /* Default value, if not set. */);
     4653                                N_("HDA configuration error: failed to read 'BufSizeInMs' as 16-bit unsigned integer"));
     4654    if (pThis->cMsCircBufIn > 2000)
     4655        return PDMDEV_SET_ERROR(pDevIns, VERR_OUT_OF_RANGE,
     4656                                N_("HDA configuration error: 'BufSizeInMs' is out of bound, max 2000 ms"));
     4657
     4658    /** @devcfgm{hda,BufSizeOutMs,uint16_t,0,2000,0,ms}
     4659     * The size of the DMA buffer for output streams expressed in milliseconds. */
     4660    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "BufSizeOutMs", &pThis->cMsCircBufOut, 0);
    46564661    if (RT_FAILURE(rc))
    46574662        return PDMDEV_SET_ERROR(pDevIns, rc,
    4658                                 N_("HDA configuration error: failed to read output buffer size (ms) as unsigned integer"));
    4659 
    4660     rc = pHlp->pfnCFGMQueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, HDA_TIMER_HZ_DEFAULT /* Default value, if not set. */);
     4663                                N_("HDA configuration error: failed to read 'BufSizeOutMs' as 16-bit unsigned integer"));
     4664    if (pThis->cMsCircBufOut > 2000)
     4665        return PDMDEV_SET_ERROR(pDevIns, VERR_OUT_OF_RANGE,
     4666                                N_("HDA configuration error: 'BufSizeOutMs' is out of bound, max 2000 ms"));
     4667
     4668    /** @todo uTimerHz isn't used for anything anymore. */
     4669    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, HDA_TIMER_HZ_DEFAULT);
    46614670    if (RT_FAILURE(rc))
    46624671        return PDMDEV_SET_ERROR(pDevIns, rc,
    46634672                                N_("HDA configuration error: failed to read Hertz (Hz) rate as unsigned integer"));
    4664 
    46654673    if (pThis->uTimerHz != HDA_TIMER_HZ_DEFAULT)
    46664674        LogRel(("HDA: Using custom device timer rate (%RU16Hz)\n", pThis->uTimerHz));
     
    46804688                                   N_("HDA configuration error: Out of range: 0 <= InitialDelayMs < 256: %u"), pThis->msInitialDelay);
    46814689
     4690    /** @todo fPosAdjustEnabled is not honored anymore.   */
    46824691    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "PosAdjustEnabled", &pThis->fPosAdjustEnabled, true);
    46834692    if (RT_FAILURE(rc))
    46844693        return PDMDEV_SET_ERROR(pDevIns, rc,
    46854694                                N_("HDA configuration error: failed to read position adjustment enabled as boolean"));
    4686 
    46874695    if (!pThis->fPosAdjustEnabled)
    46884696        LogRel(("HDA: Position adjustment is disabled\n"));
    46894697
     4698    /** @todo cPosAdjustFrames is not consulted anymore.   */
    46904699    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "PosAdjustFrames", &pThis->cPosAdjustFrames, HDA_POS_ADJUST_DEFAULT);
    46914700    if (RT_FAILURE(rc))
    46924701        return PDMDEV_SET_ERROR(pDevIns, rc,
    46934702                                N_("HDA configuration error: failed to read position adjustment frames as unsigned integer"));
    4694 
    46954703    if (pThis->cPosAdjustFrames)
    46964704        LogRel(("HDA: Using custom position adjustment (%RU16 audio frames)\n", pThis->cPosAdjustFrames));
    46974705
     4706    /** @todo fTransferHeuristicsEnabled is not used anymore.   */
    46984707    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "TransferHeuristicsEnabled", &pThis->fTransferHeuristicsEnabled, true);
    46994708    if (RT_FAILURE(rc))
    47004709        return PDMDEV_SET_ERROR(pDevIns, rc,
    47014710                                N_("HDA configuration error: failed to read data transfer heuristics enabled as boolean"));
    4702 
    47034711    if (!pThis->fTransferHeuristicsEnabled)
    47044712        LogRel(("HDA: Data transfer heuristics are disabled\n"));
     
    47134721        return PDMDEV_SET_ERROR(pDevIns, rc,
    47144722                                N_("HDA configuration error: failed to read debugging output path flag as string"));
    4715 
    47164723    if (pThisCC->Dbg.fEnabled)
    47174724        LogRel2(("HDA: Debug output will be saved to '%s'\n", pThisCC->Dbg.pszOutPath));
  • trunk/src/VBox/Devices/Audio/DevHda.h

    r89406 r89638  
    122122     * @sa InitialDelayMs config value.  */
    123123    uint16_t                msInitialDelay;
    124     /** Buffer size (in ms) of the internal input FIFO buffer.
    125      *  The actual buffer size in bytes will depend on the actual stream configuration. */
    126     uint16_t                cbCircBufInMs;
    127     /** Buffer size (in ms) of the internal output FIFO buffer.
    128      *  The actual buffer size in bytes will depend on the actual stream configuration. */
    129     uint16_t                cbCircBufOutMs;
     124    /** Config: Internal input DMA buffer size override, specified in milliseconds.
     125     * Zero means default size according to buffer and stream config.
     126     * @sa BufSizeInMs config value.  */
     127    uint16_t                cMsCircBufIn;
     128    /** Config: Internal output DMA buffer size override, specified in milliseconds.
     129     * Zero means default size according to buffer and stream config.
     130     * @sa BufSizeOutMs config value.  */
     131    uint16_t                cMsCircBufOut;
    130132    /** The start time of the wall clock (WALCLK), measured on the virtual sync clock. */
    131133    uint64_t                tsWalClkStart;
  • trunk/src/VBox/Devices/Audio/DevHdaStream.cpp

    r89562 r89638  
    707707             uSD, cbCircBuf, PDMAudioPropsBytesToMilli(&pCfg->Props, cbCircBuf)));
    708708
    709     uint32_t msCircBufCfg = hdaGetDirFromSD(uSD) == PDMAUDIODIR_IN ? pThis->cbCircBufInMs : pThis->cbCircBufOutMs;
     709    uint32_t msCircBufCfg = hdaGetDirFromSD(uSD) == PDMAUDIODIR_IN ? pThis->cMsCircBufIn : pThis->cMsCircBufOut;
    710710    if (msCircBufCfg) /* Anything set via CFGM? */
    711711    {
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