VirtualBox

Ignore:
Timestamp:
Nov 27, 2019 9:31:53 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
135070
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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette