VirtualBox

Changeset 82252 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Nov 27, 2019 9:31:53 PM (5 years ago)
Author:
vboxsync
Message:

vmm/pdmaudioifs.h: Style, docs and other nits. First, it's always _FLAGS_ never _FLAG_. Second, enums generally should start with _INVALID = 0 to ensure we don't mistake zero-initialized memory for valid data. Struct member names shall be indented on a tab (+4) boundrary. PDM is part of the VMM, so it follows the VMM coding guidelines strictly. Skip the 'Structure for keeping a ... around' fluff, the first sentence of a structure (or anything else for that matter) documentation shall be brief and to the point. It is automatically turned into a @brief. Furthermore, additional text should be a separate paragraph as it provides details the reader doesn't necessarily need to read. bugref:9218

Location:
trunk/src/VBox/Main/src-client
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r82132 r82252  
    391391    if (RT_FAILURE(vrc))
    392392        throw ConfigError("CFGMR3InsertNode", vrc, pcszName);
     393}
     394
     395/**
     396 * Helper that calls CFGMR3InsertNodeF and throws an RTCError if that fails.
     397 *
     398 * @param   pNode           See CFGMR3InsertNodeF.
     399 * @param   ppChild         See CFGMR3InsertNodeF.
     400 * @param   pszNameFormat   Name format string, see CFGMR3InsertNodeF.
     401 * @param   ...             Format arguments.
     402 */
     403static void InsertConfigNodeF(PCFGMNODE pNode,
     404                              PCFGMNODE *ppChild,
     405                              const char *pszNameFormat,
     406                              ...)
     407{
     408    va_list va;
     409    va_start(va, pszNameFormat);
     410    int vrc = CFGMR3InsertNodeF(pNode, ppChild, "%N", pszNameFormat, &va);
     411    va_end(va);
     412    if (RT_FAILURE(vrc))
     413        throw ConfigError("CFGMR3InsertNodeF", vrc, pszNameFormat);
    393414}
    394415
     
    29863007            unsigned uAudioLUN = 0;
    29873008
    2988             CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", uAudioLUN);
    2989             rc = i_configAudioDriver(audioAdapter, virtualBox, pMachine, pLunL0,
    2990                                      strAudioDriver.c_str());
     3009            InsertConfigNodeF(pInst, &pLunL0, "LUN#%u", uAudioLUN);
     3010            rc = i_configAudioDriver(audioAdapter, virtualBox, pMachine, pLunL0, strAudioDriver.c_str());
    29913011            if (RT_SUCCESS(rc))
    29923012                uAudioLUN++;
     
    29943014#ifdef VBOX_WITH_AUDIO_VRDE
    29953015            /* Insert dummy audio driver to have the LUN configured. */
    2996             CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", uAudioLUN);
    2997                 InsertConfigString(pLunL0, "Driver", "AUDIO");
     3016            InsertConfigNodeF(pInst, &pLunL0, "LUN#%u", uAudioLUN);
     3017            InsertConfigString(pLunL0, "Driver", "AUDIO");
    29983018            AudioDriverCfg DrvCfgVRDE(strAudioDevice, 0 /* Instance */, uAudioLUN, "AudioVRDE");
    29993019            rc = mAudioVRDE->InitializeConfig(&DrvCfgVRDE);
     
    30043024#ifdef VBOX_WITH_AUDIO_RECORDING
    30053025            /* Insert dummy audio driver to have the LUN configured. */
    3006             CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", uAudioLUN);
    3007                 InsertConfigString(pLunL0, "Driver", "AUDIO");
     3026            InsertConfigNodeF(pInst, &pLunL0, "LUN#%u", uAudioLUN);
     3027            InsertConfigString(pLunL0, "Driver", "AUDIO");
    30083028            AudioDriverCfg DrvCfgVideoRec(strAudioDevice, 0 /* Instance */, uAudioLUN, "AudioVideoRec");
    30093029            rc = Recording.mAudioRec->InitializeConfig(&DrvCfgVideoRec);
     
    30153035            {
    30163036#ifdef VBOX_WITH_AUDIO_DEBUG
    3017                 CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", uAudioLUN);
    3018                 rc = i_configAudioDriver(audioAdapter, virtualBox, pMachine, pLunL0,
    3019                                          "DebugAudio");
     3037                InsertConfigNodeF(pInst, &pLunL0, "LUN#%u", uAudioLUN);
     3038                rc = i_configAudioDriver(audioAdapter, virtualBox, pMachine, pLunL0, "DebugAudio");
    30203039                if (RT_SUCCESS(rc))
    30213040                    uAudioLUN++;
     
    30443063             * The ValidationKit backend.
    30453064             */
    3046             CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", uAudioLUN);
    3047             rc = i_configAudioDriver(audioAdapter, virtualBox, pMachine, pLunL0,
    3048                                      "ValidationKitAudio");
     3065            InsertConfigNodeF(pInst, &pLunL0, "LUN#%u", uAudioLUN);
     3066            rc = i_configAudioDriver(audioAdapter, virtualBox, pMachine, pLunL0, "ValidationKitAudio");
    30493067            if (RT_SUCCESS(rc))
    30503068                uAudioLUN++;
     
    50335051
    50345052        AssertMsg(uLun == 0, ("Network attachments with LUN > 0 are not supported yet\n"));
    5035         CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%u", uLun);
     5053        InsertConfigNodeF(pInst, &pLunL0, "LUN#%u", uLun);
    50365054
    50375055#ifdef VBOX_WITH_NETSHAPER
  • trunk/src/VBox/Main/src-client/DrvAudioRec.cpp

    r76553 r82252  
    308308{
    309309    uint32_t uHz       = pCodecParms->PCMProps.uHz;
    310     uint8_t  cBytes    = pCodecParms->PCMProps.cBytes;
     310    uint8_t  cBytes    = pCodecParms->PCMProps.cbSample;
    311311    uint8_t  cChannels = pCodecParms->PCMProps.cChannels;
    312312    uint32_t uBitrate  = pCodecParms->uBitrate;
     
    427427        pCodec->Parms.PCMProps.uHz       = uHz;
    428428        pCodec->Parms.PCMProps.cChannels = cChannels;
    429         pCodec->Parms.PCMProps.cBytes    = cBytes;
    430         pCodec->Parms.PCMProps.cShift    = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pSink->Codec.Parms.PCMProps.cBytes,
     429        pCodec->Parms.PCMProps.cbSample  = cBytes;
     430        pCodec->Parms.PCMProps.cShift    = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pSink->Codec.Parms.PCMProps.cbSample,
    431431                                                                             pSink->Codec.Parms.PCMProps.cChannels);
    432432        pCodec->Parms.uBitrate           = uBitrate;
     
    522522    AssertPtrReturn(pCfgAcq,   VERR_INVALID_POINTER);
    523523
    524     if (pCfgReq->DestSource.Dest != PDMAUDIOPLAYBACKDEST_FRONT)
    525     {
     524    if (pCfgReq->u.enmDst != PDMAUDIOPLAYBACKDST_FRONT)
     525    {
     526        LogRel2(("Recording: Support for surround audio not implemented yet\n"));
    526527        AssertFailed();
    527 
    528         LogRel2(("Recording: Support for surround audio not implemented yet\n"));
    529528        return VERR_NOT_SUPPORTED;
    530529    }
    531530
    532     int rc = VINF_SUCCESS;
    533 
    534531#ifdef VBOX_WITH_LIBOPUS
    535     rc = RTCircBufCreate(&pStreamAV->pCircBuf, pSink->Codec.Opus.cbFrame * 2 /* Use "double buffering" */);
     532    int rc = RTCircBufCreate(&pStreamAV->pCircBuf, pSink->Codec.Opus.cbFrame * 2 /* Use "double buffering" */);
    536533    if (RT_SUCCESS(rc))
    537534    {
     
    554551                     * a specific sampling rate Opus is optimized for. */
    555552                    pCfgAcq->Props.uHz         = pSink->Codec.Parms.PCMProps.uHz;
    556                     pCfgAcq->Props.cShift      = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cBytes, pCfgAcq->Props.cChannels);
     553                    pCfgAcq->Props.cShift      = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cbSample, pCfgAcq->Props.cChannels);
    557554
    558555                    /* Every Opus frame marks a period for now. Optimize this later. */
     
    570567#else
    571568    RT_NOREF(pThis, pSink, pStreamAV, pCfgReq, pCfgAcq);
    572     rc = VERR_NOT_SUPPORTED;
     569    int rc = VERR_NOT_SUPPORTED;
    573570#endif /* VBOX_WITH_LIBOPUS */
    574571
     
    599596        Assert(pStreamAV->cbSrcBuf);
    600597        RTMemFree(pStreamAV->pvSrcBuf);
     598        pStreamAV->pvSrcBuf = NULL;
    601599        pStreamAV->cbSrcBuf = 0;
    602600    }
     
    606604        Assert(pStreamAV->cbDstBuf);
    607605        RTMemFree(pStreamAV->pvDstBuf);
     606        pStreamAV->pvDstBuf = NULL;
    608607        pStreamAV->cbDstBuf = 0;
    609608    }
     
    657656
    658657    LogRel(("Recording: Audio driver is using %RU32Hz, %RU16bit, %RU8 %s\n",
    659             pThis->CodecParms.PCMProps.uHz, pThis->CodecParms.PCMProps.cBytes * 8,
     658            pThis->CodecParms.PCMProps.uHz, pThis->CodecParms.PCMProps.cbSample * 8,
    660659            pThis->CodecParms.PCMProps.cChannels, pThis->CodecParms.PCMProps.cChannels == 1 ? "channel" : "channels"));
    661660
     
    12041203    rc = CFGMR3QueryU32(pCfg, "CodecHz", &pPCMProps->uHz);
    12051204    AssertRCReturn(rc, rc);
    1206     rc = CFGMR3QueryU8(pCfg,  "CodecBits", &pPCMProps->cBytes);
     1205    rc = CFGMR3QueryU8(pCfg,  "CodecBits", &pPCMProps->cbSample); /** @todo CodecBits != CodecBytes */
    12071206    AssertRCReturn(rc, rc);
     1207    pPCMProps->cbSample /= 8; /* Bits to bytes. */
    12081208    rc = CFGMR3QueryU8(pCfg,  "CodecChannels", &pPCMProps->cChannels);
    12091209    AssertRCReturn(rc, rc);
     
    12111211    AssertRCReturn(rc, rc);
    12121212
    1213     pPCMProps->cBytes      = pPCMProps->cBytes / 8; /* Bits to bytes. */
    1214     pPCMProps->cShift      = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pPCMProps->cBytes, pPCMProps->cChannels);
     1213    pPCMProps->cShift      = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pPCMProps->cbSample, pPCMProps->cChannels);
    12151214    pPCMProps->fSigned     = true;
    12161215    pPCMProps->fSwapEndian = false;
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r76553 r82252  
    8787    pCfgAcq->Props.uHz         = 22050; /* The VRDP server's internal frequency. */
    8888    pCfgAcq->Props.cChannels   = 2;
    89     pCfgAcq->Props.cBytes      = 2; /* 16 bit. */
     89    pCfgAcq->Props.cbSample    = 2; /* 16 bit. */
    9090    pCfgAcq->Props.fSigned     = true;
    9191    pCfgAcq->Props.fSwapEndian = false;
    92     pCfgAcq->Props.cShift      = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cBytes, pCfgAcq->Props.cChannels);
     92    pCfgAcq->Props.cShift      = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cbSample, pCfgAcq->Props.cChannels);
    9393
    9494    /* According to the VRDP docs, the VRDP server stores audio in 200ms chunks. */
     
    133133        pCfgAcq->Props.uHz       = 22050; /* The VRDP server's internal frequency. */
    134134        pCfgAcq->Props.cChannels = 2;
    135         pCfgAcq->Props.cBytes    = 2; /* 16 bit. */
     135        pCfgAcq->Props.cbSample  = 2; /* 16 bit. */
    136136        pCfgAcq->Props.fSigned   = true;
    137         pCfgAcq->Props.cShift    = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cBytes, pCfgAcq->Props.cChannels);
     137        pCfgAcq->Props.cShift    = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cbSample, pCfgAcq->Props.cChannels);
    138138
    139139        /* According to the VRDP docs, the VRDP server stores audio in 200ms chunks. */
     
    174174                                                               DrvAudioHlpMilliToFrames(200 /* ms */, &pStreamVRDE->pCfg->Props),
    175175                                                               pStreamVRDE->pCfg->Props.uHz, pStreamVRDE->pCfg->Props.cChannels,
    176                                                                pStreamVRDE->pCfg->Props.cBytes * 8 /* Bit */);
     176                                                               pStreamVRDE->pCfg->Props.cbSample * 8 /* Bit */);
    177177            if (rc == VERR_NOT_SUPPORTED)
    178178            {
     
    291291    VRDEAUDIOFORMAT format = VRDE_AUDIO_FMT_MAKE(pProps->uHz,
    292292                                                 pProps->cChannels,
    293                                                  pProps->cBytes * 8 /* Bit */,
     293                                                 pProps->cbSample * 8 /* Bit */,
    294294                                                 pProps->fSigned);
    295295
     
    429429    int rc;
    430430    if (pCfgReq->enmDir == PDMAUDIODIR_IN)
    431         rc = vrdeCreateStreamIn (pStreamVRDE, pCfgReq, pCfgAcq);
     431        rc = vrdeCreateStreamIn( pStreamVRDE, pCfgReq, pCfgAcq);
    432432    else
    433433        rc = vrdeCreateStreamOut(pStreamVRDE, pCfgReq, pCfgAcq);
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