VirtualBox

Changeset 88016 in vbox


Ignore:
Timestamp:
Mar 8, 2021 1:14:14 PM (4 years ago)
Author:
vboxsync
Message:

Audio: DrvAudioHlpPCMPropsAreValid -> DrvAudioHlpPcmPropsAreValid; todos. bugref:9890

Location:
trunk/src/VBox
Files:
9 edited

Legend:

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

    r88015 r88016  
    614614     * Always use the sink's PCM audio format as the host side when creating a stream for it.
    615615     */
    616     AssertMsg(DrvAudioHlpPCMPropsAreValid(&pSink->PCMProps),
     616    AssertMsg(DrvAudioHlpPcmPropsAreValid(&pSink->PCMProps),
    617617              ("%s: Does not (yet) have a format set when it must\n", pSink->pszName));
    618618
     
    14691469    AssertPtrReturn(pSink,     VERR_INVALID_POINTER);
    14701470    AssertPtrReturn(pPCMProps, VERR_INVALID_POINTER);
    1471     AssertReturn(DrvAudioHlpPCMPropsAreValid(pPCMProps), VERR_INVALID_PARAMETER);
     1471    AssertReturn(DrvAudioHlpPcmPropsAreValid(pPCMProps), VERR_INVALID_PARAMETER);
    14721472
    14731473    int rc = RTCritSectEnter(&pSink->CritSect);
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r88006 r88016  
    32063206
    32073207    /* Validate PCM properties. */
    3208     if (!DrvAudioHlpPCMPropsAreValid(&pCfgReq->Props))
     3208    if (!DrvAudioHlpPcmPropsAreValid(&pCfgReq->Props))
    32093209    {
    32103210        LogRel(("Audio: Invalid custom PCM properties set for stream '%s', cannot create stream\n", pStream->szName));
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r88015 r88016  
    218218
    219219bool     DrvAudioHlpPcmPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps1, PCPDMAUDIOPCMPROPS pPCMProps2);
    220 bool     DrvAudioHlpPCMPropsAreValid(PCPDMAUDIOPCMPROPS pProps);
     220bool     DrvAudioHlpPcmPropsAreValid(PCPDMAUDIOPCMPROPS pProps);
    221221void     DrvAudioHlpPcmPropsLog(PCPDMAUDIOPCMPROPS pProps);
    222222/** @}  */
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r88015 r88016  
    786786
    787787    if (fValid)
    788         fValid = DrvAudioHlpPCMPropsAreValid(&pCfg->Props);
     788        fValid = DrvAudioHlpPcmPropsAreValid(&pCfg->Props);
    789789
    790790    return fValid;
     
    13421342
    13431343/**
    1344  * Checks whether two given PCM properties are equal.
    1345  *
    1346  * @returns @c true if equal, @c false if not.
    1347  * @param   pProps1             First properties to compare.
    1348  * @param   pProps2             Second properties to compare.
     1344 * Compares two sets of PCM properties.
     1345 *
     1346 * @returns @c true if the same, @c false if not.
     1347 * @param   pProps1     The first set of properties to compare.
     1348 * @param   pProps2     The second set of properties to compare.
    13491349 */
    13501350bool DrvAudioHlpPcmPropsAreEqual(PCPDMAUDIOPCMPROPS pProps1, PCPDMAUDIOPCMPROPS pProps2)
     
    13561356        return true;
    13571357
    1358     return    pProps1->uHz         == pProps2->uHz
    1359            && pProps1->cChannels   == pProps2->cChannels
    1360            && pProps1->cbSample    == pProps2->cbSample
    1361            && pProps1->fSigned     == pProps2->fSigned
    1362            && pProps1->fSwapEndian == pProps2->fSwapEndian;
     1358    return pProps1->uHz         == pProps2->uHz
     1359        && pProps1->cChannels   == pProps2->cChannels
     1360        && pProps1->cbSample    == pProps2->cbSample
     1361        && pProps1->fSigned     == pProps2->fSigned
     1362        && pProps1->fSwapEndian == pProps2->fSwapEndian;
    13631363}
    13641364
     
    13661366 * Checks whether given PCM properties are valid or not.
    13671367 *
    1368  * Returns @c true if properties are valid, @c false if not.
    1369  * @param   pProps              PCM properties to check.
    1370  */
    1371 bool DrvAudioHlpPCMPropsAreValid(PCPDMAUDIOPCMPROPS pProps)
     1368 * @note  This is more of a supported than valid check.  There is code for
     1369 *        unsigned samples elsewhere (like DrvAudioHlpClearBuf()), but this
     1370 *        function will flag such properties as not valid.
     1371 *
     1372 * @todo  r=bird: See note and explain properly.
     1373 *
     1374 * @returns @c true if the properties are valid, @c false if not.
     1375 * @param   pProps      The PCM properties to check.
     1376 */
     1377bool DrvAudioHlpPcmPropsAreValid(PCPDMAUDIOPCMPROPS pProps)
    13721378{
    13731379    AssertPtrReturn(pProps, false);
     1380
     1381    /** @todo r=bird: This code is cannot make up its mind whether to return on
     1382     *        false, or whether to return at the end. (hint: just return
     1383     *        immediately, duh.) */
    13741384
    13751385    /* Minimum 1 channel (mono), maximum 7.1 (= 8) channels. */
  • trunk/src/VBox/Devices/Audio/HDAStream.cpp

    r88006 r88016  
    868868        && pStreamR3->Dbg.Runtime.fEnabled)
    869869    {
    870         Assert(DrvAudioHlpPCMPropsAreValid(&pStreamShared->State.Cfg.Props));
     870        Assert(DrvAudioHlpPcmPropsAreValid(&pStreamShared->State.Cfg.Props));
    871871
    872872        if (fEnable)
  • trunk/src/VBox/Devices/Audio/HDAStreamMap.cpp

    r87942 r88016  
    4949    AssertPtrReturn(pProps,   VERR_INVALID_POINTER);
    5050
    51     if (!DrvAudioHlpPCMPropsAreValid(pProps))
     51    if (!DrvAudioHlpPcmPropsAreValid(pProps))
    5252        return VERR_INVALID_PARAMETER;
    5353
  • trunk/src/VBox/Devices/Audio/HDAStreamPeriod.cpp

    r87810 r88016  
    8383    if (   !u16LVI
    8484        || !u32CBL
    85         || !DrvAudioHlpPCMPropsAreValid(&pStreamCfg->Props))
     85        || !DrvAudioHlpPcmPropsAreValid(&pStreamCfg->Props))
    8686    {
    8787        return VERR_INVALID_PARAMETER;
  • trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp

    r88009 r88016  
    6363
    6464    RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoS16) == 44100*4*8);
     65    RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoU16) == 44100*4*8);
    6566    RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoU32) == 44100*8*8);
     67
     68    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&s_Cfg441StereoS16));
     69    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&s_Cfg441StereoU16) == false); /* go figure */
     70    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&s_Cfg441StereoU32) == false); /* go figure */
     71
    6672
    6773    RTTESTI_CHECK_MSG(PDMAUDIOPCMPROPS_F2B(&s_Cfg441StereoS16, 1) == 4,
     
    193199    );
    194200
    195     RTTESTI_CHECK(DrvAudioHlpPCMPropsAreValid(&config));
     201    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&config));
    196202
    197203    uint32_t cBufSize = _1K;
     
    314320    );
    315321
    316     RTTESTI_CHECK(DrvAudioHlpPCMPropsAreValid(&cfg_p));
     322    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&cfg_p));
    317323
    318324    PDMAUDIOMIXBUF parent;
     
    329335    );
    330336
    331     RTTESTI_CHECK(DrvAudioHlpPCMPropsAreValid(&cfg_c1));
     337    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&cfg_c1));
    332338
    333339    uint32_t cFrames      = 16;
     
    348354    );
    349355
    350     RTTESTI_CHECK(DrvAudioHlpPCMPropsAreValid(&cfg_c2));
     356    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&cfg_c2));
    351357
    352358    PDMAUDIOMIXBUF child2;
     
    462468    );
    463469
    464     RTTESTI_CHECK(DrvAudioHlpPCMPropsAreValid(&cfg_p));
     470    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&cfg_p));
    465471
    466472    PDMAUDIOMIXBUF parent;
     
    485491    );
    486492
    487     RTTESTI_CHECK(DrvAudioHlpPCMPropsAreValid(&cfg_c));
     493    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&cfg_c));
    488494
    489495    PDMAUDIOMIXBUF child;
     
    567573    );
    568574
    569     RTTESTI_CHECK(DrvAudioHlpPCMPropsAreValid(&cfg_p));
     575    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&cfg_p));
    570576
    571577    PDMAUDIOMIXBUF parent;
     
    582588    );
    583589
    584     RTTESTI_CHECK(DrvAudioHlpPCMPropsAreValid(&cfg_c));
     590    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&cfg_c));
    585591
    586592    PDMAUDIOMIXBUF child;
     
    664670    );
    665671
    666     RTTESTI_CHECK(DrvAudioHlpPCMPropsAreValid(&cfg));
     672    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&cfg));
    667673
    668674    PDMAUDIOVOLUME vol = { false, 0, 0 };   /* Not muted. */
  • trunk/src/VBox/Main/src-client/DrvAudioRec.cpp

    r88002 r88016  
    12321232    pPCMProps->fSwapEndian = false;
    12331233
    1234     AssertMsgReturn(DrvAudioHlpPCMPropsAreValid(pPCMProps),
     1234    AssertMsgReturn(DrvAudioHlpPcmPropsAreValid(pPCMProps),
    12351235                    ("Configuration error: Audio configuration is invalid!\n"), VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES);
    12361236
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