VirtualBox

Changeset 65762 in vbox


Ignore:
Timestamp:
Feb 13, 2017 12:26:29 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113477
Message:

Audio/DrvHostCoreAudio.cpp: Use circular buffer for drvHostCoreAudioStreamGetReadable() / drvHostCoreAudioStreamGetWritable().

File:
1 edited

Legend:

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

    r65694 r65762  
    24222422    PCOREAUDIOSTREAM pCAStream = (PCOREAUDIOSTREAM)pStream;
    24232423
    2424     return   (ASMAtomicReadU32(&pCAStream->enmStatus) == COREAUDIOSTATUS_INIT)
    2425            ? UINT32_MAX : 0;
     2424    if (ASMAtomicReadU32(&pCAStream->enmStatus) != COREAUDIOSTATUS_INIT)
     2425        return 0;
     2426
     2427    AssertPtr(pCAStream->pCfg);
     2428    AssertPtr(pCAStream->pCircBuf);
     2429
     2430    switch (pCAStream->pCfg->enmDir)
     2431    {
     2432        case PDMAUDIODIR_IN:
     2433            return (uint32_t)RTCircBufUsed(pCAStream->pCircBuf);
     2434
     2435        case PDMAUDIODIR_OUT:
     2436        default:
     2437            AssertFailed();
     2438            break;
     2439    }
     2440
     2441    return 0;
    24262442}
    24272443
     
    24372453    PCOREAUDIOSTREAM pCAStream = (PCOREAUDIOSTREAM)pStream;
    24382454
    2439     return   (ASMAtomicReadU32(&pCAStream->enmStatus) == COREAUDIOSTATUS_INIT)
    2440            ? UINT32_MAX : 0;
     2455    if (ASMAtomicReadU32(&pCAStream->enmStatus) != COREAUDIOSTATUS_INIT)
     2456        return 0;
     2457
     2458    AssertPtr(pCAStream->pCfg);
     2459    AssertPtr(pCAStream->pCircBuf);
     2460
     2461    switch (pCAStream->pCfg->enmDir)
     2462    {
     2463        case PDMAUDIODIR_OUT:
     2464            return (uint32_t)RTCircBufFree(pCAStream->pCircBuf);
     2465
     2466        case PDMAUDIODIR_IN:
     2467        default:
     2468            AssertFailed();
     2469            break;
     2470    }
     2471
     2472    return 0;
    24412473}
    24422474
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