VirtualBox

Changeset 89055 in vbox for trunk


Ignore:
Timestamp:
May 15, 2021 4:03:07 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144395
Message:

ValKit/Audio: Eliminated VBoxDDVKAT.h. Made some progress getting the PulseAudio driver to work (integer overflow now due to invalid config). bugref:10008

Location:
trunk/src/VBox
Files:
1 deleted
7 edited

Legend:

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

    r88991 r89055  
    5959#include "DrvHostAudioAlsaStubs.h"
    6060
    61 #ifdef VBOX_AUDIO_VKAT
    62 # include "VBoxDDVKAT.h"
    63 #else
    64 # include "VBoxDD.h"
    65 #endif
     61#include "VBoxDD.h"
    6662
    6763
  • trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp

    r89027 r89055  
    3939#include <VBox/vmm/pdmaudiohostenuminline.h>
    4040
    41 #ifdef VBOX_AUDIO_VKAT
    42 # include "VBoxDDVKAT.h"
    43 #else
    44 # include "VBoxDD.h"
    45 #endif
     41#include "VBoxDD.h"
    4642
    4743#include <iprt/asm.h>
  • trunk/src/VBox/Devices/Audio/DrvHostAudioDSound.cpp

    r88991 r89055  
    3636#include <VBox/vmm/pdmaudiohostenuminline.h>
    3737
    38 #ifdef VBOX_AUDIO_VKAT
    39 # include "VBoxDDVKAT.h"
    40 #else
    41 # include "VBoxDD.h"
    42 #endif
     38#include "VBoxDDVKAT.h"
    4339
    4440#ifdef VBOX_WITH_AUDIO_MMNOTIFICATION_CLIENT
  • trunk/src/VBox/Devices/Audio/DrvHostAudioOss.cpp

    r88995 r89055  
    3636#include <VBox/vmm/pdmaudioinline.h>
    3737
    38 #ifdef VBOX_AUDIO_VKAT
    39 # include "VBoxDDVKAT.h"
    40 #else
    41 # include "VBoxDD.h"
    42 #endif
     38#include "VBoxDD.h"
    4339
    4440
  • trunk/src/VBox/Devices/Audio/DrvHostAudioPulseAudio.cpp

    r88992 r89055  
    4444#endif
    4545
    46 #ifdef VBOX_AUDIO_VKAT
    47 # include "VBoxDDVKAT.h"
    48 #else
    49 # include "VBoxDD.h"
    50 #endif
     46#include "VBoxDD.h"
    5147
    5248
  • trunk/src/VBox/ValidationKit/utils/audio/Makefile.kmk

    r88928 r89055  
    4242# The Validation Kit Audio Test (VKAT) utility.
    4343#
    44 VKAT_PATH_AUDIO=$(PATH_ROOT)/src/VBox/Devices/Audio
     44VKAT_PATH_AUDIO = $(PATH_ROOT)/src/VBox/Devices/Audio
    4545
    4646PROGRAMS += AudioTest
    4747AudioTest_TEMPLATE = VBoxValidationKitR3
    48 AudioTest_DEFS    += VBOX_AUDIO_VKAT
     48AudioTest_DEFS     = VBOX_AUDIO_VKAT
     49AudioTest_INCS     = \
     50        $(PATH_ROOT)/src/VBox/Devices/build
    4951AudioTest_SOURCES  = \
    5052        vkat.cpp \
  • trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp

    r89054 r89055  
    5151#include "../../../Devices/Audio/AudioHlp.h"
    5252#include "../../../Devices/Audio/AudioTest.h"
    53 #include "../../../Devices/Audio/VBoxDDVKAT.h"
     53#include "VBoxDD.h"
    5454
    5555
     
    231231/** The current verbosity level. */
    232232static unsigned     g_uVerbosity = 0;
    233 /** The driver instance data. */
    234 static PDMDRVINS    g_DrvIns;
    235233
    236234
     
    402400}
    403401
     402/** @name Driver Helper Fakes / Stubs
     403 * @{  */
     404
     405VMMR3DECL(int) CFGMR3QueryString(PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString)
     406{
     407    if (pNode != NULL)
     408    {
     409        PCPDMDRVREG pDrvReg = (PCPDMDRVREG)pNode;
     410        if (g_uVerbosity > 2)
     411            RTPrintf("debug: CFGMR3QueryString([%s], %s, %p, %#x)\n", pDrvReg->szName, pszName, pszString, cchString);
     412
     413        if (   (   strcmp(pDrvReg->szName, "PulseAudio") == 0
     414                || strcmp(pDrvReg->szName, "HostAudioWas") == 0)
     415            && strcmp(pszName, "VmName") == 0)
     416            return RTStrCopy(pszString, cchString, "vkat");
     417
     418        if (   strcmp(pDrvReg->szName, "HostAudioWas") == 0
     419            && strcmp(pszName, "VmUuid") == 0)
     420            return RTStrCopy(pszString, cchString, "794c9192-d045-4f28-91ed-46253ac9998e");
     421    }
     422    else if (g_uVerbosity > 2)
     423        RTPrintf("debug: CFGMR3QueryString(%p, %s, %p, %#x)\n", pNode, pszName, pszString, cchString);
     424
     425    return VERR_CFGM_VALUE_NOT_FOUND;
     426}
     427
     428/* Fake stub. Will be removed when this moves into the driver helpers. */
     429VMMR3DECL(int) CFGMR3QueryStringDef(PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString, const char *pszDef)
     430{
     431    if (g_uVerbosity > 2)
     432        RTPrintf("debug: CFGMR3QueryStringDef(%p, %s, %p, %#x, %s)\n", pNode, pszName, pszString, cchString, pszDef);
     433    return RTStrCopy(pszString, cchString, pszDef);
     434}
     435
     436/* Fake stub. Will be removed when this moves into the driver helpers. */
     437VMMR3DECL(int) CFGMR3ValidateConfig(PCFGMNODE pNode, const char *pszNode,
     438                                    const char *pszValidValues, const char *pszValidNodes,
     439                                    const char *pszWho, uint32_t uInstance)
     440{
     441    RT_NOREF(pNode, pszNode, pszValidValues, pszValidNodes, pszWho, uInstance);
     442    return VINF_SUCCESS;
     443}
     444
     445/** @} */
     446
     447
    404448/**
    405449 * Constructs a PDM audio driver instance.
    406450 *
    407451 * @returns VBox status code.
    408  * @param   pDrvReg             PDM driver registration record to use for construction.
    409  * @param   pDrvIns             Driver instance to use for construction.
    410  * @param   ppDrvAudio          Where to return the audio driver interface of type IHOSTAUDIO.
    411  */
    412 static int audioTestDrvConstruct(const PDMDRVREG *pDrvReg, PPDMDRVINS pDrvIns, PPDMIHOSTAUDIO *ppDrvAudio)
    413 {
    414     AssertReturn(pDrvReg->cbInstance, VERR_INVALID_PARAMETER); /** @todo Very crude; improve. */
    415 
     452 * @param   pDrvReg     PDM driver registration record to use for construction.
     453 * @param   ppDrvIns    Where to return the driver instance structure.
     454 * @param   ppDrvAudio  Where to return the audio driver interface of type IHOSTAUDIO.
     455 */
     456static int audioTestDrvConstruct(PCPDMDRVREG pDrvReg, PPPDMDRVINS ppDrvIns, PPDMIHOSTAUDIO *ppDrvAudio)
     457{
     458    /* The destruct function must have valid data to work with. */
     459    *ppDrvIns   = NULL;
     460    *ppDrvAudio = NULL;
     461
     462    /*
     463     * Check registration structure validation (doesn't need to be too
     464     * thorough, PDM check it in detail on every VM startup).
     465     */
     466    AssertPtrReturn(pDrvReg, VERR_INVALID_POINTER);
    416467    RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Initializing backend '%s' ...\n", pDrvReg->szName);
    417 
    418     pDrvIns->pvInstanceData = RTMemAllocZ(pDrvReg->cbInstance);
    419     AssertPtrReturn(pDrvIns->pvInstanceData, VERR_NO_MEMORY);
    420 
    421     int rc = pDrvReg->pfnConstruct(pDrvIns, NULL /* PCFGMNODE */, 0 /* fFlags */);
     468    AssertPtrReturn(pDrvReg->pfnConstruct, VERR_INVALID_PARAMETER);
     469
     470    /*
     471     * Initialize the driver helper the first time thru.
     472     */
     473    static PDMDRVHLPR3 s_DrvHlp;
     474    if (s_DrvHlp.u32Version == 0)
     475    {
     476        s_DrvHlp.u32Version = PDM_DRVHLPR3_VERSION;
     477        s_DrvHlp.u32TheEnd  = PDM_DRVHLPR3_VERSION;
     478    }
     479
     480    /*
     481     * Create the instance data structure.
     482     */
     483    PPDMDRVINS pDrvIns = (PPDMDRVINS)RTMemAllocZVar(RT_UOFFSETOF_DYN(PDMDRVINS, achInstanceData[pDrvReg->cbInstance]));
     484    RTTEST_CHECK_RET(g_hTest, pDrvIns, VERR_NO_MEMORY);
     485
     486    pDrvIns->u32Version       = PDM_DRVINS_VERSION;
     487    pDrvIns->iInstance        = 0;
     488    pDrvIns->pHlpR3           = &s_DrvHlp;
     489    pDrvIns->pvInstanceDataR3 = &pDrvIns->achInstanceData[0];
     490    pDrvIns->pReg             = pDrvReg;
     491    pDrvIns->pCfg             = (PCFGMNODE)pDrvReg;
     492    //pDrvIns->pUpBase          = NULL;
     493    //pDrvIns->pDownBase        = NULL;
     494
     495    /*
     496     * Invoke the constructor.
     497     */
     498    int rc = pDrvReg->pfnConstruct(pDrvIns, pDrvIns->pCfg, 0 /*fFlags*/);
    422499    if (RT_SUCCESS(rc))
    423500    {
    424501        PPDMIHOSTAUDIO pDrvAudio = (PPDMIHOSTAUDIO)pDrvIns->IBase.pfnQueryInterface(&pDrvIns->IBase, PDMIHOSTAUDIO_IID);
    425 
    426         pDrvAudio->pfnGetStatus(pDrvAudio, PDMAUDIODIR_OUT);
    427 
    428         *ppDrvAudio = pDrvAudio;
    429     }
    430 
     502        if (pDrvAudio)
     503        {
     504            PDMAUDIOBACKENDSTS enmStatus = pDrvAudio->pfnGetStatus(pDrvAudio, PDMAUDIODIR_OUT);
     505            if (enmStatus == PDMAUDIOBACKENDSTS_RUNNING)
     506            {
     507                *ppDrvAudio = pDrvAudio;
     508                *ppDrvIns   = pDrvIns;
     509                return VINF_SUCCESS;
     510            }
     511            RTTestFailed(g_hTest, "Expected backend status RUNNING, got %d instead", enmStatus);
     512        }
     513        else
     514            RTTestFailed(g_hTest, "Failed to query PDMIHOSTAUDIO for '%s'", pDrvReg->szName);
     515    }
     516    else
     517        RTTestFailed(g_hTest, "Failed to construct audio driver '%s': %Rrc", pDrvReg->szName, rc);
     518    if (pDrvReg->pfnDestruct)
     519        pDrvReg->pfnDestruct(pDrvIns);
     520    RTMemFree(pDrvIns);
    431521    return rc;
    432522}
     
    439529 * @param   pDrvIns             Driver instance to destruct.
    440530 */
    441 static int audioTestDrvDestruct(const PDMDRVREG *pDrvReg, PPDMDRVINS pDrvIns)
     531static int audioTestDrvDestruct(PCPDMDRVREG pDrvReg, PPDMDRVINS pDrvIns)
    442532{
    443533    if (!pDrvIns)
     
    447537        pDrvReg->pfnDestruct(pDrvIns);
    448538
    449     if (pDrvIns->pvInstanceData)
    450     {
    451         RTMemFree(pDrvIns->pvInstanceData);
    452         pDrvIns->pvInstanceData = NULL;
    453     }
     539    pDrvIns->u32Version = 0;
     540    RTMemFree(pDrvIns);
    454541
    455542    return VINF_SUCCESS;
     
    896983
    897984    /* The backend: */
    898     PDMDRVREG const *pDrvReg;
     985    PCPDMDRVREG pDrvReg;
    899986#if defined(RT_OS_WINDOWS)
    900987    pDrvReg = &g_DrvHostAudioWas;
     
    10311118    RTTestBanner(g_hTest);
    10321119
    1033     PPDMIHOSTAUDIO pDrvAudio;
    1034     RT_ZERO(g_DrvIns);
    1035     rc = audioTestDrvConstruct(pDrvReg, &g_DrvIns, &pDrvAudio);
     1120    PPDMIHOSTAUDIO pDrvAudio = NULL;
     1121    PPDMDRVINS     pDrvIns   = NULL;
     1122    rc = audioTestDrvConstruct(pDrvReg, &pDrvIns, &pDrvAudio);
    10361123    if (RT_SUCCESS(rc))
    10371124    {
     
    10571144            audioTestEnvDestroy(&TstEnv);
    10581145        }
    1059         audioTestDrvDestruct(pDrvReg, &g_DrvIns);
    1060     }
     1146    }
     1147    audioTestDrvDestruct(pDrvReg, pDrvIns);
    10611148
    10621149    audioTestParmsDestroy(&TstCust);
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