VirtualBox

Changeset 89489 in vbox


Ignore:
Timestamp:
Jun 3, 2021 11:00:02 PM (3 years ago)
Author:
vboxsync
Message:

Audio: Simplified PDMIAUDIOCONNECTOR::pfnStreamCreate by moving the acquired configuration to the resulting stream (PDMAUDIOSTREAM::Cfg). bugref:9890

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmaudioifs.h

    r89487 r89489  
    641641typedef struct PDMAUDIOSTREAMCFG
    642642{
     643    /** The stream's PCM properties. */
     644    PDMAUDIOPCMPROPS        Props;
    643645    /** Direction of the stream. */
    644646    PDMAUDIODIR             enmDir;
    645647    /** Destination / source path. */
    646648    PDMAUDIOPATH            enmPath;
    647     /** The stream's PCM properties. */
    648     PDMAUDIOPCMPROPS        Props;
    649649    /** Device emulation-specific data needed for the audio connector. */
    650650    struct
     
    874874     *          - Before DRVAUDIO::CritSectHotPlug. */
    875875    RTCRITSECT              CritSect;
     876    /** Stream configuration. */
     877    PDMAUDIOSTREAMCFG       Cfg;
    876878    /** Magic value (PDMAUDIOSTREAM_MAGIC). */
    877879    uint32_t                uMagic;
    878     /** Audio direction of this stream. */
    879     PDMAUDIODIR             enmDir;
    880880    /** Size (in bytes) of the backend-specific stream data. */
    881881    uint32_t                cbBackend;
     
    883883     *  See PDMAUDIOSTREAM_WARN_FLAGS_XXX. */
    884884    uint32_t                fWarningsShown;
    885     /** The stream properties. */
    886     PDMAUDIOPCMPROPS        Props;
    887 
    888     /** Name of this stream. */
    889     char                    szName[64];
    890885} PDMAUDIOSTREAM;
    891886/** Pointer to an audio stream. */
     
    960955     * configuring host audio.
    961956     *
    962      * @param   pInterface      Pointer to this interface.
    963      * @param   pCfg            The typical configuration.  Can be modified by the
    964      *                          drivers in unspecified ways.
     957     * @param   pInterface  Pointer to this interface.
     958     * @param   pCfg        The typical configuration.  Can be modified by the
     959     *                      drivers in unspecified ways.
    965960     */
    966961    DECLR3CALLBACKMEMBER(void, pfnStreamConfigHint, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOSTREAMCFG pCfg));
     
    970965     *
    971966     * @returns VBox status code.
    972      * @param   pInterface      Pointer to the interface structure containing the called function pointer.
    973      * @param   fFlags          PDMAUDIOSTREAM_CREATE_F_XXX.
    974      * @param   pCfgHost        Stream configuration for host side.
    975      * @param   pCfgGuest       Stream configuration for guest side.
    976      * @param   ppStream        Pointer where to return the created audio stream on success.
    977      * @todo r=bird: It is not documented how pCfgHost and pCfgGuest can be
    978      *       modified the DrvAudio...
    979      */
    980     DECLR3CALLBACKMEMBER(int, pfnStreamCreate, (PPDMIAUDIOCONNECTOR pInterface, uint32_t fFlags, PPDMAUDIOSTREAMCFG pCfgHost,
    981                                                 PPDMAUDIOSTREAMCFG pCfgGuest, PPDMAUDIOSTREAM *ppStream));
     967     * @param   pInterface  Pointer to this interface.
     968     * @param   fFlags      PDMAUDIOSTREAM_CREATE_F_XXX.
     969     * @param   pCfgReq     The requested stream configuration.  The actual stream
     970     *                      configuration can be found in pStream->Cfg on success.
     971     * @param   ppStream    Pointer where to return the created audio stream on
     972     *                      success.
     973     */
     974    DECLR3CALLBACKMEMBER(int, pfnStreamCreate, (PPDMIAUDIOCONNECTOR pInterface, uint32_t fFlags, PCPDMAUDIOSTREAMCFG pCfgReq,
     975                                                PPDMAUDIOSTREAM *ppStream));
    982976
    983977
     
    10971091
    10981092/** PDMIAUDIOCONNECTOR interface ID. */
    1099 #define PDMIAUDIOCONNECTOR_IID                  "ae82616d-0da7-489a-aa4c-3e74d112ca9c"
     1093#define PDMIAUDIOCONNECTOR_IID                  "2900fe2a-6aeb-4953-ac12-f8965612f446"
    11001094
    11011095
     
    13151309                                                 PDMAUDIOSTREAMCMD enmStreamCmd));
    13161310
    1317     /**
    1318      * Returns the amount which is readable from the audio (input) stream.
    1319      *
    1320      * @returns For non-raw layout streams: Number of readable bytes.
    1321      *          for raw layout streams    : Number of readable audio frames.
    1322      * @param   pInterface          Pointer to the interface structure containing the called function pointer.
    1323      * @param   pStream             Pointer to audio stream.
    1324      */
    1325     DECLR3CALLBACKMEMBER(uint32_t, pfnStreamGetReadable, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream));
    1326 
    1327     /**
    1328      * Returns the amount which is writable to the audio (output) stream.
    1329      *
    1330      * @returns Number of writable bytes.
    1331      * @param   pInterface          Pointer to the interface structure containing the called function pointer.
    1332      * @param   pStream             Pointer to audio stream.
    1333      */
    1334     DECLR3CALLBACKMEMBER(uint32_t, pfnStreamGetWritable, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream));
    1335 
    1336     /**
    1337      * Returns the number of buffered bytes that hasn't been played yet (optional).
    1338      *
    1339      * Is not valid on an input stream, implementions shall assert and return zero.
    1340      *
    1341      * @returns Number of pending bytes.
    1342      * @param   pInterface          Pointer to this interface.
    1343      * @param   pStream             Pointer to audio stream.
    1344      *
    1345      * @todo This is no longer not used by DrvAudio and can probably be removed.
    1346      */
    1347     DECLR3CALLBACKMEMBER(uint32_t, pfnStreamGetPending, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream));
    13481311
    13491312    /**
     
    13561319     */
    13571320    DECLR3CALLBACKMEMBER(PDMHOSTAUDIOSTREAMSTATE, pfnStreamGetState, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream));
     1321
     1322    /**
     1323     * Returns the number of buffered bytes that hasn't been played yet (optional).
     1324     *
     1325     * Is not valid on an input stream, implementions shall assert and return zero.
     1326     *
     1327     * @returns Number of pending bytes.
     1328     * @param   pInterface          Pointer to this interface.
     1329     * @param   pStream             Pointer to audio stream.
     1330     *
     1331     * @todo This is no longer not used by DrvAudio and can probably be removed.
     1332     */
     1333    DECLR3CALLBACKMEMBER(uint32_t, pfnStreamGetPending, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream));
     1334
     1335    /**
     1336     * Returns the amount which is writable to the audio (output) stream.
     1337     *
     1338     * @returns Number of writable bytes.
     1339     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
     1340     * @param   pStream             Pointer to audio stream.
     1341     */
     1342    DECLR3CALLBACKMEMBER(uint32_t, pfnStreamGetWritable, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream));
    13581343
    13591344    /**
     
    13781363
    13791364    /**
     1365     * Returns the amount which is readable from the audio (input) stream.
     1366     *
     1367     * @returns For non-raw layout streams: Number of readable bytes.
     1368     *          for raw layout streams    : Number of readable audio frames.
     1369     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
     1370     * @param   pStream             Pointer to audio stream.
     1371     */
     1372    DECLR3CALLBACKMEMBER(uint32_t, pfnStreamGetReadable, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream));
     1373
     1374    /**
    13801375     * Captures (reads from) an audio (input) stream.
    13811376     *
     
    13921387
    13931388/** PDMIHOSTAUDIO interface ID. */
    1394 #define PDMIHOSTAUDIO_IID                           "0625ae75-491b-428b-836e-4f8a9869788f"
     1389#define PDMIHOSTAUDIO_IID                           "147dedd7-cac1-469b-b545-335dbe90abf6"
    13951390
    13961391
     
    14771472
    14781473/** PDMIHOSTAUDIOPORT interface ID. */
    1479 #define PDMIHOSTAUDIOPORT_IID                    "d42144e9-867e-4d1c-86d4-acb92b47f013"
     1474#define PDMIHOSTAUDIOPORT_IID                    "92ea5169-8271-402d-99a7-9de26a52acaf"
    14801475
    14811476/** @} */
  • trunk/src/VBox/Devices/Audio/AudioMixer.cpp

    r89379 r89489  
    532532        {
    533533            uint32_t cFrames = pMixStream->cFramesBackendBuffer;
    534             if (PDMAudioPropsHz(&pMixStream->pStream->Props) == PDMAudioPropsHz(&pSink->MixBuf.Props))
     534            if (PDMAudioPropsHz(&pMixStream->pStream->Cfg.Props) == PDMAudioPropsHz(&pSink->MixBuf.Props))
    535535            { /* likely */ }
    536536            else
    537                 cFrames = cFrames * PDMAudioPropsHz(&pSink->MixBuf.Props) / PDMAudioPropsHz(&pMixStream->pStream->Props);
     537                cFrames = cFrames * PDMAudioPropsHz(&pSink->MixBuf.Props) / PDMAudioPropsHz(&pMixStream->pStream->Cfg.Props);
    538538            if (cFrames > cFramesStreamMax)
    539539            {
     
    10061006                    RTListForEach(&pSink->lstStreams, pMixStream, AUDMIXSTREAM, Node)
    10071007                    {
    1008                         int rc2 = AudioMixBufInitWriteState(&pSink->MixBuf, &pMixStream->WriteState, &pMixStream->pStream->Props);
     1008                        int rc2 = AudioMixBufInitWriteState(&pSink->MixBuf, &pMixStream->WriteState, &pMixStream->pStream->Cfg.Props);
    10091009                        /** @todo remember this. */
    10101010                        AssertLogRelRC(rc2);
     
    10151015                    RTListForEach(&pSink->lstStreams, pMixStream, AUDMIXSTREAM, Node)
    10161016                    {
    1017                         int rc2 = AudioMixBufInitPeekState(&pSink->MixBuf, &pMixStream->PeekState, &pMixStream->pStream->Props);
     1017                        int rc2 = AudioMixBufInitPeekState(&pSink->MixBuf, &pMixStream->PeekState, &pMixStream->pStream->Cfg.Props);
    10181018                        /** @todo remember this. */
    10191019                        AssertLogRelRC(rc2);
     
    11371137
    11381138            uint32_t const cbReadable = pIConnector->pfnStreamGetReadable(pIConnector, pStream);
    1139             uint32_t cFrames = PDMAudioPropsBytesToFrames(&pStream->Props, cbReadable);
     1139            uint32_t cFrames = PDMAudioPropsBytesToFrames(&pStream->Cfg.Props, cbReadable);
    11401140            pMixStream->cFramesLastAvail = cFrames;
    1141             if (PDMAudioPropsHz(&pStream->Props) == PDMAudioPropsHz(&pSink->MixBuf.Props))
     1141            if (PDMAudioPropsHz(&pStream->Cfg.Props) == PDMAudioPropsHz(&pSink->MixBuf.Props))
    11421142            { /* likely */ }
    11431143            else
    11441144            {
    1145                 cFrames = cFrames * PDMAudioPropsHz(&pSink->MixBuf.Props) / PDMAudioPropsHz(&pStream->Props);
     1145                cFrames = cFrames * PDMAudioPropsHz(&pSink->MixBuf.Props) / PDMAudioPropsHz(&pStream->Cfg.Props);
    11461146                cFrames = cFrames > 2 ? cFrames - 2 : 0; /* rounding safety fudge */
    11471147            }
     
    12741274
    12751275                    /* Calculate how many bytes we should read from this stream. */
    1276                     bool const     fResampleSrc = PDMAudioPropsHz(&pStream->Props) != PDMAudioPropsHz(&pSink->MixBuf.Props);
     1276                    bool const     fResampleSrc = PDMAudioPropsHz(&pStream->Cfg.Props) != PDMAudioPropsHz(&pSink->MixBuf.Props);
    12771277                    uint32_t const cbSrcToXfer  = !fResampleSrc
    1278                                                 ? PDMAudioPropsFramesToBytes(&pStream->Props, cFramesToXfer)
    1279                                                 : PDMAudioPropsFramesToBytes(&pStream->Props, /** @todo check rounding errors here... */
     1278                                                ? PDMAudioPropsFramesToBytes(&pStream->Cfg.Props, cFramesToXfer)
     1279                                                : PDMAudioPropsFramesToBytes(&pStream->Cfg.Props, /** @todo check rounding errors here... */
    12801280                                                                             cFramesToXfer * PDMAudioPropsHz(&pSink->MixBuf.Props)
    1281                                                                              / PDMAudioPropsHz(&pStream->Props));
     1281                                                                             / PDMAudioPropsHz(&pStream->Cfg.Props));
    12821282
    12831283                    /* Do the reading. */
     
    13321332                        /* We don't need to blend silence buffers.  For simplicity, always blend
    13331333                           when we're resampling (for rounding). */
    1334                         else if (fResampleSrc || !PDMAudioPropsIsBufferSilence(&pStream->Props, pvBuf, cbSrcRead))
     1334                        else if (fResampleSrc || !PDMAudioPropsIsBufferSilence(&pStream->Cfg.Props, pvBuf, cbSrcRead))
    13351335                        {
    13361336                            AudioMixBufBlend(&pSink->MixBuf, &pMixStream->WriteState, pvBuf, cbSrcRead,
     
    13391339                        else
    13401340                        {
    1341                             cFramesDstTransferred = PDMAudioPropsBytesToFrames(&pStream->Props, cbSrcRead);
     1341                            cFramesDstTransferred = PDMAudioPropsBytesToFrames(&pStream->Cfg.Props, cbSrcRead);
    13421342                            AudioMixBufBlendGap(&pSink->MixBuf, &pMixStream->WriteState, cFramesDstTransferred);
    13431343                        }
     
    14201420        {
    14211421            uint32_t const cbWritable = pMixStream->pConn->pfnStreamGetWritable(pMixStream->pConn, pMixStream->pStream);
    1422             uint32_t cFrames = PDMAudioPropsBytesToFrames(&pMixStream->pStream->Props, cbWritable);
     1422            uint32_t cFrames = PDMAudioPropsBytesToFrames(&pMixStream->pStream->Cfg.Props, cbWritable);
    14231423            pMixStream->cFramesLastAvail = cFrames;
    1424             if (PDMAudioPropsHz(&pMixStream->pStream->Props) == PDMAudioPropsHz(&pSink->MixBuf.Props))
     1424            if (PDMAudioPropsHz(&pMixStream->pStream->Cfg.Props) == PDMAudioPropsHz(&pSink->MixBuf.Props))
    14251425            { /* likely */ }
    14261426            else
    14271427            {
    1428                 cFrames = cFrames * PDMAudioPropsHz(&pSink->MixBuf.Props) / PDMAudioPropsHz(&pMixStream->pStream->Props);
     1428                cFrames = cFrames * PDMAudioPropsHz(&pSink->MixBuf.Props) / PDMAudioPropsHz(&pMixStream->pStream->Cfg.Props);
    14291429                cFrames = cFrames > 2 ? cFrames - 2 : 0; /* rounding safety fudge */
    14301430            }
     
    22622262                 * this is the sink format & direction with the src/dir, layout, name
    22632263                 * and device specific config copied from the guest side config (pCfg).
     2264                 * We disregard any Backend settings here.
     2265                 *
     2266                 * (Note! pfnStreamCreate used to get both CfgHost and pCfg (aka pCfgGuest)
     2267                 *        passed in, but that became unnecessary with DrvAudio stoppping
     2268                 *        mixing.  The mixing is done here and we bridge guest & host configs.)
    22642269                 */
    22652270                AssertMsg(AudioHlpPcmPropsAreValid(&pSink->PCMProps),
     
    22822287                 */
    22832288                PPDMAUDIOSTREAM pStream;
    2284                 rc = pConn->pfnStreamCreate(pConn, 0 /*fFlags*/, &CfgHost, pCfg, &pStream);
     2289                rc = pConn->pfnStreamCreate(pConn, 0 /*fFlags*/, &CfgHost, &pStream);
    22852290                if (RT_SUCCESS(rc))
    22862291                {
     
    22892294                    /* Set up the mixing buffer conversion state. */
    22902295                    if (pSink->enmDir == PDMAUDIODIR_IN)
    2291                         rc = AudioMixBufInitWriteState(&pSink->MixBuf, &pMixStream->WriteState, &pStream->Props);
     2296                        rc = AudioMixBufInitWriteState(&pSink->MixBuf, &pMixStream->WriteState, &pStream->Cfg.Props);
    22922297                    else
    2293                         rc = AudioMixBufInitPeekState(&pSink->MixBuf, &pMixStream->PeekState, &pStream->Props);
     2298                        rc = AudioMixBufInitPeekState(&pSink->MixBuf, &pMixStream->PeekState, &pStream->Cfg.Props);
    22942299                    if (RT_SUCCESS(rc))
    22952300                    {
     
    23962401                                              pStream->pszName, pSink->pszName), VERR_NOT_FOUND);
    23972402    Assert(RTCritSectIsOwner(&pSink->CritSect));
    2398     LogFlowFunc(("[%s] (Stream = %s), cStreams=%RU8\n", pSink->pszName, pStream->pStream->szName, pSink->cStreams));
     2403    LogFlowFunc(("[%s] (Stream = %s), cStreams=%RU8\n", pSink->pszName, pStream->pStream->Cfg.szName, pSink->cStreams));
    23992404
    24002405    /*
     
    25272532            if (pSink->enmDir == PDMAUDIODIR_OUT)
    25282533            {
    2529                 rc = AudioMixBufInitPeekState(&pSink->MixBuf, &pMixStream->PeekState, &pStream->Props);
     2534                rc = AudioMixBufInitPeekState(&pSink->MixBuf, &pMixStream->PeekState, &pStream->Cfg.Props);
    25302535                /** @todo we need to remember this, don't we? */
    25312536                AssertLogRelRCReturn(rc, VINF_SUCCESS);
     
    25332538            else
    25342539            {
    2535                 rc = AudioMixBufInitWriteState(&pSink->MixBuf, &pMixStream->WriteState, &pStream->Props);
     2540                rc = AudioMixBufInitWriteState(&pSink->MixBuf, &pMixStream->WriteState, &pStream->Cfg.Props);
    25362541                /** @todo we need to remember this, don't we? */
    25372542                AssertLogRelRCReturn(rc, VINF_SUCCESS);
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r89445 r89489  
    201201    PRTREQ                  hReqInitAsync;
    202202
    203     /** @todo The guest and host fields only contains the stream config now that
    204      *        the mixing buffer is gone, so we can probably combine them into a
    205      *        single Cfg member. */
    206     /** The guest side of the stream. */
    207     DRVAUDIOSTREAMCTX       Guest;
    208     /** The host side of the stream. */
    209     DRVAUDIOSTREAMCTX       Host;
    210 
    211 
    212203    /** The nanosecond timestamp when the stream was started. */
    213204    uint64_t                nsStarted;
     
    600591    {
    601592        PDMHOSTAUDIOSTREAMSTATE enmState = pThis->pHostDrvAudio->pfnStreamGetState(pThis->pHostDrvAudio, pStreamEx->pBackend);
    602         Log9Func(("%s: %s\n", pStreamEx->Core.szName, PDMHostAudioStreamStateGetName(enmState) ));
     593        Log9Func(("%s: %s\n", pStreamEx->Core.Cfg.szName, PDMHostAudioStreamStateGetName(enmState) ));
    603594        Assert(   enmState > PDMHOSTAUDIOSTREAMSTATE_INVALID
    604595               && enmState < PDMHOSTAUDIOSTREAMSTATE_END
    605                && (enmState != PDMHOSTAUDIOSTREAMSTATE_DRAINING || pStreamEx->Guest.Cfg.enmDir == PDMAUDIODIR_OUT));
     596               && (enmState != PDMHOSTAUDIOSTREAMSTATE_DRAINING || pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT));
    606597        return enmState;
    607598    }
    608     Log9Func(("%s: not-working\n", pStreamEx->Core.szName));
     599    Log9Func(("%s: not-working\n", pStreamEx->Core.Cfg.szName));
    609600    return PDMHOSTAUDIOSTREAMSTATE_NOT_WORKING;
    610601}
     
    616607DECLINLINE(void) drvAudioStreamProcessBackendStateChangeWasDraining(PDRVAUDIOSTREAM pStreamEx)
    617608{
    618     Log(("drvAudioStreamProcessBackendStateChange: Stream '%s': Done draining - disabling stream.\n", pStreamEx->Core.szName));
     609    Log(("drvAudioStreamProcessBackendStateChange: Stream '%s': Done draining - disabling stream.\n", pStreamEx->Core.Cfg.szName));
    619610    pStreamEx->fStatus &= ~(PDMAUDIOSTREAM_STS_ENABLED | PDMAUDIOSTREAM_STS_PENDING_DISABLE);
    620611    drvAudioStreamResetInternal(pStreamEx);
     
    631622                                                                       PDMHOSTAUDIOSTREAMSTATE enmOldState)
    632623{
    633     PDMAUDIODIR const           enmDir          = pStreamEx->Guest.Cfg.enmDir;
     624    PDMAUDIODIR const           enmDir          = pStreamEx->Core.Cfg.enmDir;
    634625#ifdef LOG_ENABLED
    635626    DRVAUDIOPLAYSTATE const     enmPlayState    = enmDir == PDMAUDIODIR_OUT
     
    704695
    705696    if (enmDir == PDMAUDIODIR_OUT)
    706         LogFunc(("Output stream '%s': %s/%s -> %s/%s\n", pStreamEx->Core.szName,
     697        LogFunc(("Output stream '%s': %s/%s -> %s/%s\n", pStreamEx->Core.Cfg.szName,
    707698                 PDMHostAudioStreamStateGetName(enmOldState), drvAudioPlayStateName(enmPlayState),
    708699                 PDMHostAudioStreamStateGetName(enmNewState), drvAudioPlayStateName(pStreamEx->Out.enmPlayState) ));
    709700    else
    710         LogFunc(("Input stream '%s': %s/%s -> %s/%s\n", pStreamEx->Core.szName,
     701        LogFunc(("Input stream '%s': %s/%s -> %s/%s\n", pStreamEx->Core.Cfg.szName,
    711702                 PDMHostAudioStreamStateGetName(enmOldState), drvAudioCaptureStateName(enmCaptureState),
    712703                 PDMHostAudioStreamStateGetName(enmNewState), drvAudioCaptureStateName(pStreamEx->In.enmCaptureState) ));
     
    864855        RTListForEach(&pThis->LstStreams, pStreamEx, DRVAUDIOSTREAM, ListEntry)
    865856        {
    866             if (pStreamEx->Core.enmDir == enmDir)
     857            if (pStreamEx->Core.Cfg.enmDir == enmDir)
    867858            {
    868859                /*
     
    911902                    {
    912903                        LogRel(("Audio: Failed to %s %s stream '%s': %Rrc\n",
    913                                 pszOperation, enmDir == PDMAUDIODIR_IN ? "input" : "output", pStreamEx->Core.szName, rc2));
     904                                pszOperation, enmDir == PDMAUDIODIR_IN ? "input" : "output", pStreamEx->Core.Cfg.szName, rc2));
    914905                        if (RT_SUCCESS(rc))
    915906                            rc = rc2;  /** @todo r=bird: This isn't entirely helpful to the caller since we'll update the status
     
    10161007    if (pStreamEx)
    10171008    {
    1018         LogFunc(("[%s]\n", pStreamEx->Core.szName));
     1009        LogFunc(("[%s]\n", pStreamEx->Core.Cfg.szName));
    10191010        Assert(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC);
    10201011        Assert(pStreamEx->uMagic      == DRVAUDIOSTREAM_MAGIC);
     
    10401031 * @returns VBox status code.
    10411032 * @param   pThis       Pointer to the DrvAudio instance data.
    1042  * @param   pCfgReq     The request configuration that should be adjusted.
     1033 * @param   pCfg        The configuration that should be adjusted.
    10431034 * @param   pszName     Stream name to use when logging warnings and errors.
    10441035 */
    1045 static int drvAudioStreamAdjustConfig(PCDRVAUDIO pThis, PPDMAUDIOSTREAMCFG pCfgReq, const char *pszName)
     1036static int drvAudioStreamAdjustConfig(PCDRVAUDIO pThis, PPDMAUDIOSTREAMCFG pCfg, const char *pszName)
    10461037{
    10471038    /* Get the right configuration for the stream to be created. */
    1048     PCDRVAUDIOCFG pDrvCfg = pCfgReq->enmDir == PDMAUDIODIR_IN ? &pThis->CfgIn: &pThis->CfgOut;
     1039    PCDRVAUDIOCFG pDrvCfg = pCfg->enmDir == PDMAUDIODIR_IN ? &pThis->CfgIn: &pThis->CfgOut;
    10491040
    10501041    /* Fill in the tweakable parameters into the requested host configuration.
     
    10561047    if (PDMAudioPropsSampleSize(&pDrvCfg->Props) != 0) /* Anything set via custom extra-data? */
    10571048    {
    1058         PDMAudioPropsSetSampleSize(&pCfgReq->Props, PDMAudioPropsSampleSize(&pDrvCfg->Props));
     1049        PDMAudioPropsSetSampleSize(&pCfg->Props, PDMAudioPropsSampleSize(&pDrvCfg->Props));
    10591050        LogRel2(("Audio: Using custom sample size of %RU8 bytes for stream '%s'\n",
    1060                  PDMAudioPropsSampleSize(&pCfgReq->Props), pszName));
     1051                 PDMAudioPropsSampleSize(&pCfg->Props), pszName));
    10611052    }
    10621053
    10631054    if (pDrvCfg->Props.uHz) /* Anything set via custom extra-data? */
    10641055    {
    1065         pCfgReq->Props.uHz = pDrvCfg->Props.uHz;
    1066         LogRel2(("Audio: Using custom Hz rate %RU32 for stream '%s'\n", pCfgReq->Props.uHz, pszName));
     1056        pCfg->Props.uHz = pDrvCfg->Props.uHz;
     1057        LogRel2(("Audio: Using custom Hz rate %RU32 for stream '%s'\n", pCfg->Props.uHz, pszName));
    10671058    }
    10681059
    10691060    if (pDrvCfg->uSigned != UINT8_MAX) /* Anything set via custom extra-data? */
    10701061    {
    1071         pCfgReq->Props.fSigned = RT_BOOL(pDrvCfg->uSigned);
     1062        pCfg->Props.fSigned = RT_BOOL(pDrvCfg->uSigned);
    10721063        LogRel2(("Audio: Using custom %s sample format for stream '%s'\n",
    1073                  pCfgReq->Props.fSigned ? "signed" : "unsigned", pszName));
     1064                 pCfg->Props.fSigned ? "signed" : "unsigned", pszName));
    10741065    }
    10751066
    10761067    if (pDrvCfg->uSwapEndian != UINT8_MAX) /* Anything set via custom extra-data? */
    10771068    {
    1078         pCfgReq->Props.fSwapEndian = RT_BOOL(pDrvCfg->uSwapEndian);
     1069        pCfg->Props.fSwapEndian = RT_BOOL(pDrvCfg->uSwapEndian);
    10791070        LogRel2(("Audio: Using custom %s endianess for samples of stream '%s'\n",
    1080                  pCfgReq->Props.fSwapEndian ? "swapped" : "original", pszName));
     1071                 pCfg->Props.fSwapEndian ? "swapped" : "original", pszName));
    10811072    }
    10821073
    10831074    if (PDMAudioPropsChannels(&pDrvCfg->Props) != 0) /* Anything set via custom extra-data? */
    10841075    {
    1085         PDMAudioPropsSetChannels(&pCfgReq->Props, PDMAudioPropsChannels(&pDrvCfg->Props));
     1076        PDMAudioPropsSetChannels(&pCfg->Props, PDMAudioPropsChannels(&pDrvCfg->Props));
    10861077        LogRel2(("Audio: Using custom %RU8 channel(s) for stream '%s'\n", PDMAudioPropsChannels(&pDrvCfg->Props), pszName));
    10871078    }
    10881079
    10891080    /* Validate PCM properties. */
    1090     if (!AudioHlpPcmPropsAreValid(&pCfgReq->Props))
     1081    if (!AudioHlpPcmPropsAreValid(&pCfg->Props))
    10911082    {
    10921083        LogRel(("Audio: Invalid custom PCM properties set for stream '%s', cannot create stream\n", pszName));
     
    11001091    if (pDrvCfg->uPeriodSizeMs)
    11011092    {
    1102         pCfgReq->Backend.cFramesPeriod = PDMAudioPropsMilliToFrames(&pCfgReq->Props, pDrvCfg->uPeriodSizeMs);
     1093        pCfg->Backend.cFramesPeriod = PDMAudioPropsMilliToFrames(&pCfg->Props, pDrvCfg->uPeriodSizeMs);
    11031094        pszWhat = "custom";
    11041095    }
    11051096
    1106     if (!pCfgReq->Backend.cFramesPeriod) /* Set default period size if nothing explicitly is set. */
    1107     {
    1108         pCfgReq->Backend.cFramesPeriod = PDMAudioPropsMilliToFrames(&pCfgReq->Props, 150 /*ms*/);
     1097    if (!pCfg->Backend.cFramesPeriod) /* Set default period size if nothing explicitly is set. */
     1098    {
     1099        pCfg->Backend.cFramesPeriod = PDMAudioPropsMilliToFrames(&pCfg->Props, 150 /*ms*/);
    11091100        pszWhat = "default";
    11101101    }
    11111102
    11121103    LogRel2(("Audio: Using %s period size %RU64 ms / %RU32 frames for stream '%s'\n",
    1113              pszWhat, PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod),
    1114              pCfgReq->Backend.cFramesPeriod, pszName));
     1104             pszWhat, PDMAudioPropsFramesToMilli(&pCfg->Props, pCfg->Backend.cFramesPeriod),
     1105             pCfg->Backend.cFramesPeriod, pszName));
    11151106
    11161107    /*
     
    11201111    if (pDrvCfg->uBufferSizeMs)
    11211112    {
    1122         pCfgReq->Backend.cFramesBufferSize = PDMAudioPropsMilliToFrames(&pCfgReq->Props, pDrvCfg->uBufferSizeMs);
     1113        pCfg->Backend.cFramesBufferSize = PDMAudioPropsMilliToFrames(&pCfg->Props, pDrvCfg->uBufferSizeMs);
    11231114        pszWhat = "custom";
    11241115    }
    11251116
    1126     if (!pCfgReq->Backend.cFramesBufferSize) /* Set default buffer size if nothing explicitly is set. */
    1127     {
    1128         pCfgReq->Backend.cFramesBufferSize = PDMAudioPropsMilliToFrames(&pCfgReq->Props, 300 /*ms*/);
     1117    if (!pCfg->Backend.cFramesBufferSize) /* Set default buffer size if nothing explicitly is set. */
     1118    {
     1119        pCfg->Backend.cFramesBufferSize = PDMAudioPropsMilliToFrames(&pCfg->Props, 300 /*ms*/);
    11291120        pszWhat = "default";
    11301121    }
    11311122
    11321123    LogRel2(("Audio: Using %s buffer size %RU64 ms / %RU32 frames for stream '%s'\n",
    1133              pszWhat, PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize),
    1134              pCfgReq->Backend.cFramesBufferSize, pszName));
     1124             pszWhat, PDMAudioPropsFramesToMilli(&pCfg->Props, pCfg->Backend.cFramesBufferSize),
     1125             pCfg->Backend.cFramesBufferSize, pszName));
    11351126
    11361127    /*
     
    11401131    if (pDrvCfg->uPreBufSizeMs != UINT32_MAX) /* Anything set via global / per-VM extra-data? */
    11411132    {
    1142         pCfgReq->Backend.cFramesPreBuffering = PDMAudioPropsMilliToFrames(&pCfgReq->Props, pDrvCfg->uPreBufSizeMs);
     1133        pCfg->Backend.cFramesPreBuffering = PDMAudioPropsMilliToFrames(&pCfg->Props, pDrvCfg->uPreBufSizeMs);
    11431134        pszWhat = "custom";
    11441135    }
    11451136    else /* No, then either use the default or device-specific settings (if any). */
    11461137    {
    1147         if (pCfgReq->Backend.cFramesPreBuffering == UINT32_MAX) /* Set default pre-buffering size if nothing explicitly is set. */
     1138        if (pCfg->Backend.cFramesPreBuffering == UINT32_MAX) /* Set default pre-buffering size if nothing explicitly is set. */
    11481139        {
    11491140            /* Pre-buffer 66% of the buffer for output streams, but only 50% for input. Capping both at 200ms. */
    1150             if (pCfgReq->enmDir == PDMAUDIODIR_OUT)
    1151                 pCfgReq->Backend.cFramesPreBuffering = pCfgReq->Backend.cFramesBufferSize * 2 / 3;
     1141            if (pCfg->enmDir == PDMAUDIODIR_OUT)
     1142                pCfg->Backend.cFramesPreBuffering = pCfg->Backend.cFramesBufferSize * 2 / 3;
    11521143            else
    1153                 pCfgReq->Backend.cFramesPreBuffering = pCfgReq->Backend.cFramesBufferSize / 2;
    1154             uint32_t const cFramesMax = PDMAudioPropsMilliToFrames(&pCfgReq->Props, 200);
    1155             pCfgReq->Backend.cFramesPreBuffering = RT_MIN(pCfgReq->Backend.cFramesPreBuffering, cFramesMax);
     1144                pCfg->Backend.cFramesPreBuffering = pCfg->Backend.cFramesBufferSize / 2;
     1145            uint32_t const cFramesMax = PDMAudioPropsMilliToFrames(&pCfg->Props, 200);
     1146            pCfg->Backend.cFramesPreBuffering = RT_MIN(pCfg->Backend.cFramesPreBuffering, cFramesMax);
    11561147            pszWhat = "default";
    11571148        }
     
    11591150
    11601151    LogRel2(("Audio: Using %s pre-buffering size %RU64 ms / %RU32 frames for stream '%s'\n",
    1161              pszWhat, PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPreBuffering),
    1162              pCfgReq->Backend.cFramesPreBuffering, pszName));
     1152             pszWhat, PDMAudioPropsFramesToMilli(&pCfg->Props, pCfg->Backend.cFramesPreBuffering),
     1153             pCfg->Backend.cFramesPreBuffering, pszName));
    11631154
    11641155    /*
    11651156     * Validate input.
    11661157     */
    1167     if (pCfgReq->Backend.cFramesBufferSize < pCfgReq->Backend.cFramesPeriod)
     1158    if (pCfg->Backend.cFramesBufferSize < pCfg->Backend.cFramesPeriod)
    11681159    {
    11691160        LogRel(("Audio: Error for stream '%s': Buffering size (%RU64ms) must not be smaller than the period size (%RU64ms)\n",
    1170                 pszName, PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize),
    1171                 PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod)));
     1161                pszName, PDMAudioPropsFramesToMilli(&pCfg->Props, pCfg->Backend.cFramesBufferSize),
     1162                PDMAudioPropsFramesToMilli(&pCfg->Props, pCfg->Backend.cFramesPeriod)));
    11721163        return VERR_INVALID_PARAMETER;
    11731164    }
    11741165
    1175     if (   pCfgReq->Backend.cFramesPreBuffering != UINT32_MAX /* Custom pre-buffering set? */
    1176         && pCfgReq->Backend.cFramesPreBuffering)
    1177     {
    1178         if (pCfgReq->Backend.cFramesBufferSize < pCfgReq->Backend.cFramesPreBuffering)
     1166    if (   pCfg->Backend.cFramesPreBuffering != UINT32_MAX /* Custom pre-buffering set? */
     1167        && pCfg->Backend.cFramesPreBuffering)
     1168    {
     1169        if (pCfg->Backend.cFramesBufferSize < pCfg->Backend.cFramesPreBuffering)
    11791170        {
    11801171            LogRel(("Audio: Error for stream '%s': Buffering size (%RU64ms) must not be smaller than the pre-buffering size (%RU64ms)\n",
    1181                     pszName, PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPreBuffering),
    1182                     PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize)));
     1172                    pszName, PDMAudioPropsFramesToMilli(&pCfg->Props, pCfg->Backend.cFramesPreBuffering),
     1173                    PDMAudioPropsFramesToMilli(&pCfg->Props, pCfg->Backend.cFramesBufferSize)));
    11831174            return VERR_INVALID_PARAMETER;
    11841175        }
     
    12921283                rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_PAUSE);
    12931284                if (RT_FAILURE(rc))
    1294                     LogRelMax(64, ("Audio: Failed to pause stream '%s' after %s: %Rrc\n", pStreamEx->Core.szName, pszWhen, rc));
     1285                    LogRelMax(64, ("Audio: Failed to pause stream '%s' after %s: %Rrc\n", pStreamEx->Core.Cfg.szName, pszWhen, rc));
    12951286            }
    12961287        }
    12971288        else
    1298             LogRelMax(64, ("Audio: Failed to enable stream '%s' after %s: %Rrc\n", pStreamEx->Core.szName, pszWhen, rc));
     1289            LogRelMax(64, ("Audio: Failed to enable stream '%s' after %s: %Rrc\n", pStreamEx->Core.Cfg.szName, pszWhen, rc));
    12991290    }
    13001291    return rc;
     
    13101301static DECLCALLBACK(void) drvAudioStreamInitAsync(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx)
    13111302{
    1312     LogFlow(("pThis=%p pStreamEx=%p (%s)\n", pThis, pStreamEx, pStreamEx->Core.szName));
     1303    LogFlow(("pThis=%p pStreamEx=%p (%s)\n", pThis, pStreamEx, pStreamEx->Core.Cfg.szName));
    13131304
    13141305    int rc = RTCritSectRwEnterShared(&pThis->CritSectHotPlug);
     
    13531344         * Modify the play state if output stream.
    13541345         */
    1355         if (pStreamEx->Core.enmDir == PDMAUDIODIR_OUT)
     1346        if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT)
    13561347        {
    13571348            DRVAUDIOPLAYSTATE const enmPlayState = pStreamEx->Out.enmPlayState;
     
    13921383    else if (!fDestroyed)
    13931384    {
    1394         LogRelMax(64, ("Audio: Failed to initialize stream '%s': %Rrc\n", pStreamEx->Core.szName, rc));
     1385        LogRelMax(64, ("Audio: Failed to initialize stream '%s': %Rrc\n", pStreamEx->Core.Cfg.szName, rc));
    13951386    }
    13961387
     
    14211412 * @returns VBox status code.
    14221413 * @param   pThis       Pointer to driver instance.
    1423  * @param   pStreamEx   Audio stream to create the backend side for.
    1424  * @param   pCfgReq     Requested audio stream configuration to use for
    1425  *                      stream creation.
    1426  * @param   pCfgAcq     Acquired audio stream configuration returned by
    1427  *                      the backend.
     1414 * @param   pStreamEx   Stream to create backend for.  The Core.Cfg field
     1415 *                      contains the requested configuration when we're called
     1416 *                      and the actual configuration when successfully
     1417 *                      returning.
    14281418 *
    14291419 * @note    Configuration precedence for requested audio stream configuration (first has highest priority, if set):
     
    14331423 *          - default value
    14341424 */
    1435 static int drvAudioStreamCreateInternalBackend(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx,
    1436                                                PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq)
     1425static int drvAudioStreamCreateInternalBackend(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx)
    14371426{
    14381427    AssertMsg((pStreamEx->fStatus & PDMAUDIOSTREAM_STS_BACKEND_CREATED) == 0,
    1439               ("Stream '%s' already initialized in backend\n", pStreamEx->Core.szName));
    1440 
    1441     /*
    1442      * Adjust the requested stream config, applying our settings.
    1443      */
    1444     int rc = drvAudioStreamAdjustConfig(pThis, pCfgReq, pStreamEx->Core.szName);
     1428              ("Stream '%s' already initialized in backend\n", pStreamEx->Core.Cfg.szName));
     1429
     1430    /*
     1431     * Adjust the stream config, applying defaults and any overriding settings.
     1432     */
     1433    int rc = drvAudioStreamAdjustConfig(pThis, &pStreamEx->Core.Cfg, pStreamEx->Core.Cfg.szName);
    14451434    if (RT_FAILURE(rc))
    14461435        return rc;
    1447 
    1448     /*
    1449      * Make the acquired host configuration the requested host configuration initially,
    1450      * in case the backend does not report back an acquired configuration.
    1451      */
    1452     /** @todo r=bird: This is conveniently not documented in the interface... */
    1453     rc = PDMAudioStrmCfgCopy(pCfgAcq, pCfgReq);
    1454     if (RT_FAILURE(rc))
    1455     {
    1456         LogRel(("Audio: Creating stream '%s' with an invalid backend configuration not possible, skipping\n",
    1457                 pStreamEx->Core.szName));
    1458         return rc;
    1459     }
     1436    PDMAUDIOSTREAMCFG const CfgReq = pStreamEx->Core.Cfg;
    14601437
    14611438    /*
     
    14721449                            rc = VERR_STATE_CHANGED);
    14731450    if (RT_SUCCESS(rc))
    1474         rc = pThis->pHostDrvAudio->pfnStreamCreate(pThis->pHostDrvAudio, pStreamEx->pBackend, pCfgReq, pCfgAcq);
     1451        rc = pThis->pHostDrvAudio->pfnStreamCreate(pThis->pHostDrvAudio, pStreamEx->pBackend, &CfgReq, &pStreamEx->Core.Cfg);
    14751452    if (RT_SUCCESS(rc))
    14761453    {
     
    14911468        RTCritSectRwLeaveShared(&pThis->CritSectHotPlug);
    14921469        if (rc == VERR_NOT_SUPPORTED)
    1493             LogRel2(("Audio: Creating stream '%s' in backend not supported\n", pStreamEx->Core.szName));
     1470            LogRel2(("Audio: Creating stream '%s' in backend not supported\n", pStreamEx->Core.Cfg.szName));
    14941471        else if (rc == VERR_AUDIO_STREAM_COULD_NOT_CREATE)
    1495             LogRel2(("Audio: Stream '%s' could not be created in backend because of missing hardware / drivers\n", pStreamEx->Core.szName));
     1472            LogRel2(("Audio: Stream '%s' could not be created in backend because of missing hardware / drivers\n",
     1473                     pStreamEx->Core.Cfg.szName));
    14961474        else
    1497             LogRel(("Audio: Creating stream '%s' in backend failed with %Rrc\n", pStreamEx->Core.szName, rc));
     1475            LogRel(("Audio: Creating stream '%s' in backend failed with %Rrc\n", pStreamEx->Core.Cfg.szName, rc));
    14981476        return rc;
    14991477    }
     
    15071485             ("rc=%Rrc %s\n", rc, PDMHostAudioStreamStateGetName(pStreamEx->enmLastBackendState)));
    15081486
    1509     /* Validate acquired configuration. */
     1487    PPDMAUDIOSTREAMCFG const pCfgAcq = &pStreamEx->Core.Cfg;
     1488
     1489    /*
     1490     * Validate acquired configuration.
     1491     */
    15101492    char szTmp[PDMAUDIOPROPSTOSTRING_MAX];
     1493    LogFunc(("Backend returned: %s\n", PDMAudioStrmCfgToString(pCfgAcq, szTmp, sizeof(szTmp)) ));
    15111494    AssertLogRelMsgReturn(AudioHlpStreamCfgIsValid(pCfgAcq),
    15121495                          ("Audio: Creating stream '%s' returned an invalid backend configuration (%s), skipping\n",
    1513                            pStreamEx->Core.szName, PDMAudioPropsToString(&pCfgAcq->Props, szTmp, sizeof(szTmp))),
     1496                           pCfgAcq->szName, PDMAudioPropsToString(&pCfgAcq->Props, szTmp, sizeof(szTmp))),
    15141497                          VERR_INVALID_PARAMETER);
    15151498
    15161499    /* Let the user know that the backend changed one of the values requested above. */
    1517     if (pCfgAcq->Backend.cFramesBufferSize != pCfgReq->Backend.cFramesBufferSize)
    1518         LogRel2(("Audio: Buffer size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n",
    1519                  pStreamEx->Core.szName, PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesBufferSize), pCfgAcq->Backend.cFramesBufferSize));
    1520 
    1521     if (pCfgAcq->Backend.cFramesPeriod != pCfgReq->Backend.cFramesPeriod)
    1522         LogRel2(("Audio: Period size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n",
    1523                  pStreamEx->Core.szName, PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPeriod), pCfgAcq->Backend.cFramesPeriod));
     1500    if (pCfgAcq->Backend.cFramesBufferSize != CfgReq.Backend.cFramesBufferSize)
     1501        LogRel2(("Audio: Backend changed buffer size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
     1502                 PDMAudioPropsFramesToMilli(&CfgReq.Props, CfgReq.Backend.cFramesBufferSize), CfgReq.Backend.cFramesBufferSize,
     1503                 PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesBufferSize), pCfgAcq->Backend.cFramesBufferSize));
     1504
     1505    if (pCfgAcq->Backend.cFramesPeriod != CfgReq.Backend.cFramesPeriod)
     1506        LogRel2(("Audio: Backend changed period size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
     1507                 PDMAudioPropsFramesToMilli(&CfgReq.Props, CfgReq.Backend.cFramesPeriod), CfgReq.Backend.cFramesPeriod,
     1508                 PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPeriod), pCfgAcq->Backend.cFramesPeriod));
    15241509
    15251510    /* Was pre-buffering requested, but the acquired configuration from the backend told us something else? */
    1526     if (pCfgReq->Backend.cFramesPreBuffering)
    1527     {
    1528         if (pCfgAcq->Backend.cFramesPreBuffering != pCfgReq->Backend.cFramesPreBuffering)
    1529             LogRel2(("Audio: Pre-buffering size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n",
    1530                      pStreamEx->Core.szName, PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
     1511    if (CfgReq.Backend.cFramesPreBuffering)
     1512    {
     1513        if (pCfgAcq->Backend.cFramesPreBuffering != CfgReq.Backend.cFramesPreBuffering)
     1514            LogRel2(("Audio: Backend changed pre-buffering size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
     1515                     PDMAudioPropsFramesToMilli(&CfgReq.Props, CfgReq.Backend.cFramesPreBuffering), CfgReq.Backend.cFramesPreBuffering,
     1516                     PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
    15311517
    15321518        if (pCfgAcq->Backend.cFramesPreBuffering > pCfgAcq->Backend.cFramesBufferSize)
    15331519        {
    15341520            pCfgAcq->Backend.cFramesPreBuffering = pCfgAcq->Backend.cFramesBufferSize;
    1535             LogRel2(("Audio: Pre-buffering size bigger than buffer size for stream '%s', adjusting to %RU64ms (%RU32 frames)\n",
    1536                      pStreamEx->Core.szName, PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
     1521            LogRel2(("Audio: Pre-buffering size bigger than buffer size for stream '%s', adjusting to %RU64ms (%RU32 frames)\n", pCfgAcq->szName,
     1522                     PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
    15371523        }
    15381524    }
    1539     else if (pCfgReq->Backend.cFramesPreBuffering == 0) /* Was the pre-buffering requested as being disabeld? Tell the users. */
    1540     {
    1541         LogRel2(("Audio: Pre-buffering is disabled for stream '%s'\n", pStreamEx->Core.szName));
     1525    else if (CfgReq.Backend.cFramesPreBuffering == 0) /* Was the pre-buffering requested as being disabeld? Tell the users. */
     1526    {
     1527        LogRel2(("Audio: Pre-buffering is disabled for stream '%s'\n", pCfgAcq->szName));
    15421528        pCfgAcq->Backend.cFramesPreBuffering = 0;
    15431529    }
     
    15511537                    VERR_INVALID_PARAMETER);
    15521538
     1539    /*
     1540     * Check if the backend did return sane values and correct if necessary.
     1541     * Should never happen with our own backends, but you never know ...
     1542     */
     1543    uint32_t const cFramesPreBufferingMax = pCfgAcq->Backend.cFramesBufferSize - RT_MIN(16, pCfgAcq->Backend.cFramesBufferSize);
     1544    if (pCfgAcq->Backend.cFramesPreBuffering > cFramesPreBufferingMax)
     1545    {
     1546        LogRel2(("Audio: Warning: Pre-buffering size of %RU32 frames for stream '%s' is too close to or larger than the %RU32 frames buffer size, reducing it to %RU32 frames!\n",
     1547                 pCfgAcq->Backend.cFramesPreBuffering, pCfgAcq->szName, pCfgAcq->Backend.cFramesBufferSize, cFramesPreBufferingMax));
     1548        AssertFailed();
     1549        pCfgAcq->Backend.cFramesPreBuffering = cFramesPreBufferingMax;
     1550    }
     1551
     1552    if (pCfgAcq->Backend.cFramesPeriod > pCfgAcq->Backend.cFramesBufferSize)
     1553    {
     1554        LogRel2(("Audio: Warning: Period size of %RU32 frames for stream '%s' is larger than the %RU32 frames buffer size, reducing it to %RU32 frames!\n",
     1555                 pCfgAcq->Backend.cFramesPeriod, pCfgAcq->szName, pCfgAcq->Backend.cFramesBufferSize, pCfgAcq->Backend.cFramesBufferSize / 2));
     1556        AssertFailed();
     1557        pCfgAcq->Backend.cFramesPeriod = pCfgAcq->Backend.cFramesBufferSize / 2;
     1558    }
     1559
     1560    LogRel2(("Audio: Buffer size for stream '%s' is %RU64 ms / %RU32 frames\n", pCfgAcq->szName,
     1561             PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesBufferSize), pCfgAcq->Backend.cFramesBufferSize));
     1562    LogRel2(("Audio: Pre-buffering size for stream '%s' is %RU64 ms / %RU32 frames\n", pCfgAcq->szName,
     1563             PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
     1564    LogRel2(("Audio: Scheduling hint for stream '%s' is %RU32ms / %RU32 frames\n", pCfgAcq->szName,
     1565             pCfgAcq->Device.cMsSchedulingHint, PDMAudioPropsMilliToFrames(&pCfgAcq->Props, pCfgAcq->Device.cMsSchedulingHint)));
     1566
     1567    /* Make sure the configured buffer size by the backend at least can hold the configured latency. */
     1568    uint32_t const cMsPeriod = PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPeriod);
     1569    LogRel2(("Audio: Period size of stream '%s' is %RU64 ms / %RU32 frames\n",
     1570             pCfgAcq->szName, cMsPeriod, pCfgAcq->Backend.cFramesPeriod));
     1571    /** @todo r=bird: This is probably a misleading/harmless warning as we'd just
     1572     *        have to transfer more each time we move data.  The period is generally
     1573     *        pure irrelevant fiction anyway.  A more relevant comparison would
     1574     *        be to half the buffer size, i.e. making sure we get scheduled often
     1575     *        enough to keep the buffer at least half full (probably more
     1576     *        sensible if the buffer size was more than 2x scheduling periods). */
     1577    if (   CfgReq.Device.cMsSchedulingHint              /* Any scheduling hint set? */
     1578        && CfgReq.Device.cMsSchedulingHint > cMsPeriod) /* This might lead to buffer underflows. */
     1579        LogRel(("Audio: Warning: Scheduling hint of stream '%s' is bigger (%RU64ms) than used period size (%RU64ms)\n",
     1580                pCfgAcq->szName, CfgReq.Device.cMsSchedulingHint, cMsPeriod));
     1581
     1582    /*
     1583     * Done, just log the result:
     1584     */
     1585    LogFunc(("[%s] Acquired format: %s\n",  pCfgAcq->szName,
     1586             PDMAudioStrmCfgToString(&pStreamEx->Core.Cfg, szTmp, sizeof(szTmp)) ));
     1587    LogRel2(("Audio: Acquired format: %s\n", PDMAudioStrmCfgToString(&pStreamEx->Core.Cfg, szTmp, sizeof(szTmp)) ));
     1588
    15531589    return VINF_SUCCESS;
    15541590}
     
    15601596 * @returns VBox status code.
    15611597 * @param   pThis       Pointer to driver instance.
    1562  * @param   pStreamEx   Stream to initialize.
    1563  * @param   pCfgHost    Stream configuration to use for the host side (backend).
    1564  *                      This will be adjusted.
    1565  * @param   pCfgGuest   Stream configuration to use for the guest side.
    1566  */
    1567 static int drvAudioStreamInitInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx,
    1568                                       PPDMAUDIOSTREAMCFG pCfgHost, PCPDMAUDIOSTREAMCFG pCfgGuest)
     1598 * @param   pStreamEx   Stream to initialize.  Caller already set a few fields.
     1599 *                      The Core.Cfg field contains the requested configuration
     1600 *                      when we're called and the actual configuration when
     1601 *                      successfully returning.
     1602 */
     1603static int drvAudioStreamInitInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx)
    15691604{
    15701605    /*
     
    15731608    pStreamEx->Core.uMagic = PDMAUDIOSTREAM_MAGIC;
    15741609
    1575 #ifdef LOG_ENABLED
    1576     LogFunc(("[%s] Requested host format:\n", pStreamEx->Core.szName));
    1577     PDMAudioStrmCfgLog(pCfgHost);
    1578 #endif
    1579 
    1580     LogRel2(("Audio: Creating stream '%s'\n", pStreamEx->Core.szName));
    1581     LogRel2(("Audio: Guest %s format for '%s': %RU32Hz, %u%s, %RU8 channel%s\n",
    1582              pCfgGuest->enmDir == PDMAUDIODIR_IN ? "recording" : "playback", pStreamEx->Core.szName,
    1583              pCfgGuest->Props.uHz, PDMAudioPropsSampleBits(&pCfgGuest->Props), pCfgGuest->Props.fSigned ? "S" : "U",
    1584              PDMAudioPropsChannels(&pCfgGuest->Props), PDMAudioPropsChannels(&pCfgGuest->Props) == 1 ? "" : "s"));
    1585     LogRel2(("Audio: Requested host %s format for '%s': %RU32Hz, %u%s, %RU8 channel%s\n",
    1586              pCfgHost->enmDir == PDMAUDIODIR_IN ? "recording" : "playback", pStreamEx->Core.szName,
    1587              pCfgHost->Props.uHz, PDMAudioPropsSampleBits(&pCfgHost->Props), pCfgHost->Props.fSigned ? "S" : "U",
    1588              PDMAudioPropsChannels(&pCfgHost->Props), PDMAudioPropsChannels(&pCfgHost->Props) == 1 ? "" : "s"));
    1589 
    1590     PDMAUDIOSTREAMCFG CfgHostAcq;
    1591     int rc = drvAudioStreamCreateInternalBackend(pThis, pStreamEx, pCfgHost, &CfgHostAcq);
     1610    char szTmp[PDMAUDIOSTRMCFGTOSTRING_MAX];
     1611    LogFunc(("[%s] Requested host format: %s\n", pStreamEx->Core.Cfg.szName,
     1612             PDMAudioStrmCfgToString(&pStreamEx->Core.Cfg, szTmp, sizeof(szTmp)) ));
     1613    LogRel2(("Audio: Creating stream: %s\n", PDMAudioStrmCfgToString(&pStreamEx->Core.Cfg, szTmp, sizeof(szTmp))));
     1614
     1615    int rc = drvAudioStreamCreateInternalBackend(pThis, pStreamEx);
    15921616    if (RT_FAILURE(rc))
    15931617        return rc;
    15941618
    1595     LogFunc(("[%s] Acquired host format:\n",  pStreamEx->Core.szName));
    1596     PDMAudioStrmCfgLog(&CfgHostAcq);
    1597     LogRel2(("Audio: Acquired host %s format for '%s': %RU32Hz, %u%s, %RU8 channel%s\n",
    1598              CfgHostAcq.enmDir == PDMAUDIODIR_IN ? "recording" : "playback",  pStreamEx->Core.szName,
    1599              CfgHostAcq.Props.uHz, PDMAudioPropsSampleBits(&CfgHostAcq.Props), CfgHostAcq.Props.fSigned ? "S" : "U",
    1600              PDMAudioPropsChannels(&CfgHostAcq.Props), PDMAudioPropsChannels(&CfgHostAcq.Props) == 1 ? "" : "s"));
    1601     Assert(PDMAudioPropsAreValid(&CfgHostAcq.Props));
    1602 
    1603     /* Set the stream properties. */
    1604     pStreamEx->Core.Props = CfgHostAcq.Props;
    1605 
    1606     /* Let the user know if the backend changed some of the tweakable values. */
    1607     if (CfgHostAcq.Backend.cFramesBufferSize != pCfgHost->Backend.cFramesBufferSize)
    1608         LogRel2(("Audio: Backend changed buffer size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
    1609                  PDMAudioPropsFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesBufferSize), pCfgHost->Backend.cFramesBufferSize,
    1610                  PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesBufferSize), CfgHostAcq.Backend.cFramesBufferSize));
    1611 
    1612     if (CfgHostAcq.Backend.cFramesPeriod != pCfgHost->Backend.cFramesPeriod)
    1613         LogRel2(("Audio: Backend changed period size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
    1614                  PDMAudioPropsFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesPeriod), pCfgHost->Backend.cFramesPeriod,
    1615                  PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPeriod), CfgHostAcq.Backend.cFramesPeriod));
    1616 
    1617     if (CfgHostAcq.Backend.cFramesPreBuffering != pCfgHost->Backend.cFramesPreBuffering)
    1618         LogRel2(("Audio: Backend changed pre-buffering size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
    1619                  PDMAudioPropsFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesPreBuffering), pCfgHost->Backend.cFramesPreBuffering,
    1620                  PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering), CfgHostAcq.Backend.cFramesPreBuffering));
    1621 
    1622     /*
    1623      * Check if the backend did return sane values and correct if necessary.
    1624      * Should never happen with our own backends, but you never know ...
    1625      */
    1626     uint32_t const cFramesPreBufferingMax = CfgHostAcq.Backend.cFramesBufferSize - RT_MIN(16, CfgHostAcq.Backend.cFramesBufferSize);
    1627     if (CfgHostAcq.Backend.cFramesPreBuffering > cFramesPreBufferingMax)
    1628     {
    1629         LogRel2(("Audio: Warning: Pre-buffering size of %RU32 frames for stream '%s' is too close to or larger than the %RU32 frames buffer size, reducing it to %RU32 frames!\n",
    1630                  CfgHostAcq.Backend.cFramesPreBuffering, pStreamEx->Core.szName, CfgHostAcq.Backend.cFramesBufferSize, cFramesPreBufferingMax));
    1631         AssertFailed();
    1632         CfgHostAcq.Backend.cFramesPreBuffering = cFramesPreBufferingMax;
    1633     }
    1634 
    1635     if (CfgHostAcq.Backend.cFramesPeriod > CfgHostAcq.Backend.cFramesBufferSize)
    1636     {
    1637         LogRel2(("Audio: Warning: Period size of %RU32 frames for stream '%s' is larger than the %RU32 frames buffer size, reducing it to %RU32 frames!\n",
    1638                  CfgHostAcq.Backend.cFramesPeriod, pStreamEx->Core.szName, CfgHostAcq.Backend.cFramesBufferSize, CfgHostAcq.Backend.cFramesBufferSize / 2));
    1639         AssertFailed();
    1640         CfgHostAcq.Backend.cFramesPeriod = CfgHostAcq.Backend.cFramesBufferSize / 2;
    1641     }
    1642 
    1643     LogRel2(("Audio: Buffer size of stream '%s' is %RU64 ms / %RU32 frames\n", pStreamEx->Core.szName,
    1644              PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesBufferSize), CfgHostAcq.Backend.cFramesBufferSize));
    1645     LogRel2(("Audio: Pre-buffering size of stream '%s' is %RU64 ms / %RU32 frames\n", pStreamEx->Core.szName,
    1646              PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering), CfgHostAcq.Backend.cFramesPreBuffering));
    1647 
    1648     /* Make sure the configured buffer size by the backend at least can hold the configured latency. */
    1649     const uint32_t msPeriod = PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPeriod);
    1650     LogRel2(("Audio: Period size of stream '%s' is %RU64 ms / %RU32 frames\n",
    1651              pStreamEx->Core.szName, msPeriod, CfgHostAcq.Backend.cFramesPeriod));
    1652 
    1653     if (   pCfgGuest->Device.cMsSchedulingHint             /* Any scheduling hint set? */
    1654         && pCfgGuest->Device.cMsSchedulingHint > msPeriod) /* This might lead to buffer underflows. */
    1655         LogRel(("Audio: Warning: Scheduling hint of stream '%s' is bigger (%RU64ms) than used period size (%RU64ms)\n",
    1656                 pStreamEx->Core.szName, pCfgGuest->Device.cMsSchedulingHint, msPeriod));
    1657 
    1658     /*
    1659      * Make a copy of the acquired host stream configuration and the guest side one.
    1660      */
    1661     rc = PDMAudioStrmCfgCopy(&pStreamEx->Host.Cfg, &CfgHostAcq);
    1662     AssertRC(rc);
    1663 
    1664     rc = PDMAudioStrmCfgCopy(&pStreamEx->Guest.Cfg, pCfgGuest);
    1665     AssertRC(rc);
    1666 
    16671619    /*
    16681620     * Configure host buffers.
    16691621     */
    16701622    Assert(pStreamEx->cbPreBufThreshold == 0);
    1671     if (CfgHostAcq.Backend.cFramesPreBuffering != 0)
    1672         pStreamEx->cbPreBufThreshold = PDMAudioPropsFramesToBytes(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering);
     1623    if (pStreamEx->Core.Cfg.Backend.cFramesPreBuffering != 0)
     1624        pStreamEx->cbPreBufThreshold = PDMAudioPropsFramesToBytes(&pStreamEx->Core.Cfg.Props,
     1625                                                                  pStreamEx->Core.Cfg.Backend.cFramesPreBuffering);
    16731626
    16741627    /* Allocate space for pre-buffering of output stream w/o mixing buffers. */
    1675     if (pCfgHost->enmDir == PDMAUDIODIR_OUT)
     1628    if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT)
    16761629    {
    16771630        Assert(pStreamEx->Out.cbPreBufAlloc == 0);
    16781631        Assert(pStreamEx->Out.cbPreBuffered == 0);
    16791632        Assert(pStreamEx->Out.offPreBuf == 0);
    1680         if (CfgHostAcq.Backend.cFramesPreBuffering != 0)
     1633        if (pStreamEx->Core.Cfg.Backend.cFramesPreBuffering != 0)
    16811634        {
    1682             pStreamEx->Out.cbPreBufAlloc     = PDMAudioPropsFramesToBytes(&CfgHostAcq.Props,
    1683                                                                           CfgHostAcq.Backend.cFramesBufferSize - 2);
     1635            pStreamEx->Out.cbPreBufAlloc     = PDMAudioPropsFramesToBytes(&pStreamEx->Core.Cfg.Props,
     1636                                                                          pStreamEx->Core.Cfg.Backend.cFramesBufferSize - 2);
    16841637            pStreamEx->Out.cbPreBufAlloc     = RT_MIN(RT_ALIGN_32(pStreamEx->cbPreBufThreshold + _8K, _4K),
    16851638                                                      pStreamEx->Out.cbPreBufAlloc);
     
    16911644
    16921645    /*
    1693      * Init guest stream.
    1694      */
    1695     if (pCfgGuest->Device.cMsSchedulingHint)
    1696         LogRel2(("Audio: Stream '%s' got a scheduling hint of %RU32ms (%RU32 bytes)\n",
    1697                  pStreamEx->Core.szName, pCfgGuest->Device.cMsSchedulingHint,
    1698                  PDMAudioPropsMilliToBytes(&pCfgGuest->Props, pCfgGuest->Device.cMsSchedulingHint)));
    1699 
    1700     /*
    17011646     * Register statistics.
    17021647     */
    17031648    PPDMDRVINS const pDrvIns = pThis->pDrvIns;
    17041649    /** @todo expose config and more. */
    1705     PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->Host.Cfg.Backend.cFramesBufferSize, STAMTYPE_U32, STAMVISIBILITY_USED, STAMUNIT_NONE,
    1706                            "Host side: The size of the backend buffer (in frames)", "%s/0-HostBackendBufSize", pStreamEx->Core.szName);
    1707     if (pCfgGuest->enmDir == PDMAUDIODIR_IN)
     1650    PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->Core.Cfg.Backend.cFramesBufferSize, STAMTYPE_U32, STAMVISIBILITY_USED, STAMUNIT_NONE,
     1651                           "Host side: The size of the backend buffer (in frames)", "%s/0-HostBackendBufSize", pStreamEx->Core.Cfg.szName);
     1652    if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_IN)
    17081653    {
    17091654        /** @todo later? */
     
    17121657    {
    17131658        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->Out.Stats.cbBackendWritableBefore, STAMTYPE_U32, STAMVISIBILITY_USED, STAMUNIT_NONE,
    1714                                "Host side: Free space in backend buffer before play", "%s/0-HostBackendBufFreeBefore", pStreamEx->Core.szName);
     1659                               "Host side: Free space in backend buffer before play", "%s/0-HostBackendBufFreeBefore", pStreamEx->Core.Cfg.szName);
    17151660        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->Out.Stats.cbBackendWritableAfter, STAMTYPE_U32, STAMVISIBILITY_USED, STAMUNIT_NONE,
    1716                                "Host side: Free space in backend buffer after play",  "%s/0-HostBackendBufFreeAfter", pStreamEx->Core.szName);
     1661                               "Host side: Free space in backend buffer after play",  "%s/0-HostBackendBufFreeAfter", pStreamEx->Core.Cfg.szName);
    17171662    }
    17181663
    17191664#ifdef VBOX_WITH_STATISTICS
    1720     if (pCfgGuest->enmDir == PDMAUDIODIR_IN)
     1665    if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_IN)
    17211666    {
    17221667        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->In.Stats.TotalFramesCaptured, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
    1723                                "Total frames played.", "%s/TotalFramesCaptured", pStreamEx->Core.szName);
     1668                               "Total frames played.", "%s/TotalFramesCaptured", pStreamEx->Core.Cfg.szName);
    17241669        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->In.Stats.TotalTimesCaptured, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
    1725                                "Total number of playbacks.", "%s/TotalTimesCaptured", pStreamEx->Core.szName);
     1670                               "Total number of playbacks.", "%s/TotalTimesCaptured", pStreamEx->Core.Cfg.szName);
    17261671        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->In.Stats.TotalTimesRead, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
    1727                                "Total number of reads.", "%s/TotalTimesRead", pStreamEx->Core.szName);
     1672                               "Total number of reads.", "%s/TotalTimesRead", pStreamEx->Core.Cfg.szName);
    17281673    }
    17291674    else
    17301675    {
    1731         Assert(pCfgGuest->enmDir == PDMAUDIODIR_OUT);
     1676        Assert(pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT);
    17321677    }
    17331678#endif /* VBOX_WITH_STATISTICS */
    17341679
    1735     LogFlowFunc(("[%s] Returning %Rrc\n", pStreamEx->Core.szName, rc));
     1680    LogFlowFunc(("[%s] Returning %Rrc\n", pStreamEx->Core.Cfg.szName, rc));
    17361681    return rc;
    17371682}
     
    17411686 * @interface_method_impl{PDMIAUDIOCONNECTOR,pfnStreamCreate}
    17421687 */
    1743 static DECLCALLBACK(int) drvAudioStreamCreate(PPDMIAUDIOCONNECTOR pInterface, uint32_t fFlags, PPDMAUDIOSTREAMCFG pCfgHost,
    1744                                               PPDMAUDIOSTREAMCFG pCfgGuest, PPDMAUDIOSTREAM *ppStream)
     1688static DECLCALLBACK(int) drvAudioStreamCreate(PPDMIAUDIOCONNECTOR pInterface, uint32_t fFlags, PCPDMAUDIOSTREAMCFG pCfgReq,
     1689                                              PPDMAUDIOSTREAM *ppStream)
    17451690{
    17461691    PDRVAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVAUDIO, IAudioConnector);
     
    17511696     */
    17521697    AssertReturn(!(fFlags & ~PDMAUDIOSTREAM_CREATE_F_NO_MIXBUF), VERR_INVALID_FLAGS);
    1753     AssertPtrReturn(pCfgHost,  VERR_INVALID_POINTER);
    1754     AssertPtrReturn(pCfgGuest, VERR_INVALID_POINTER);
    1755     AssertPtrReturn(ppStream,   VERR_INVALID_POINTER);
    1756     LogFlowFunc(("Host=%s, Guest=%s\n", pCfgHost->szName, pCfgGuest->szName));
     1698    AssertPtrReturn(pCfgReq, VERR_INVALID_POINTER);
     1699    AssertPtrReturn(ppStream, VERR_INVALID_POINTER);
     1700    *ppStream = NULL;
     1701    LogFlowFunc(("pCfgReq=%s\n", pCfgReq->szName));
    17571702#ifdef LOG_ENABLED
    1758     PDMAudioStrmCfgLog(pCfgHost);
    1759     PDMAudioStrmCfgLog(pCfgGuest);
     1703    PDMAudioStrmCfgLog(pCfgReq);
    17601704#endif
    1761     AssertReturn(AudioHlpStreamCfgIsValid(pCfgHost), VERR_INVALID_PARAMETER);
    1762     AssertReturn(AudioHlpStreamCfgIsValid(pCfgGuest), VERR_INVALID_PARAMETER);
    1763     AssertReturn(pCfgHost->enmDir == pCfgGuest->enmDir, VERR_MISMATCH);
    1764     AssertReturn(pCfgHost->enmDir == PDMAUDIODIR_IN || pCfgHost->enmDir == PDMAUDIODIR_OUT, VERR_NOT_SUPPORTED);
     1705    AssertReturn(AudioHlpStreamCfgIsValid(pCfgReq), VERR_INVALID_PARAMETER);
     1706    AssertReturn(pCfgReq->enmDir == PDMAUDIODIR_IN || pCfgReq->enmDir == PDMAUDIODIR_OUT, VERR_NOT_SUPPORTED);
    17651707
    17661708    /*
     
    17701712    AssertRCReturn(rc, rc);
    17711713
    1772     uint32_t * const pcFreeStreams = pCfgHost->enmDir == PDMAUDIODIR_IN ? &pThis->In.cStreamsFree : &pThis->Out.cStreamsFree;
     1714    uint32_t * const pcFreeStreams = pCfgReq->enmDir == PDMAUDIODIR_IN ? &pThis->In.cStreamsFree : &pThis->Out.cStreamsFree;
    17731715    if (*pcFreeStreams > 0)
    17741716        *pcFreeStreams -= 1;
     
    17761718    {
    17771719        RTCritSectRwLeaveExcl(&pThis->CritSectGlobals);
    1778         LogFlowFunc(("Maximum number of host %s streams reached\n", PDMAudioDirGetName(pCfgHost->enmDir) ));
    1779         return pCfgHost->enmDir == PDMAUDIODIR_IN ? VERR_AUDIO_NO_FREE_INPUT_STREAMS : VERR_AUDIO_NO_FREE_OUTPUT_STREAMS;
     1720        LogFlowFunc(("Maximum number of host %s streams reached\n", PDMAudioDirGetName(pCfgReq->enmDir) ));
     1721        return pCfgReq->enmDir == PDMAUDIODIR_IN ? VERR_AUDIO_NO_FREE_INPUT_STREAMS : VERR_AUDIO_NO_FREE_OUTPUT_STREAMS;
    17801722    }
    17811723
     
    18111753
    18121754                pStreamEx->pBackend             = pBackend;
    1813                 pStreamEx->Core.enmDir          = pCfgHost->enmDir;
     1755                pStreamEx->Core.Cfg             = *pCfgReq;
    18141756                pStreamEx->Core.cbBackend       = (uint32_t)cbHstStrm;
    18151757                pStreamEx->fDestroyImmediate    = true;
     
    18191761                /* Make a unqiue stream name including the host (backend) driver name. */
    18201762                AssertPtr(pThis->pHostDrvAudio);
    1821                 size_t cchName = RTStrPrintf(pStreamEx->Core.szName, RT_ELEMENTS(pStreamEx->Core.szName), "[%s] %s:0",
    1822                                              pThis->BackendCfg.szName, pCfgHost->szName[0] != '\0' ? pCfgHost->szName : "<NoName>");
    1823                 if (cchName < sizeof(pStreamEx->Core.szName))
     1763                size_t cchName = RTStrPrintf(pStreamEx->Core.Cfg.szName, RT_ELEMENTS(pStreamEx->Core.Cfg.szName), "[%s] %s:0",
     1764                                             pThis->BackendCfg.szName, pCfgReq->szName[0] != '\0' ? pCfgReq->szName : "<NoName>");
     1765                if (cchName < sizeof(pStreamEx->Core.Cfg.szName))
    18241766                {
    18251767                    RTCritSectRwEnterShared(&pThis->CritSectGlobals);
     
    18301772                        RTListForEach(&pThis->LstStreams, pIt, DRVAUDIOSTREAM, ListEntry)
    18311773                        {
    1832                             if (strcmp(pIt->Core.szName, pStreamEx->Core.szName) == 0)
     1774                            if (strcmp(pIt->Core.Cfg.szName, pStreamEx->Core.Cfg.szName) == 0)
    18331775                            {
    1834                                 RTStrPrintf(pStreamEx->Core.szName, RT_ELEMENTS(pStreamEx->Core.szName), "[%s] %s:%u",
    1835                                             pThis->BackendCfg.szName, pCfgHost->szName[0] != '\0' ? pCfgHost->szName : "<NoName>",
     1776                                RTStrPrintf(pStreamEx->Core.Cfg.szName, RT_ELEMENTS(pStreamEx->Core.Cfg.szName), "[%s] %s:%u",
     1777                                            pThis->BackendCfg.szName, pCfgReq->szName[0] != '\0' ? pCfgReq->szName : "<NoName>",
    18361778                                            i);
    18371779                                fDone = false;
     
    18481790                 * Try to init the rest.
    18491791                 */
    1850                 rc = drvAudioStreamInitInternal(pThis, pStreamEx, pCfgHost, pCfgGuest);
     1792                rc = drvAudioStreamInitInternal(pThis, pStreamEx);
    18511793                if (RT_SUCCESS(rc))
    18521794                {
     
    18661808                     * Init debug stuff if enabled (ignore failures).
    18671809                     */
    1868                     if (pCfgHost->enmDir == PDMAUDIODIR_IN)
     1810                    if (pCfgReq->enmDir == PDMAUDIODIR_IN)
    18691811                    {
    18701812                        if (pThis->CfgIn.Dbg.fEnabled)
    18711813                            AudioHlpFileCreateAndOpen(&pStreamEx->In.Dbg.pFileCapture, pThis->CfgIn.Dbg.szPathOut,
    1872                                                       "DrvAudioCapture", pThis->pDrvIns->iInstance, &pStreamEx->Host.Cfg.Props);
     1814                                                      "DrvAudioCapture", pThis->pDrvIns->iInstance, &pStreamEx->Core.Cfg.Props);
    18731815                    }
    18741816                    else /* Out */
     
    18761818                        if (pThis->CfgOut.Dbg.fEnabled)
    18771819                            AudioHlpFileCreateAndOpen(&pStreamEx->Out.Dbg.pFilePlay, pThis->CfgOut.Dbg.szPathOut,
    1878                                                       "DrvAudioPlay", pThis->pDrvIns->iInstance, &pStreamEx->Host.Cfg.Props);
     1820                                                      "DrvAudioPlay", pThis->pDrvIns->iInstance, &pStreamEx->Core.Cfg.Props);
    18791821                    }
    18801822
     
    19571899    char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    19581900#endif
    1959     LogFunc(("[%s] fStatus=%s\n", pStreamEx->Core.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
     1901    LogFunc(("[%s] fStatus=%s\n", pStreamEx->Core.Cfg.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    19601902
    19611903    if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_BACKEND_CREATED)
     
    19741916    }
    19751917
    1976     LogFlowFunc(("[%s] Returning %Rrc\n", pStreamEx->Core.szName, rc));
     1918    LogFlowFunc(("[%s] Returning %Rrc\n", pStreamEx->Core.Cfg.szName, rc));
    19771919    return rc;
    19781920}
     
    19911933    AssertPtrReturn(pThis,   VERR_INVALID_POINTER);
    19921934    AssertMsgReturn(pStreamEx->cRefs <= 1,
    1993                     ("Stream '%s' still has %RU32 references held when uninitializing\n", pStreamEx->Core.szName, pStreamEx->cRefs),
     1935                    ("Stream '%s' still has %RU32 references held when uninitializing\n", pStreamEx->Core.Cfg.szName, pStreamEx->cRefs),
    19941936                    VERR_WRONG_ORDER);
    1995     LogFlowFunc(("[%s] cRefs=%RU32\n", pStreamEx->Core.szName, pStreamEx->cRefs));
     1937    LogFlowFunc(("[%s] cRefs=%RU32\n", pStreamEx->Core.Cfg.szName, pStreamEx->cRefs));
    19961938
    19971939    RTCritSectEnter(&pStreamEx->Core.CritSect);
     
    20051947
    20061948    /* Free pre-buffer space. */
    2007     if (   pStreamEx->Core.enmDir == PDMAUDIODIR_OUT
     1949    if (   pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT
    20081950        && pStreamEx->Out.pbPreBuf)
    20091951    {
     
    20221964            char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    20231965            LogFunc(("[%s] Warning: Still has %s set when uninitializing\n",
    2024                      pStreamEx->Core.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
     1966                     pStreamEx->Core.Cfg.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    20251967        }
    20261968#endif
     
    20291971
    20301972    PPDMDRVINS const pDrvIns = pThis->pDrvIns;
    2031     PDMDrvHlpSTAMDeregisterByPrefix(pDrvIns, pStreamEx->Core.szName);
    2032 
    2033     if (pStreamEx->Core.enmDir == PDMAUDIODIR_IN)
     1973    PDMDrvHlpSTAMDeregisterByPrefix(pDrvIns, pStreamEx->Core.Cfg.szName);
     1974
     1975    if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_IN)
    20341976    {
    20351977        if (pThis->CfgIn.Dbg.fEnabled)
     
    20411983    else
    20421984    {
    2043         Assert(pStreamEx->Core.enmDir == PDMAUDIODIR_OUT);
     1985        Assert(pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT);
    20441986        if (pThis->CfgOut.Dbg.fEnabled)
    20451987        {
     
    20872029            RTCritSectRwEnterExcl(&pThis->CritSectGlobals);
    20882030
    2089             if (pStreamEx->Core.enmDir == PDMAUDIODIR_IN)
     2031            if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_IN)
    20902032                pThis->In.cStreamsFree++;
    20912033            else /* Out */
     
    21012043        else
    21022044        {
    2103             LogRel(("Audio: Uninitializing stream '%s' failed with %Rrc\n", pStreamEx->Core.szName, rc));
     2045            LogRel(("Audio: Uninitializing stream '%s' failed with %Rrc\n", pStreamEx->Core.Cfg.szName, rc));
    21042046            /** @todo r=bird: What's the plan now? */
    21052047        }
     
    21112053    }
    21122054
    2113     Log12Func(("returns %u (%s)\n", cRefs, cRefs > 0 ? pStreamEx->Core.szName : "destroyed"));
     2055    Log12Func(("returns %u (%s)\n", cRefs, cRefs > 0 ? pStreamEx->Core.Cfg.szName : "destroyed"));
    21142056    return cRefs;
    21152057}
     
    21272069static DECLCALLBACK(void) drvAudioStreamDestroyAsync(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx, bool fImmediate)
    21282070{
    2129     LogFlowFunc(("pThis=%p pStreamEx=%p (%s) fImmediate=%RTbool\n", pThis, pStreamEx, pStreamEx->Core.szName, fImmediate));
     2071    LogFlowFunc(("pThis=%p pStreamEx=%p (%s) fImmediate=%RTbool\n", pThis, pStreamEx, pStreamEx->Core.Cfg.szName, fImmediate));
    21302072#ifdef LOG_ENABLED
    21312073    uint64_t const nsStart = RTTimeNanoTS();
     
    21662108    PDRVAUDIOSTREAM pStreamEx = (PDRVAUDIOSTREAM)pStream;   /* Note! Do not touch pStream after this! */
    21672109    AssertPtrReturn(pStreamEx, VERR_INVALID_POINTER);
    2168     LogFlowFunc(("ENTER - %p (%s) fImmediate=%RTbool\n", pStreamEx, pStreamEx->Core.szName, fImmediate));
     2110    LogFlowFunc(("ENTER - %p (%s) fImmediate=%RTbool\n", pStreamEx, pStreamEx->Core.Cfg.szName, fImmediate));
    21692111    AssertReturn(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC, VERR_INVALID_MAGIC);
    21702112    AssertReturn(pStreamEx->uMagic == DRVAUDIOSTREAM_MAGIC, VERR_INVALID_MAGIC);
     
    21852127            char szStatus[DRVAUDIO_STATUS_STR_MAX];
    21862128            LogRel2(("Audio: Destroying stream '%s': cRefs=%u; status: %s; backend: %s; hReqInitAsync=%p\n",
    2187                      pStreamEx->Core.szName, pStreamEx->cRefs, drvAudioStreamStatusToStr(szStatus, pStreamEx->fStatus),
     2129                     pStreamEx->Core.Cfg.szName, pStreamEx->cRefs, drvAudioStreamStatusToStr(szStatus, pStreamEx->fStatus),
    21882130                     PDMHostAudioStreamStateGetName(drvAudioStreamGetBackendState(pThis, pStreamEx)),
    21892131                     pStreamEx->hReqInitAsync));
     
    22632205static void drvAudioStreamResetInternal(PDRVAUDIOSTREAM pStreamEx)
    22642206{
    2265     LogFunc(("[%s]\n", pStreamEx->Core.szName));
     2207    LogFunc(("[%s]\n", pStreamEx->Core.Cfg.szName));
    22662208    Assert(RTCritSectIsOwner(&pStreamEx->Core.CritSect));
    22672209
     
    22692211    pStreamEx->nsLastPlayedCaptured = 0;
    22702212    pStreamEx->nsLastReadWritten    = 0;
    2271     if (pStreamEx->Host.Cfg.enmDir == PDMAUDIODIR_OUT)
     2213    if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT)
    22722214    {
    22732215        pStreamEx->Out.cbPreBuffered = 0;
     
    22982240{
    22992241    char szTmp[RT_MAX(PDMAUDIOSTRMCFGTOSTRING_MAX, DRVAUDIO_STATUS_STR_MAX)];
    2300     LogFlowFunc(("[%s] status: %s\n", pStreamEx->Core.szName, drvAudioStreamStatusToStr(szTmp, pStreamEx->fStatus) ));
     2242    LogFlowFunc(("[%s] status: %s\n", pStreamEx->Core.Cfg.szName, drvAudioStreamStatusToStr(szTmp, pStreamEx->fStatus) ));
    23012243    Assert(RTCritSectIsOwner(&pStreamEx->Core.CritSect));
    23022244    RTCritSectRwEnterShared(&pThis->CritSectHotPlug);
     
    23172259        drvAudioStreamResetInternal(pStreamEx);
    23182260
    2319 /** @todo
    2320  *  We need to zero the backend storage here!!
    2321  *  We need to zero the backend storage here!!
    2322  *  We need to zero the backend storage here!!
    2323  *  We need to zero the backend storage here!!
    2324  *  We need to zero the backend storage here!!
    2325  *  We need to zero the backend storage here!!
    2326  *  We need to zero the backend storage here!!
    2327  *   */
    2328         PDMAUDIOSTREAMCFG CfgHostAcq;
    2329         rc = drvAudioStreamCreateInternalBackend(pThis, pStreamEx, &pStreamEx->Host.Cfg, &CfgHostAcq);
     2261        RT_BZERO(pStreamEx->pBackend + 1, pStreamEx->Core.cbBackend - sizeof(*pStreamEx->pBackend));
     2262
     2263        rc = drvAudioStreamCreateInternalBackend(pThis, pStreamEx);
    23302264        if (RT_SUCCESS(rc))
    23312265        {
    23322266            LogFunc(("[%s] Acquired host format: %s\n",
    2333                      pStreamEx->Core.szName, PDMAudioStrmCfgToString(&CfgHostAcq, szTmp, sizeof(szTmp)) ));
    2334             /** @todo Validate (re-)acquired configuration with pStreamEx->Core.Host.Cfg?
     2267                     pStreamEx->Core.Cfg.szName, PDMAudioStrmCfgToString(&pStreamEx->Core.Cfg, szTmp, sizeof(szTmp)) ));
     2268            /** @todo Validate (re-)acquired configuration with pStreamEx->Core.Core.Cfg?
    23352269             * drvAudioStreamInitInternal() does some setup and a bunch of
    23362270             * validations + adjustments of the stream config, so this surely is quite
     
    23732307                else
    23742308                {
    2375                     LogRel(("Audio: Re-initializing stream '%s' somehow failed, status: %s\n", pStreamEx->Core.szName,
     2309                    LogRel(("Audio: Re-initializing stream '%s' somehow failed, status: %s\n", pStreamEx->Core.Cfg.szName,
    23762310                            drvAudioStreamStatusToStr(szTmp, pStreamEx->fStatus) ));
    23772311                    AssertFailed();
     
    23812315        }
    23822316        else
    2383             LogRel(("Audio: Re-initializing stream '%s' failed with %Rrc\n", pStreamEx->Core.szName, rc));
     2317            LogRel(("Audio: Re-initializing stream '%s' failed with %Rrc\n", pStreamEx->Core.Cfg.szName, rc));
    23842318    }
    23852319    else
    23862320    {
    2387         LogRel(("Audio: Re-initializing stream '%s' failed to destroy previous backend.\n", pStreamEx->Core.szName));
     2321        LogRel(("Audio: Re-initializing stream '%s' failed to destroy previous backend.\n", pStreamEx->Core.Cfg.szName));
    23882322        AssertFailed();
    23892323    }
    23902324
    23912325    RTCritSectRwLeaveShared(&pThis->CritSectHotPlug);
    2392     LogFunc(("[%s] Returning %Rrc\n", pStreamEx->Core.szName, rc));
     2326    LogFunc(("[%s] Returning %Rrc\n", pStreamEx->Core.Cfg.szName, rc));
    23932327    return rc;
    23942328}
     
    24392373                {
    24402374                    LogRel(("Audio: Re-initializing stream '%s' exceeded maximum retries (%u), leaving as disabled\n",
    2441                             pStreamEx->Core.szName, cMaxTries));
     2375                            pStreamEx->Core.Cfg.szName, cMaxTries));
    24422376
    24432377                    /* Don't try to re-initialize anymore and mark as disabled. */
     
    24572391        char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    24582392#endif
    2459         Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
     2393        Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.Cfg.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    24602394    }
    24612395    else
     
    24882422    Assert(cRefs < _1K);
    24892423
    2490     Log12Func(("returns %u (%s)\n", cRefs, pStreamEx->Core.szName));
     2424    Log12Func(("returns %u (%s)\n", cRefs, pStreamEx->Core.Cfg.szName));
    24912425    return cRefs;
    24922426}
     
    25472481     *         finish initializing the stream, we'll update it about the stream state.
    25482482     */
    2549     bool const                     fDirEnabled     = pStreamEx->Core.enmDir == PDMAUDIODIR_IN
     2483    bool const                     fDirEnabled     = pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_IN
    25502484                                                   ? pThis->In.fEnabled : pThis->Out.fEnabled;
    25512485    PDMHOSTAUDIOSTREAMSTATE const  enmBackendState = drvAudioStreamGetBackendState(pThis, pStreamEx);
     
    25542488    char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    25552489    LogRel2(("Audio: %s stream '%s' backend (%s is %s; status: %s; backend-status: %s)\n",
    2556              PDMAudioStrmCmdGetName(enmStreamCmd), pStreamEx->Core.szName, PDMAudioDirGetName(pStreamEx->Core.enmDir),
     2490             PDMAudioStrmCmdGetName(enmStreamCmd), pStreamEx->Core.Cfg.szName, PDMAudioDirGetName(pStreamEx->Core.Cfg.enmDir),
    25572491             fDirEnabled ? "enabled" : "disabled",  drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus),
    25582492             PDMHostAudioStreamStateGetName(enmBackendState) ));
     
    25972531            }
    25982532            if (RT_SUCCESS(rc))
    2599                 Log2Func(("[%s] %s succeeded (%Rrc)\n", pStreamEx->Core.szName, PDMAudioStrmCmdGetName(enmStreamCmd), rc));
     2533                Log2Func(("[%s] %s succeeded (%Rrc)\n", pStreamEx->Core.Cfg.szName, PDMAudioStrmCmdGetName(enmStreamCmd), rc));
    26002534            else
    26012535            {
    2602                 LogFunc(("[%s] %s failed with %Rrc\n", pStreamEx->Core.szName, PDMAudioStrmCmdGetName(enmStreamCmd), rc));
     2536                LogFunc(("[%s] %s failed with %Rrc\n", pStreamEx->Core.Cfg.szName, PDMAudioStrmCmdGetName(enmStreamCmd), rc));
    26032537                if (   rc != VERR_NOT_IMPLEMENTED
    26042538                    && rc != VERR_NOT_SUPPORTED
    26052539                    && rc != VERR_AUDIO_STREAM_NOT_READY)
    2606                     LogRel(("Audio: %s stream '%s' failed with %Rrc\n", PDMAudioStrmCmdGetName(enmStreamCmd), pStreamEx->Core.szName, rc));
     2540                    LogRel(("Audio: %s stream '%s' failed with %Rrc\n", PDMAudioStrmCmdGetName(enmStreamCmd), pStreamEx->Core.Cfg.szName, rc));
    26072541            }
    26082542        }
     
    26282562    drvAudioStreamResetInternal(pStreamEx);
    26292563
    2630     LogFunc(("[%s]\n", pStreamEx->Core.szName));
     2564    LogFunc(("[%s]\n", pStreamEx->Core.Cfg.szName));
    26312565
    26322566    pStreamEx->fStatus            &= PDMAUDIOSTREAM_STS_BACKEND_CREATED | PDMAUDIOSTREAM_STS_BACKEND_READY;
     
    26372571     * Reset statistics.
    26382572     */
    2639     if (pStreamEx->Core.enmDir == PDMAUDIODIR_IN)
     2573    if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_IN)
    26402574    {
    26412575        STAM_COUNTER_RESET(&pStreamEx->In.Stats.TotalFramesCaptured);
     
    26432577        STAM_COUNTER_RESET(&pStreamEx->In.Stats.TotalTimesRead);
    26442578    }
    2645     else if (pStreamEx->Core.enmDir == PDMAUDIODIR_OUT)
     2579    else if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT)
    26462580    {
    26472581    }
     
    26692603    char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    26702604#endif
    2671     LogFunc(("[%s] enmStreamCmd=%s fStatus=%s\n", pStreamEx->Core.szName, PDMAudioStrmCmdGetName(enmStreamCmd),
     2605    LogFunc(("[%s] enmStreamCmd=%s fStatus=%s\n", pStreamEx->Core.Cfg.szName, PDMAudioStrmCmdGetName(enmStreamCmd),
    26722606             drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    26732607
     
    26822616                if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_PENDING_DISABLE)
    26832617                {
    2684                     LogFunc(("Stream '%s' is still draining - disabling...\n", pStreamEx->Core.szName));
     2618                    LogFunc(("Stream '%s' is still draining - disabling...\n", pStreamEx->Core.Cfg.szName));
    26852619                    rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
    26862620                    AssertRC(rc);
     
    27002634                    pStreamEx->offInternal         = 0;
    27012635
    2702                     if (pStreamEx->Core.enmDir == PDMAUDIODIR_OUT)
     2636                    if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT)
    27032637                    {
    27042638                        pStreamEx->Out.cbPreBuffered = 0;
     
    27732707            {
    27742708                rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
    2775                 LogFunc(("DISABLE '%s': Backend DISABLE -> %Rrc\n", pStreamEx->Core.szName, rc));
     2709                LogFunc(("DISABLE '%s': Backend DISABLE -> %Rrc\n", pStreamEx->Core.Cfg.szName, rc));
    27762710                if (RT_SUCCESS(rc)) /** @todo ignore this and reset it anyway? */
    27772711                    drvAudioStreamResetOnDisable(pStreamEx);
     
    28082742             * Only for output streams and we don't want this command more than once.
    28092743             */
    2810             AssertReturn(pStreamEx->Core.enmDir == PDMAUDIODIR_OUT, VERR_INVALID_FUNCTION);
     2744            AssertReturn(pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT, VERR_INVALID_FUNCTION);
    28112745            AssertBreak(!(pStreamEx->fStatus & PDMAUDIOSTREAM_STS_PENDING_DISABLE));
    28122746            if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_ENABLED)
     
    28182752                        if (pStreamEx->Out.cbPreBuffered > 0)
    28192753                        {
    2820                             LogFunc(("DRAIN '%s': Initiating draining of pre-buffered data...\n", pStreamEx->Core.szName));
     2754                            LogFunc(("DRAIN '%s': Initiating draining of pre-buffered data...\n", pStreamEx->Core.Cfg.szName));
    28212755                            pStreamEx->Out.enmPlayState = DRVAUDIOPLAYSTATE_PREBUF_COMMITTING;
    28222756                            pStreamEx->fStatus |= PDMAUDIOSTREAM_STS_PENDING_DISABLE;
     
    28302764                    case DRVAUDIOPLAYSTATE_PREBUF_OVERDUE:
    28312765                        LogFunc(("DRAIN '%s': Nothing to drain (enmPlayState=%s)\n",
    2832                                  pStreamEx->Core.szName, drvAudioPlayStateName(pStreamEx->Out.enmPlayState)));
     2766                                 pStreamEx->Core.Cfg.szName, drvAudioPlayStateName(pStreamEx->Out.enmPlayState)));
    28332767                        rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
    28342768                        AssertRC(rc);
     
    28392773                    case DRVAUDIOPLAYSTATE_PLAY_PREBUF:
    28402774                        LogFunc(("DRAIN '%s': Initiating backend draining (enmPlayState=%s -> NOPLAY) ...\n",
    2841                                  pStreamEx->Core.szName, drvAudioPlayStateName(pStreamEx->Out.enmPlayState)));
     2775                                 pStreamEx->Core.Cfg.szName, drvAudioPlayStateName(pStreamEx->Out.enmPlayState)));
    28422776                        pStreamEx->Out.enmPlayState = DRVAUDIOPLAYSTATE_NOPLAY;
    28432777                        rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DRAIN);
     
    28502784                        {
    28512785                            LogFunc(("DRAIN '%s': Backend DRAIN failed with %Rrc, disabling the stream instead...\n",
    2852                                      pStreamEx->Core.szName, rc));
     2786                                     pStreamEx->Core.Cfg.szName, rc));
    28532787                            rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
    28542788                            AssertRC(rc);
     
    28592793                    case DRVAUDIOPLAYSTATE_PREBUF_COMMITTING:
    28602794                        LogFunc(("DRAIN '%s': Initiating draining of pre-buffered data (already committing)...\n",
    2861                                  pStreamEx->Core.szName));
     2795                                 pStreamEx->Core.Cfg.szName));
    28622796                        pStreamEx->fStatus |= PDMAUDIOSTREAM_STS_PENDING_DISABLE;
    28632797                        PDMAUDIOSTREAM_STS_ASSERT_VALID(pStreamEx->fStatus);
     
    28792813
    28802814    if (RT_FAILURE(rc))
    2881         LogFunc(("[%s] Failed with %Rrc\n", pStreamEx->Core.szName, rc));
     2815        LogFunc(("[%s] Failed with %Rrc\n", pStreamEx->Core.Cfg.szName, rc));
    28822816
    28832817    return rc;
     
    29052839    AssertRCReturn(rc, rc);
    29062840
    2907     LogFlowFunc(("[%s] enmStreamCmd=%s\n", pStream->szName, PDMAudioStrmCmdGetName(enmStreamCmd)));
     2841    LogFlowFunc(("[%s] enmStreamCmd=%s\n", pStreamEx->Core.Cfg.szName, PDMAudioStrmCmdGetName(enmStreamCmd)));
    29082842
    29092843    rc = drvAudioStreamControlInternal(pThis, pStreamEx, enmStreamCmd);
     
    29822916                                    const uint8_t *pbBuf, uint32_t cbBuf, uint32_t *pcbWritten)
    29832917{
    2984     Log3Func(("%s: @%#RX64: cbBuf=%#x\n", pStreamEx->Core.szName, pStreamEx->offInternal, cbBuf));
     2918    Log3Func(("%s: @%#RX64: cbBuf=%#x\n", pStreamEx->Core.Cfg.szName, pStreamEx->offInternal, cbBuf));
    29852919
    29862920    uint32_t      cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pBackend);
     
    29892923    uint32_t      cbWritten  = 0;
    29902924    int           rc         = VINF_SUCCESS;
    2991     uint8_t const cbFrame    = PDMAudioPropsFrameSize(&pStreamEx->Core.Props);
     2925    uint8_t const cbFrame    = PDMAudioPropsFrameSize(&pStreamEx->Core.Cfg.Props);
    29922926    while (cbBuf >= cbFrame && cbWritable >= cbFrame)
    29932927    {
    2994         uint32_t const cbToWrite    = PDMAudioPropsFloorBytesToFrame(&pStreamEx->Core.Props, RT_MIN(cbBuf, cbWritable));
     2928        uint32_t const cbToWrite    = PDMAudioPropsFloorBytesToFrame(&pStreamEx->Core.Cfg.Props, RT_MIN(cbBuf, cbWritable));
    29952929        uint32_t       cbWrittenNow = 0;
    29962930        rc = pThis->pHostDrvAudio->pfnStreamPlay(pThis->pHostDrvAudio, pStreamEx->pBackend, pbBuf, cbToWrite, &cbWrittenNow);
     
    29992933            if (cbWrittenNow != cbToWrite)
    30002934                Log3Func(("%s: @%#RX64: Wrote fewer bytes than requested: %#x, requested %#x\n",
    3001                           pStreamEx->Core.szName, pStreamEx->offInternal, cbWrittenNow, cbToWrite));
     2935                          pStreamEx->Core.Cfg.szName, pStreamEx->offInternal, cbWrittenNow, cbToWrite));
    30022936#ifdef DEBUG_bird
    30032937            Assert(cbWrittenNow == cbToWrite);
     
    30132947            *pcbWritten = cbWritten;
    30142948            LogFunc(("%s: @%#RX64: pfnStreamPlay failed writing %#x bytes (%#x previous written, %#x writable): %Rrc\n",
    3015                      pStreamEx->Core.szName, pStreamEx->offInternal, cbToWrite, cbWritten, cbWritable, rc));
     2949                     pStreamEx->Core.Cfg.szName, pStreamEx->offInternal, cbToWrite, cbWritten, cbWritable, rc));
    30162950            return cbWritten ? VINF_SUCCESS : rc;
    30172951        }
     
    30252959        pStreamEx->nsLastPlayedCaptured = RTTimeNanoTS();
    30262960
    3027     Log3Func(("%s: @%#RX64: Wrote %#x bytes (%#x bytes left)\n", pStreamEx->Core.szName, pStreamEx->offInternal, cbWritten, cbBuf));
     2961    Log3Func(("%s: @%#RX64: Wrote %#x bytes (%#x bytes left)\n", pStreamEx->Core.Cfg.szName, pStreamEx->offInternal, cbWritten, cbBuf));
    30282962    return rc;
    30292963}
     
    30422976        pStreamEx->offInternal += cbBuf;
    30432977        Log3Func(("[%s] Pre-buffering (%s): wrote %#x bytes => %#x bytes / %u%%\n",
    3044                   pStreamEx->Core.szName, drvAudioPlayStateName(pStreamEx->Out.enmPlayState), cbBuf, pStreamEx->Out.cbPreBuffered,
     2978                  pStreamEx->Core.Cfg.szName, drvAudioPlayStateName(pStreamEx->Out.enmPlayState), cbBuf, pStreamEx->Out.cbPreBuffered,
    30452979                  pStreamEx->Out.cbPreBuffered * 100 / RT_MAX(pStreamEx->cbPreBufThreshold, 1)));
    30462980
     
    31403074
    31413075        LogRel2(("Audio: @%#RX64: Stream '%s' pre-buffering commit problem: wrote %#x out of %#x + %#x - rc=%Rrc *pcbWritten=%#x %s -> PREBUF_COMMITTING\n",
    3142                  pStreamEx->offInternal, pStreamEx->Core.szName, pStreamEx->Out.cbPreBuffered - cbLeft,
     3076                 pStreamEx->offInternal, pStreamEx->Core.Cfg.szName, pStreamEx->Out.cbPreBuffered - cbLeft,
    31433077                 pStreamEx->Out.cbPreBuffered, cbBuf, rc, *pcbWritten, drvAudioPlayStateName(pStreamEx->Out.enmPlayState) ));
    31443078        AssertMsg(   pStreamEx->Out.enmPlayState == DRVAUDIOPLAYSTATE_PREBUF_COMMITTING
     
    31743108    char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    31753109#endif
    3176     Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
     3110    Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.Cfg.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    31773111
    31783112    /* Not enabled or paused? Skip iteration. */
     
    31903124    else
    31913125    {
    3192         AssertReturn(pStreamEx->Core.enmDir == PDMAUDIODIR_OUT, VINF_SUCCESS);
     3126        AssertReturn(pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT, VINF_SUCCESS);
    31933127        RTCritSectRwEnterShared(&pThis->CritSectHotPlug);
    31943128
     
    32023136                uint32_t cbIgnored = 0;
    32033137                drvAudioStreamPreBufComitting(pThis, pStreamEx, NULL, 0, &cbIgnored);
    3204                 Log3Func(("Stream '%s': Transferred %#x bytes\n", pStreamEx->Core.szName, cbIgnored));
     3138                Log3Func(("Stream '%s': Transferred %#x bytes\n", pStreamEx->Core.Cfg.szName, cbIgnored));
    32053139            }
    32063140            if (pStreamEx->Out.cbPreBuffered == 0)
    32073141            {
    3208                 Log3Func(("Stream '%s': No more pre-buffered data -> NOPLAY + backend DRAIN\n", pStreamEx->Core.szName));
     3142                Log3Func(("Stream '%s': No more pre-buffered data -> NOPLAY + backend DRAIN\n", pStreamEx->Core.Cfg.szName));
    32093143                pStreamEx->Out.enmPlayState = DRVAUDIOPLAYSTATE_NOPLAY;
    32103144
     
    32133147                {
    32143148                    LogFunc(("Stream '%s': Backend DRAIN failed with %Rrc, disabling the stream instead...\n",
    3215                              pStreamEx->Core.szName, rc));
     3149                             pStreamEx->Core.Cfg.szName, rc));
    32163150                    rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
    32173151                    AssertRC(rc);
     
    32353169        else
    32363170        {
    3237             LogFunc(("Stream '%s': Backend finished draining.\n", pStreamEx->Core.szName));
     3171            LogFunc(("Stream '%s': Backend finished draining.\n", pStreamEx->Core.Cfg.szName));
    32383172            drvAudioStreamResetOnDisable(pStreamEx);
    32393173        }
     
    32943228    PDMHOSTAUDIOSTREAMSTATE const enmBackendState = drvAudioStreamGetBackendStateAndProcessChanges(pThis, pStreamEx);
    32953229    uint32_t const                fStrmStatus     = pStreamEx->fStatus;
    3296     PDMAUDIODIR const             enmDir          = pStreamEx->Guest.Cfg.enmDir;
     3230    PDMAUDIODIR const             enmDir          = pStreamEx->Core.Cfg.enmDir;
    32973231    Assert(enmDir == PDMAUDIODIR_IN || enmDir == PDMAUDIODIR_OUT);
    32983232
     
    33263260    char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    33273261#endif
    3328     Log3Func(("[%s] returns %s (status: %s)\n", pStreamEx->Core.szName, PDMAudioStreamStateGetName(enmState),
     3262    Log3Func(("[%s] returns %s (status: %s)\n", pStreamEx->Core.Cfg.szName, PDMAudioStreamStateGetName(enmState),
    33293263              drvAudioStreamStatusToStr(szStreamSts, fStrmStatus)));
    33303264    return enmState;
     
    33433277    AssertReturn(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC, 0);
    33443278    AssertReturn(pStreamEx->uMagic      == DRVAUDIOSTREAM_MAGIC, 0);
    3345     AssertMsgReturn(pStreamEx->Core.enmDir == PDMAUDIODIR_OUT, ("Can't write to a non-output stream\n"), 0);
     3279    AssertMsgReturn(pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT, ("Can't write to a non-output stream\n"), 0);
    33463280
    33473281    int rc = RTCritSectEnter(&pStreamEx->Core.CritSect);
     
    33813315                cbWritable = pStreamEx->Out.cbPreBufAlloc - pStreamEx->Out.cbPreBuffered;
    33823316                if (!cbWritable)
    3383                     cbWritable = PDMAudioPropsFramesToBytes(&pStreamEx->Core.Props, 2);
     3317                    cbWritable = PDMAudioPropsFramesToBytes(&pStreamEx->Core.Cfg.Props, 2);
    33843318                break;
    33853319
     
    33923326            case DRVAUDIOPLAYSTATE_PREBUF_OVERDUE:
    33933327            case DRVAUDIOPLAYSTATE_PREBUF_SWITCHING:
    3394                 cbWritable = PDMAudioPropsFramesToBytes(&pStreamEx->Core.Props,
    3395                                                         RT_MAX(pStreamEx->Host.Cfg.Backend.cFramesBufferSize,
    3396                                                                pStreamEx->Host.Cfg.Backend.cFramesPreBuffering));
     3328                cbWritable = PDMAudioPropsFramesToBytes(&pStreamEx->Core.Cfg.Props,
     3329                                                        RT_MAX(pStreamEx->Core.Cfg.Backend.cFramesBufferSize,
     3330                                                               pStreamEx->Core.Cfg.Backend.cFramesPreBuffering));
    33973331                break;
    33983332
     
    34063340                Assert(pStreamEx->fStatus & PDMAUDIOSTREAM_STS_BACKEND_READY);
    34073341                Assert(enmBackendState == PDMHOSTAUDIOSTREAMSTATE_OKAY /* potential unplug race */);
    3408                 uint32_t const cbMin = PDMAudioPropsFramesToBytes(&pStreamEx->Core.Props, 8);
     3342                uint32_t const cbMin = PDMAudioPropsFramesToBytes(&pStreamEx->Core.Cfg.Props, 8);
    34093343                cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pBackend);
    34103344                if (cbWritable >= pStreamEx->Out.cbPreBuffered + cbMin)
     
    34253359
    34263360        /* Make sure to align the writable size to the host's frame size. */
    3427         cbWritable = PDMAudioPropsFloorBytesToFrame(&pStreamEx->Core.Props, cbWritable);
     3361        cbWritable = PDMAudioPropsFloorBytesToFrame(&pStreamEx->Core.Cfg.Props, cbWritable);
    34283362    }
    34293363
     
    34313365    RTCritSectLeave(&pStreamEx->Core.CritSect);
    34323366    Log3Func(("[%s] cbWritable=%#RX32 (%RU64ms) enmPlayMode=%s enmBackendState=%s\n",
    3433               pStreamEx->Core.szName, cbWritable, PDMAudioPropsBytesToMilli(&pStreamEx->Core.Props, cbWritable),
     3367              pStreamEx->Core.Cfg.szName, cbWritable, PDMAudioPropsBytesToMilli(&pStreamEx->Core.Cfg.Props, cbWritable),
    34343368              drvAudioPlayStateName(enmPlayMode), PDMHostAudioStreamStateGetName(enmBackendState) ));
    34353369    return cbWritable;
     
    34623396    AssertReturn(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC, VERR_INVALID_MAGIC);
    34633397    AssertReturn(pStreamEx->uMagic      == DRVAUDIOSTREAM_MAGIC, VERR_INVALID_MAGIC);
    3464     AssertMsgReturn(pStreamEx->Core.enmDir == PDMAUDIODIR_OUT,
     3398    AssertMsgReturn(pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT,
    34653399                    ("Stream '%s' is not an output stream and therefore cannot be written to (direction is '%s')\n",
    3466                      pStreamEx->Core.szName, PDMAudioDirGetName(pStreamEx->Core.enmDir)), VERR_ACCESS_DENIED);
    3467 
    3468     AssertMsg(PDMAudioPropsIsSizeAligned(&pStreamEx->Core.Props, cbBuf),
    3469               ("Stream '%s' got a non-frame-aligned write (%#RX32 bytes)\n", pStreamEx->Core.szName, cbBuf));
     3400                     pStreamEx->Core.Cfg.szName, PDMAudioDirGetName(pStreamEx->Core.Cfg.enmDir)), VERR_ACCESS_DENIED);
     3401
     3402    AssertMsg(PDMAudioPropsIsSizeAligned(&pStreamEx->Core.Cfg.Props, cbBuf),
     3403              ("Stream '%s' got a non-frame-aligned write (%#RX32 bytes)\n", pStreamEx->Core.Cfg.szName, cbBuf));
    34703404
    34713405    int rc = RTCritSectEnter(&pStreamEx->Core.CritSect);
     
    35123446                    {
    35133447                        Log3Func(("[%s] Pre-buffering completing: cbBuf=%#x cbPreBuffered=%#x => %#x vs cbPreBufThreshold=%#x\n",
    3514                                   pStreamEx->Core.szName, cbBuf, pStreamEx->Out.cbPreBuffered,
     3448                                  pStreamEx->Core.Cfg.szName, cbBuf, pStreamEx->Out.cbPreBuffered,
    35153449                                  cbBuf + pStreamEx->Out.cbPreBuffered, pStreamEx->cbPreBufThreshold));
    35163450                        rc = drvAudioStreamPreBufComitting(pThis, pStreamEx, (uint8_t const *)pvBuf, cbBuf, pcbWritten);
     
    35193453                    {
    35203454                        Log3Func(("[%s] Pre-buffering completing but device not ready: cbBuf=%#x cbPreBuffered=%#x => %#x vs cbPreBufThreshold=%#x; PREBUF -> PREBUF_OVERDUE\n",
    3521                                   pStreamEx->Core.szName, cbBuf, pStreamEx->Out.cbPreBuffered,
     3455                                  pStreamEx->Core.Cfg.szName, cbBuf, pStreamEx->Out.cbPreBuffered,
    35223456                                  cbBuf + pStreamEx->Out.cbPreBuffered, pStreamEx->cbPreBufThreshold));
    35233457                        pStreamEx->Out.enmPlayState = DRVAUDIOPLAYSTATE_PREBUF_OVERDUE;
     
    35433477                    *pcbWritten = cbBuf;
    35443478                    pStreamEx->offInternal += cbBuf;
    3545                     Log3Func(("[%s] Discarding the data, backend state: %s\n", pStreamEx->Core.szName,
     3479                    Log3Func(("[%s] Discarding the data, backend state: %s\n", pStreamEx->Core.Cfg.szName,
    35463480                              PDMHostAudioStreamStateGetName(enmBackendState) ));
    35473481                    break;
     
    35613495            *pcbWritten = cbBuf;
    35623496            pStreamEx->offInternal += cbBuf;
    3563             Log3Func(("[%s] Backend stream %s, discarding the data\n", pStreamEx->Core.szName,
     3497            Log3Func(("[%s] Backend stream %s, discarding the data\n", pStreamEx->Core.Cfg.szName,
    35643498                      !pThis->Out.fEnabled ? "disabled" : !pThis->pHostDrvAudio ? "not attached" : "not ready yet"));
    35653499        }
     
    35853519    AssertReturn(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC, 0);
    35863520    AssertReturn(pStreamEx->uMagic      == DRVAUDIOSTREAM_MAGIC, 0);
    3587     AssertMsg(pStreamEx->Core.enmDir == PDMAUDIODIR_IN, ("Can't read from a non-input stream\n"));
     3521    AssertMsg(pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_IN, ("Can't read from a non-input stream\n"));
    35883522
    35893523
     
    36203554            {
    36213555                uint64_t const cNsStream = RTTimeNanoTS() - pStreamEx->nsStarted;
    3622                 uint64_t const offCur    = PDMAudioPropsNanoToBytes64(&pStreamEx->Core.Props, cNsStream);
     3556                uint64_t const offCur    = PDMAudioPropsNanoToBytes64(&pStreamEx->Core.Cfg.Props, cNsStream);
    36233557                if (offCur > pStreamEx->offInternal)
    36243558                {
     
    36393573
    36403574        /* Make sure to align the readable size to the host's frame size. */
    3641         cbReadable = PDMAudioPropsFloorBytesToFrame(&pStreamEx->Core.Props, cbReadable);
     3575        cbReadable = PDMAudioPropsFloorBytesToFrame(&pStreamEx->Core.Cfg.Props, cbReadable);
    36423576    }
    36433577
     
    36453579    RTCritSectLeave(&pStreamEx->Core.CritSect);
    36463580    Log3Func(("[%s] cbReadable=%#RX32 (%RU64ms) enmCaptureMode=%s enmBackendState=%s\n",
    3647               pStreamEx->Core.szName, cbReadable, PDMAudioPropsBytesToMilli(&pStreamEx->Core.Props, cbReadable),
     3581              pStreamEx->Core.Cfg.szName, cbReadable, PDMAudioPropsBytesToMilli(&pStreamEx->Core.Cfg.Props, cbReadable),
    36483582              drvAudioCaptureStateName(enmCaptureState), PDMHostAudioStreamStateGetName(enmBackendState) ));
    36493583    return cbReadable;
     
    36673601    /** @todo  Does not take paused time into account...  */
    36683602    uint64_t const cNsStream = RTTimeNanoTS() - pStreamEx->nsStarted;
    3669     uint64_t const offCur    = PDMAudioPropsNanoToBytes64(&pStreamEx->Core.Props, cNsStream);
     3603    uint64_t const offCur    = PDMAudioPropsNanoToBytes64(&pStreamEx->Core.Cfg.Props, cNsStream);
    36703604    if (offCur > pStreamEx->offInternal)
    36713605    {
     
    36753609        pStreamEx->offInternal  += cbToClear;
    36763610        cbBuf                   -= cbToClear;
    3677         PDMAudioPropsClearBuffer(&pStreamEx->Core.Props, pbBuf, cbToClear,
    3678                                  PDMAudioPropsBytesToFrames(&pStreamEx->Core.Props, cbToClear));
     3611        PDMAudioPropsClearBuffer(&pStreamEx->Core.Cfg.Props, pbBuf, cbToClear,
     3612                                 PDMAudioPropsBytesToFrames(&pStreamEx->Core.Cfg.Props, cbToClear));
    36793613    }
    36803614    else
    36813615        *pcbRead = 0;
    36823616    Log4Func(("%s: @%#RX64: Read %#x bytes of silence (%#x bytes left)\n",
    3683               pStreamEx->Core.szName, pStreamEx->offInternal, *pcbRead, cbBuf));
     3617              pStreamEx->Core.Cfg.szName, pStreamEx->offInternal, *pcbRead, cbBuf));
    36843618    return VINF_SUCCESS;
    36853619}
     
    36923626                                       uint8_t *pbBuf, uint32_t cbBuf, uint32_t *pcbRead)
    36933627{
    3694     Log4Func(("%s: @%#RX64: cbBuf=%#x\n", pStreamEx->Core.szName, pStreamEx->offInternal, cbBuf));
     3628    Log4Func(("%s: @%#RX64: cbBuf=%#x\n", pStreamEx->Core.Cfg.szName, pStreamEx->offInternal, cbBuf));
    36953629
    36963630    uint32_t      cbReadable = pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->pBackend);
     
    36993633    uint32_t      cbRead     = 0;
    37003634    int           rc         = VINF_SUCCESS;
    3701     uint8_t const cbFrame    = PDMAudioPropsFrameSize(&pStreamEx->Core.Props);
     3635    uint8_t const cbFrame    = PDMAudioPropsFrameSize(&pStreamEx->Core.Cfg.Props);
    37023636    while (cbBuf >= cbFrame && cbReadable >= cbFrame)
    37033637    {
    3704         uint32_t const cbToRead  = PDMAudioPropsFloorBytesToFrame(&pStreamEx->Core.Props, RT_MIN(cbBuf, cbReadable));
     3638        uint32_t const cbToRead  = PDMAudioPropsFloorBytesToFrame(&pStreamEx->Core.Cfg.Props, RT_MIN(cbBuf, cbReadable));
    37053639        uint32_t       cbReadNow = 0;
    37063640        rc = pThis->pHostDrvAudio->pfnStreamCapture(pThis->pHostDrvAudio, pStreamEx->pBackend, pbBuf, cbToRead, &cbReadNow);
     
    37093643            if (cbReadNow != cbToRead)
    37103644                Log4Func(("%s: @%#RX64: Read fewer bytes than requested: %#x, requested %#x\n",
    3711                           pStreamEx->Core.szName, pStreamEx->offInternal, cbReadNow, cbToRead));
     3645                          pStreamEx->Core.Cfg.szName, pStreamEx->offInternal, cbReadNow, cbToRead));
    37123646#ifdef DEBUG_bird
    37133647            Assert(cbReadNow == cbToRead);
     
    37233657            *pcbRead = cbRead;
    37243658            LogFunc(("%s: @%#RX64: pfnStreamCapture failed read %#x bytes (%#x previous read, %#x readable): %Rrc\n",
    3725                      pStreamEx->Core.szName, pStreamEx->offInternal, cbToRead, cbRead, cbReadable, rc));
     3659                     pStreamEx->Core.Cfg.szName, pStreamEx->offInternal, cbToRead, cbRead, cbReadable, rc));
    37263660            return cbRead ? VINF_SUCCESS : rc;
    37273661        }
     
    37353669        pStreamEx->nsLastPlayedCaptured = RTTimeNanoTS();
    37363670
    3737     Log4Func(("%s: @%#RX64: Read %#x bytes (%#x bytes left)\n", pStreamEx->Core.szName, pStreamEx->offInternal, cbRead, cbBuf));
     3671    Log4Func(("%s: @%#RX64: Read %#x bytes (%#x bytes left)\n", pStreamEx->Core.Cfg.szName, pStreamEx->offInternal, cbRead, cbBuf));
    37383672    return rc;
    37393673}
     
    37653699    AssertReturn(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC, VERR_INVALID_MAGIC);
    37663700    AssertReturn(pStreamEx->uMagic      == DRVAUDIOSTREAM_MAGIC, VERR_INVALID_MAGIC);
    3767     AssertMsgReturn(pStreamEx->Core.enmDir == PDMAUDIODIR_IN,
     3701    AssertMsgReturn(pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_IN,
    37683702                    ("Stream '%s' is not an input stream and therefore cannot be read from (direction is '%s')\n",
    3769                      pStreamEx->Core.szName, PDMAudioDirGetName(pStreamEx->Core.enmDir)), VERR_ACCESS_DENIED);
    3770 
    3771     AssertMsg(PDMAudioPropsIsSizeAligned(&pStreamEx->Core.Props, cbBuf),
    3772               ("Stream '%s' got a non-frame-aligned write (%#RX32 bytes)\n", pStreamEx->Core.szName, cbBuf));
     3703                     pStreamEx->Core.Cfg.szName, PDMAudioDirGetName(pStreamEx->Core.Cfg.enmDir)), VERR_ACCESS_DENIED);
     3704
     3705    AssertMsg(PDMAudioPropsIsSizeAligned(&pStreamEx->Core.Cfg.Props, cbBuf),
     3706              ("Stream '%s' got a non-frame-aligned write (%#RX32 bytes)\n", pStreamEx->Core.Cfg.szName, cbBuf));
    37733707
    37743708    int rc = RTCritSectEnter(&pStreamEx->Core.CritSect);
     
    38093743                        {
    38103744                            Log4Func(("[%s] Pre-buffering completed: cbReadable=%#x vs cbPreBufThreshold=%#x (cbBuf=%#x)\n",
    3811                                       pStreamEx->Core.szName, cbReadable, pStreamEx->cbPreBufThreshold, cbBuf));
     3745                                      pStreamEx->Core.Cfg.szName, cbReadable, pStreamEx->cbPreBufThreshold, cbBuf));
    38123746                            pStreamEx->In.enmCaptureState = DRVAUDIOCAPTURESTATE_CAPTURING;
    38133747                            rc = drvAudioStreamCaptureLocked(pThis, pStreamEx, (uint8_t *)pvBuf, cbBuf, pcbRead);
     
    38173751                        pStreamEx->In.Stats.cbBackendReadableAfter  = cbReadable;
    38183752                        Log4Func(("[%s] Pre-buffering: Got %#x out of %#x\n",
    3819                                   pStreamEx->Core.szName, cbReadable, pStreamEx->cbPreBufThreshold));
     3753                                  pStreamEx->Core.Cfg.szName, cbReadable, pStreamEx->cbPreBufThreshold));
    38203754                    }
    38213755                    else
    38223756                        Log4Func(("[%s] Pre-buffering: Backend status %s\n",
    3823                                   pStreamEx->Core.szName, PDMHostAudioStreamStateGetName(enmBackendState) ));
     3757                                  pStreamEx->Core.Cfg.szName, PDMHostAudioStreamStateGetName(enmBackendState) ));
    38243758                    drvAudioStreamCaptureSilence(pStreamEx, (uint8_t *)pvBuf, cbBuf, pcbRead);
    38253759                    break;
     
    38283762                    *pcbRead = 0;
    38293763                    Log4Func(("[%s] Not capturing - backend state: %s\n",
    3830                               pStreamEx->Core.szName, PDMHostAudioStreamStateGetName(enmBackendState) ));
     3764                              pStreamEx->Core.Cfg.szName, PDMHostAudioStreamStateGetName(enmBackendState) ));
    38313765                    break;
    38323766
     
    38443778        {
    38453779            *pcbRead = 0;
    3846             Log4Func(("[%s] Backend stream %s, returning no data\n", pStreamEx->Core.szName,
     3780            Log4Func(("[%s] Backend stream %s, returning no data\n", pStreamEx->Core.Cfg.szName,
    38473781                      !pThis->Out.fEnabled ? "disabled" : !pThis->pHostDrvAudio ? "not attached" : "not ready yet"));
    38483782        }
     
    39963930static void drvAudioStreamMarkNeedReInit(PDRVAUDIOSTREAM pStreamEx, const char *pszCaller)
    39973931{
    3998     LogFlow((LOG_FN_FMT ": Flagging %s for re-init.\n", pszCaller, pStreamEx->Core.szName)); RT_NOREF(pszCaller);
     3932    LogFlow((LOG_FN_FMT ": Flagging %s for re-init.\n", pszCaller, pStreamEx->Core.Cfg.szName)); RT_NOREF(pszCaller);
    39993933    Assert(RTCritSectIsOwner(&pStreamEx->Core.CritSect));
    40003934
     
    40243958    RTListForEach(&pThis->LstStreams, pStreamEx, DRVAUDIOSTREAM, ListEntry)
    40253959    {
    4026         if (pStreamEx->Core.enmDir == enmDir)
     3960        if (pStreamEx->Core.Cfg.enmDir == enmDir)
    40273961        {
    40283962            RTCritSectEnter(&pStreamEx->Core.CritSect);
     
    40313965            if (pThis->pHostDrvAudio->pfnStreamNotifyDeviceChanged)
    40323966            {
    4033                 LogFlowFunc(("Calling pfnStreamNotifyDeviceChanged on %s, old backend state: %s...\n", pStreamEx->Core.szName,
     3967                LogFlowFunc(("Calling pfnStreamNotifyDeviceChanged on %s, old backend state: %s...\n", pStreamEx->Core.Cfg.szName,
    40343968                             PDMHostAudioStreamStateGetName(drvAudioStreamGetBackendState(pThis, pStreamEx)) ));
    40353969                pThis->pHostDrvAudio->pfnStreamNotifyDeviceChanged(pThis->pHostDrvAudio, pStreamEx->pBackend, pvUser);
     
    40664000    AssertReturnVoid(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC);
    40674001    AssertReturnVoid(pStreamEx->uMagic == DRVAUDIOSTREAM_MAGIC);
    4068     LogFlowFunc(("pStreamEx=%p '%s'\n", pStreamEx, pStreamEx->Core.szName));
     4002    LogFlowFunc(("pStreamEx=%p '%s'\n", pStreamEx, pStreamEx->Core.Cfg.szName));
    40694003
    40704004    /*
     
    40744008    AssertReturnVoidStmt(pStreamEx->uMagic == DRVAUDIOSTREAM_MAGIC, RTCritSectLeave(&pStreamEx->Core.CritSect)); /* paranoia */
    40754009
    4076     if (pStreamEx->Core.enmDir == PDMAUDIODIR_OUT)
     4010    if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT)
    40774011    {
    40784012        if (pStreamEx->cbPreBufThreshold > 0)
     
    41494083
    41504084
    4151         if (pStreamEx->Core.enmDir == PDMAUDIODIR_OUT)
     4085        if (pStreamEx->Core.Cfg.enmDir == PDMAUDIODIR_OUT)
    41524086        {
    41534087            DRVAUDIOPLAYSTATE const enmPlayState = pStreamEx->Out.enmPlayState;
    41544088            pStreamEx->Out.enmPlayState = DRVAUDIOPLAYSTATE_PREBUF;
    4155             LogFunc(("%s: %s -> %s\n", pStreamEx->Core.szName, drvAudioPlayStateName(enmPlayState),
     4089            LogFunc(("%s: %s -> %s\n", pStreamEx->Core.Cfg.szName, drvAudioPlayStateName(enmPlayState),
    41564090                     drvAudioPlayStateName(pStreamEx->Out.enmPlayState) ));
    41574091            RT_NOREF(enmPlayState);
  • trunk/src/VBox/Devices/Audio/DrvHostAudioNull.cpp

    r89487 r89489  
    248248    /* .pfnStreamNotifyDeviceChanged =*/ NULL,
    249249    /* .pfnStreamControl             =*/ drvHstAudNullHA_StreamControl,
     250    /* .pfnStreamGetState            =*/ drvHstAudNullHA_StreamGetState,
     251    /* .pfnStreamGetPending          =*/ drvHstAudNullHA_StreamGetPending,
     252    /* .pfnStreamGetWritable         =*/ drvHstAudNullHA_StreamGetWritable,
     253    /* .pfnStreamPlay                =*/ drvHstAudNullHA_StreamPlay,
    250254    /* .pfnStreamGetReadable         =*/ drvHstAudNullHA_StreamGetReadable,
    251     /* .pfnStreamGetWritable         =*/ drvHstAudNullHA_StreamGetWritable,
    252     /* .pfnStreamGetPending          =*/ drvHstAudNullHA_StreamGetPending,
    253     /* .pfnStreamGetState            =*/ drvHstAudNullHA_StreamGetState,
    254     /* .pfnStreamPlay                =*/ drvHstAudNullHA_StreamPlay,
    255255    /* .pfnStreamCapture             =*/ drvHstAudNullHA_StreamCapture,
    256256};
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r89487 r89489  
    633633     *        sensible, so I've removed it. */
    634634
    635     uint32_t cFrames = PDMAudioPropsBytesToFrames(&pStream->pStream->Props, cbBuf);
     635    uint32_t cFrames = PDMAudioPropsBytesToFrames(&pStream->pStream->Cfg.Props, cbBuf);
    636636    Assert(cFrames == cbBuf / (sizeof(uint64_t) * 2));
    637637    pDrv->pConsoleVRDPServer->SendAudioSamples(pvBuf, cFrames, uVrdpFormat);
    638638
    639639    Log3Func(("cFramesWritten=%RU32\n", cFrames));
    640     *pcbWritten = PDMAudioPropsFramesToBytes(&pStream->pStream->Props, cFrames);
     640    *pcbWritten = PDMAudioPropsFramesToBytes(&pStream->pStream->Cfg.Props, cFrames);
    641641    Assert(*pcbWritten == cbBuf);
    642642    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