VirtualBox

儲存庫 vbox 的更動 55650


忽略:
時間撮記:
2015-5-4 下午02:49:21 (10 年 以前)
作者:
vboxsync
svn:sync-xref-src-repo-rev:
100025
訊息:

DrvAudioVRDE: consume samples at configured rate

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r55269 r55650  
    216216    AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER);
    217217
    218     /*
    219      * Just call the VRDP server with the data.
    220      */
    221218    uint32_t live = drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */);
    222219    uint64_t now = PDMDrvHlpTMGetVirtualTime(pDrv->pDrvIns);
     
    224221    uint64_t ticks_per_second = PDMDrvHlpTMGetVirtualFreq(pDrv->pDrvIns);
    225222
     223    /* Minimize the rounding error: samples = int((ticks * freq) / ticks_per_second + 0.5). */
    226224    uint32_t cSamplesPlayed = (int)((2 * ticks * pHstStrmOut->Props.uHz + ticks_per_second) / ticks_per_second / 2);
    227     if (!cSamplesPlayed)
     225
     226    /* Don't play more than available. */
     227    if (cSamplesPlayed > live)
    228228        cSamplesPlayed = live;
     229
     230    /* Remember when samples were consumed. */
     231    pVRDEStrmOut->old_ticks = now;
    229232
    230233    VRDEAUDIOFORMAT format = VRDE_AUDIO_FMT_MAKE(pHstStrmOut->Props.uHz,
     
    233236                                                 pHstStrmOut->Props.fSigned);
    234237
    235     pVRDEStrmOut->old_ticks = now;
    236 
    237     int cSamplesToSend = live;
    238 
    239 /*  if (!cSamplesToSend)
    240     {
    241         if (pcSamplesPlayed)
    242             pcSamplesPlayed = 0;
    243 
    244         return 0;
    245     }*/
     238    int cSamplesToSend = cSamplesPlayed;
    246239
    247240    LogFlowFunc(("uFreq=%RU32, cChan=%RU8, cBits=%RU8, fSigned=%RTbool, enmFormat=%ld, cSamplesToSend=%RU32\n",
     
    250243                 format, cSamplesToSend));
    251244
     245    /*
     246     * Call the VRDP server with the data.
     247     */
    252248    uint32_t cReadTotal = 0;
    253249
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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