VirtualBox

Changeset 87993 in vbox


Ignore:
Timestamp:
Mar 7, 2021 3:19:13 PM (4 years ago)
Author:
vboxsync
Message:

Audio: Switched DrvAudioHlpFramesToMilli parameters. bugref:9890

Location:
trunk/src/VBox/Devices/Audio
Files:
5 edited

Legend:

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

    r87991 r87993  
    592592    if (CfgHostAcq.Backend.cFramesBufferSize != pCfgHost->Backend.cFramesBufferSize)
    593593        LogRel2(("Audio: Backend changed buffer size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
    594                  DrvAudioHlpFramesToMilli(pCfgHost->Backend.cFramesBufferSize, &pCfgHost->Props), pCfgHost->Backend.cFramesBufferSize,
    595                  DrvAudioHlpFramesToMilli(CfgHostAcq.Backend.cFramesBufferSize, &CfgHostAcq.Props), CfgHostAcq.Backend.cFramesBufferSize));
     594                 DrvAudioHlpFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesBufferSize), pCfgHost->Backend.cFramesBufferSize,
     595                 DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesBufferSize), CfgHostAcq.Backend.cFramesBufferSize));
    596596
    597597    if (CfgHostAcq.Backend.cFramesPeriod != pCfgHost->Backend.cFramesPeriod)
    598598        LogRel2(("Audio: Backend changed period size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
    599                  DrvAudioHlpFramesToMilli(pCfgHost->Backend.cFramesPeriod, &pCfgHost->Props), pCfgHost->Backend.cFramesPeriod,
    600                  DrvAudioHlpFramesToMilli(CfgHostAcq.Backend.cFramesPeriod, &CfgHostAcq.Props), CfgHostAcq.Backend.cFramesPeriod));
     599                 DrvAudioHlpFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesPeriod), pCfgHost->Backend.cFramesPeriod,
     600                 DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPeriod), CfgHostAcq.Backend.cFramesPeriod));
    601601
    602602    if (CfgHostAcq.Backend.cFramesPreBuffering != pCfgHost->Backend.cFramesPreBuffering)
    603603        LogRel2(("Audio: Backend changed pre-buffering size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
    604                  DrvAudioHlpFramesToMilli(pCfgHost->Backend.cFramesPreBuffering, &pCfgHost->Props), pCfgHost->Backend.cFramesPreBuffering,
    605                  DrvAudioHlpFramesToMilli(CfgHostAcq.Backend.cFramesPreBuffering, &CfgHostAcq.Props), CfgHostAcq.Backend.cFramesPreBuffering));
     604                 DrvAudioHlpFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesPreBuffering), pCfgHost->Backend.cFramesPreBuffering,
     605                 DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering), CfgHostAcq.Backend.cFramesPreBuffering));
    606606    /*
    607607     * Configure host buffers.
     
    625625    }
    626626
    627     uint64_t msBufferSize = DrvAudioHlpFramesToMilli(CfgHostAcq.Backend.cFramesBufferSize, &CfgHostAcq.Props);
     627    uint64_t msBufferSize = DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesBufferSize);
    628628
    629629    LogRel2(("Audio: Buffer size of stream '%s' is %RU64ms (%RU32 frames)\n",
     
    631631
    632632    /* If no own pre-buffer is set, let the backend choose. */
    633     uint64_t msPreBuf = DrvAudioHlpFramesToMilli(CfgHostAcq.Backend.cFramesPreBuffering, &CfgHostAcq.Props);
     633    uint64_t msPreBuf = DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering);
    634634    LogRel2(("Audio: Pre-buffering size of stream '%s' is %RU64ms (%RU32 frames)\n",
    635635             pStream->szName, msPreBuf, CfgHostAcq.Backend.cFramesPreBuffering));
    636636
    637637    /* Make sure the configured buffer size by the backend at least can hold the configured latency. */
    638     const uint32_t msPeriod = DrvAudioHlpFramesToMilli(CfgHostAcq.Backend.cFramesPeriod, &CfgHostAcq.Props);
     638    const uint32_t msPeriod = DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPeriod);
    639639
    640640    LogRel2(("Audio: Period size of stream '%s' is %RU64ms (%RU32 frames)\n",
     
    10291029
    10301030                Log3Func(("[%s] Writing %RU32 frames (%RU64ms)\n",
    1031                           pStream->szName, cfGstWritten, DrvAudioHlpFramesToMilli(cfGstWritten, &pStream->Guest.Cfg.Props)));
     1031                          pStream->szName, cfGstWritten, DrvAudioHlpFramesToMilli(&pStream->Guest.Cfg.Props, cfGstWritten)));
    10321032
    10331033                Log3Func(("[%s] Last written %RU64ns (%RU64ms), now filled with %RU64ms -- %RU8%%\n",
    10341034                          pStream->szName, tsNowNs - pStream->tsLastReadWrittenNs,
    10351035                          (tsNowNs - pStream->tsLastReadWrittenNs) / RT_NS_1MS,
    1036                           DrvAudioHlpFramesToMilli(AudioMixBufUsed(&pStream->Host.MixBuf), &pStream->Host.Cfg.Props),
     1036                          DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, AudioMixBufUsed(&pStream->Host.MixBuf)),
    10371037                          AudioMixBufUsed(&pStream->Host.MixBuf) * 100 / AudioMixBufSize(&pStream->Host.MixBuf)));
    10381038
     
    15501550        Log3Func(("[%s] Last played %RU64ns (%RU64ms), filled with %RU64ms (%RU8%%) total (fThresholdReached=%RTbool)\n",
    15511551                  pStream->szName, tsDeltaPlayedCapturedNs, tsDeltaPlayedCapturedNs / RT_NS_1MS_64,
    1552                   DrvAudioHlpFramesToMilli(cFramesLive, &pStream->Host.Cfg.Props), uLivePercent, pStream->fThresholdReached));
     1552                  DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cFramesLive), uLivePercent, pStream->fThresholdReached));
    15531553
    15541554        if (   pStream->fThresholdReached         /* Has the treshold been reached (e.g. are we in playing stage) ... */
     
    15561556        {
    15571557            LogRel2(("Audio: Buffer underrun for stream '%s' occurred (%RU64ms passed)\n",
    1558                      pStream->szName, DrvAudioHlpFramesToMilli(cfPassedReal, &pStream->Host.Cfg.Props)));
     1558                     pStream->szName, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfPassedReal)));
    15591559
    15601560            if (pStream->Host.Cfg.Backend.cFramesPreBuffering) /* Any pre-buffering configured? */
     
    16221622#ifdef DEBUG
    16231623            Log3Func(("[%s] Playing %RU32 frames (%RU64ms), now filled with %RU64ms -- %RU8%%\n",
    1624                       pStream->szName, cfToPlay, DrvAudioHlpFramesToMilli(cfToPlay, &pStream->Host.Cfg.Props),
    1625                       DrvAudioHlpFramesToMilli(AudioMixBufUsed(&pStream->Host.MixBuf), &pStream->Host.Cfg.Props),
     1624                      pStream->szName, cfToPlay, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfToPlay),
     1625                      DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, AudioMixBufUsed(&pStream->Host.MixBuf)),
    16261626                      AudioMixBufUsed(&pStream->Host.MixBuf) * 100 / AudioMixBufSize(&pStream->Host.MixBuf)));
    16271627#endif
     
    16541654                      DrvAudioHlpMilliToFrames(pStream->Guest.Cfg.Device.cMsSchedulingHint, &pStream->Host.Cfg.Props),
    16551655                      pStream->Guest.Cfg.Device.cMsSchedulingHint,
    1656                       cfPassedReal, DrvAudioHlpFramesToMilli(cfPassedReal, &pStream->Host.Cfg.Props),
    1657                       cFramesLive, DrvAudioHlpFramesToMilli(cFramesLive, &pStream->Host.Cfg.Props),
    1658                       cFramesPeriod, DrvAudioHlpFramesToMilli(cFramesPeriod, &pStream->Host.Cfg.Props),
    1659                       cfWritable, DrvAudioHlpFramesToMilli(cfWritable, &pStream->Host.Cfg.Props),
    1660                       cfToPlay, DrvAudioHlpFramesToMilli(cfToPlay, &pStream->Host.Cfg.Props),
    1661                       cfPlayedTotal, DrvAudioHlpFramesToMilli(cfPlayedTotal, &pStream->Host.Cfg.Props)));
     1656                      cfPassedReal, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfPassedReal),
     1657                      cFramesLive, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cFramesLive),
     1658                      cFramesPeriod, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cFramesPeriod),
     1659                      cfWritable, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfWritable),
     1660                      cfToPlay, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfToPlay),
     1661                      cfPlayedTotal, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfPlayedTotal)));
    16621662        }
    16631663
     
    25042504        {
    25052505            Log3Func(("[%s] Filling in silence (%RU64ms / %RU64ms)\n", pStream->szName,
    2506                       DrvAudioHlpFramesToMilli(cfBuf - cfReadTotal, &pStream->Guest.Cfg.Props),
    2507                       DrvAudioHlpFramesToMilli(cfBuf, &pStream->Guest.Cfg.Props)));
     2506                      DrvAudioHlpFramesToMilli(&pStream->Guest.Cfg.Props, cfBuf - cfReadTotal),
     2507                      DrvAudioHlpFramesToMilli(&pStream->Guest.Cfg.Props, cfBuf)));
    25082508
    25092509            DrvAudioHlpClearBuf(&pStream->Guest.Cfg.Props,
     
    32283228    }
    32293229
    3230     LogRel2(("Audio: Using %s period size (%RU64ms, %RU32 frames) for stream '%s'\n",
    3231              szWhat,
    3232              DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesPeriod, &pCfgReq->Props), pCfgReq->Backend.cFramesPeriod, pStream->szName));
     3230    LogRel2(("Audio: Using %s period size %RU64 ms / %RU32 frames for stream '%s'\n",
     3231             szWhat, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod),
     3232             pCfgReq->Backend.cFramesPeriod, pStream->szName));
    32333233
    32343234    /*
     
    32473247    }
    32483248
    3249     LogRel2(("Audio: Using %s buffer size (%RU64ms, %RU32 frames) for stream '%s'\n",
    3250              szWhat,
    3251              DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props), pCfgReq->Backend.cFramesBufferSize, pStream->szName));
     3249    LogRel2(("Audio: Using %s buffer size %RU64 ms / %RU32 frames for stream '%s'\n",
     3250             szWhat, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize),
     3251             pCfgReq->Backend.cFramesBufferSize, pStream->szName));
    32523252
    32533253    /*
     
    32693269    }
    32703270
    3271     LogRel2(("Audio: Using %s pre-buffering size (%RU64ms, %RU32 frames) for stream '%s'\n",
    3272              szWhat,
    3273              DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesPreBuffering, &pCfgReq->Props), pCfgReq->Backend.cFramesPreBuffering, pStream->szName));
     3271    LogRel2(("Audio: Using %s pre-buffering size %RU64 ms / %RU32 frames for stream '%s'\n",
     3272             szWhat, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPreBuffering),
     3273             pCfgReq->Backend.cFramesPreBuffering, pStream->szName));
    32743274
    32753275    /*
     
    32793279    {
    32803280        LogRel(("Audio: Error for stream '%s': Buffering size (%RU64ms) must not be smaller than the period size (%RU64ms)\n",
    3281                 pStream->szName, DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props),
    3282                 DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesPeriod, &pCfgReq->Props)));
     3281                pStream->szName, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize),
     3282                DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod)));
    32833283        return VERR_INVALID_PARAMETER;
    32843284    }
     
    32903290        {
    32913291            LogRel(("Audio: Error for stream '%s': Buffering size (%RU64ms) must not be smaller than the pre-buffering size (%RU64ms)\n",
    3292                     pStream->szName, DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesPreBuffering, &pCfgReq->Props),
    3293                     DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props)));
     3292                    pStream->szName, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPreBuffering),
     3293                    DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize)));
    32943294            return VERR_INVALID_PARAMETER;
    32953295        }
     
    33293329    if (pCfgAcq->Backend.cFramesBufferSize != pCfgReq->Backend.cFramesBufferSize)
    33303330        LogRel2(("Audio: Buffer size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n",
    3331                  pStream->szName, DrvAudioHlpFramesToMilli(pCfgAcq->Backend.cFramesBufferSize, &pCfgAcq->Props), pCfgAcq->Backend.cFramesBufferSize));
     3331                 pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesBufferSize), pCfgAcq->Backend.cFramesBufferSize));
    33323332
    33333333    if (pCfgAcq->Backend.cFramesPeriod != pCfgReq->Backend.cFramesPeriod)
    33343334        LogRel2(("Audio: Period size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n",
    3335                  pStream->szName, DrvAudioHlpFramesToMilli(pCfgAcq->Backend.cFramesPeriod, &pCfgAcq->Props), pCfgAcq->Backend.cFramesPeriod));
     3335                 pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPeriod), pCfgAcq->Backend.cFramesPeriod));
    33363336
    33373337    /* Was pre-buffering requested, but the acquired configuration from the backend told us something else? */
     
    33403340        if (pCfgAcq->Backend.cFramesPreBuffering != pCfgReq->Backend.cFramesPreBuffering)
    33413341            LogRel2(("Audio: Pre-buffering size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n",
    3342                      pStream->szName, DrvAudioHlpFramesToMilli(pCfgAcq->Backend.cFramesPreBuffering, &pCfgAcq->Props), pCfgAcq->Backend.cFramesPreBuffering));
     3342                     pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
    33433343
    33443344        if (pCfgAcq->Backend.cFramesPreBuffering > pCfgAcq->Backend.cFramesBufferSize)
     
    33463346            pCfgAcq->Backend.cFramesPreBuffering = pCfgAcq->Backend.cFramesBufferSize;
    33473347            LogRel2(("Audio: Pre-buffering size bigger than buffer size for stream '%s', adjusting to %RU64ms (%RU32 frames)\n",
    3348                      pStream->szName, DrvAudioHlpFramesToMilli(pCfgAcq->Backend.cFramesPreBuffering, &pCfgAcq->Props), pCfgAcq->Backend.cFramesPreBuffering));
     3348                     pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
    33493349        }
    33503350    }
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r87992 r87993  
    205205uint64_t DrvAudioHlpBytesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    206206uint32_t DrvAudioHlpFramesToBytes(uint32_t cFrames, PCPDMAUDIOPCMPROPS pProps);
    207 uint64_t DrvAudioHlpFramesToMilli(uint32_t cFrames, PCPDMAUDIOPCMPROPS pProps);
     207uint64_t DrvAudioHlpFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
    208208uint64_t DrvAudioHlpFramesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
    209209uint32_t DrvAudioHlpMilliToBytes(uint64_t uMs, PCPDMAUDIOPCMPROPS pProps);
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r87992 r87993  
    13471347 * @param   cFrames     Number of audio frames to convert.
    13481348 */
    1349 uint64_t DrvAudioHlpFramesToMilli(uint32_t cFrames, PCPDMAUDIOPCMPROPS pProps)
     1349uint64_t DrvAudioHlpFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames)
    13501350{
    13511351    AssertPtrReturn(pProps, 0);
  • trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp

    r87979 r87993  
    794794    pStreamPA->SampleSpec.channels = pCfgReq->Props.cChannels;
    795795
    796     pStreamPA->curLatencyUs        = DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props) * RT_US_1MS;
     796    pStreamPA->curLatencyUs        = DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize) * RT_US_1MS;
    797797
    798798    const uint32_t cbLatency = pa_usec_to_bytes(pStreamPA->curLatencyUs, &pStreamPA->SampleSpec);
  • trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp

    r87992 r87993  
    6666    RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToNano(&s_Cfg441StereoS16, 44100)) == RT_NS_1SEC,
    6767                      ("ns=%RU64\n", u64));
    68     //RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMicro(44100, &s_Cfg441StereoS16)) == RT_US_1SEC,
     68    //RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMicro(&s_Cfg441StereoS16, 44100)) == RT_US_1SEC,
    6969    //                  ("us=%RU64\n", u64));
    70     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMilli(44100, &s_Cfg441StereoS16)) == RT_MS_1SEC,
     70    RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMilli(&s_Cfg441StereoS16, 44100)) == RT_MS_1SEC,
    7171                      ("ms=%RU64\n", u64));
    7272
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