VirtualBox

Changeset 64968 in vbox


Ignore:
Timestamp:
Dec 20, 2016 6:55:21 PM (8 years ago)
Author:
vboxsync
Message:

Logging.

File:
1 edited

Legend:

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

    r64868 r64968  
    6868static void audioMixerStreamDestroyInternal(PAUDMIXSTREAM pStream);
    6969
     70
     71#ifdef LOG_ENABLED
     72/**
     73 * Converts a mixer sink status to a string.
     74 *
     75 * @returns Stringified mixer sink flags. Must be free'd with RTStrFree().
     76 *          "NONE" if no flags set.
     77 * @param   fFlags              Mixer sink flags to convert.
     78 */
     79char *dbgAudioMixerSinkStatusToStr(AUDMIXSINKSTS fStatus)
     80{
     81#define APPEND_FLAG_TO_STR(_aFlag)              \
     82    if (fStatus & AUDMIXSINK_STS_##_aFlag)      \
     83    {                                           \
     84        if (pszFlags)                           \
     85        {                                       \
     86            rc2 = RTStrAAppend(&pszFlags, " "); \
     87            if (RT_FAILURE(rc2))                \
     88                break;                          \
     89        }                                       \
     90                                                \
     91        rc2 = RTStrAAppend(&pszFlags, #_aFlag); \
     92        if (RT_FAILURE(rc2))                    \
     93            break;                              \
     94    }                                           \
     95
     96    char *pszFlags = NULL;
     97    int rc2 = VINF_SUCCESS;
     98
     99    do
     100    {
     101        APPEND_FLAG_TO_STR(NONE);
     102        APPEND_FLAG_TO_STR(RUNNING);
     103        APPEND_FLAG_TO_STR(PENDING_DISABLE);
     104        APPEND_FLAG_TO_STR(DIRTY);
     105
     106    } while (0);
     107
     108    if (   RT_FAILURE(rc2)
     109        && pszFlags)
     110    {
     111        RTStrFree(pszFlags);
     112        pszFlags = NULL;
     113    }
     114
     115#undef APPEND_FLAG_TO_STR
     116
     117    return pszFlags;
     118}
     119#endif /* DEBUG */
    70120
    71121/**
     
    682732    }
    683733
    684     LogFlowFunc(("[%s]: enmCmd=%d, fStatus=0x%x, rc=%Rrc\n", pSink->pszName, enmSinkCmd, pSink->fStatus, rc));
     734#ifdef LOG_ENABLED
     735    char *pszStatus = dbgAudioMixerSinkStatusToStr(pSink->fStatus);
     736    LogFlowFunc(("[%s]: enmCmd=%d, fStatus=%s, rc=%Rrc\n", pSink->pszName, enmSinkCmd, pszStatus, rc));
     737    RTStrFree(pszStatus);
     738#endif
    685739
    686740    /* Not running anymore? Reset. */
     
    10091063              ("Can't read from a sink which is not an input sink\n"));
    10101064
    1011 #ifndef VBOX_AUDIO_MIXER_WITH_MIXBUF
     1065#ifdef VBOX_AUDIO_MIXER_WITH_MIXBUF
     1066# error "Implement me!"
     1067#else
    10121068    uint8_t *pvMixBuf = (uint8_t *)RTMemAlloc(cbBuf);
    10131069    if (!pvMixBuf)
     
    10531109                LogFunc(("[%s] Failed reading from stream '%s': %Rrc\n", pSink->pszName, pMixStream->pszName, rc2));
    10541110
     1111            Log3Func(("[%s] Stream '%s': Read %RU32 bytes\n", pSink->pszName, pMixStream->pszName, cbReadStrm));
     1112
    10551113            if (   RT_FAILURE(rc2)
    10561114                || !cbReadStrm)
     
    10951153#endif
    10961154
    1097     Log3Func(("[%s] cbRead=%RU32, fClean=%RTbool, fStatus=0x%x, rc=%Rrc\n", pSink->pszName, cbRead, fClean, pSink->fStatus, rc));
     1155
     1156#ifdef LOG_ENABLED
     1157    char *pszStatus = dbgAudioMixerSinkStatusToStr(pSink->fStatus);
     1158    Log2Func(("[%s] cbRead=%RU32, fClean=%RTbool, fStatus=%s, rc=%Rrc\n", pSink->pszName, cbRead, fClean, pszStatus, rc));
     1159    RTStrFree(pszStatus);
     1160#endif
    10981161
    10991162    int rc2 = RTCritSectLeave(&pSink->CritSect);
     
    13501413    int rc = VINF_SUCCESS;
    13511414
    1352     Log3Func(("[%s] fStatus=0x%x\n", pSink->pszName, pSink->fStatus));
     1415#ifdef LOG_ENABLED
     1416    char *pszStatus = dbgAudioMixerSinkStatusToStr(pSink->fStatus);
     1417    Log3Func(("[%s] fStatus=%s\n", pSink->pszName, pszStatus));
     1418    RTStrFree(pszStatus);
     1419#endif
    13531420
    13541421    /* Sink disabled? Take a shortcut. */
     
    15351602        return rc;
    15361603
    1537     AssertMsg(pSink->fStatus & AUDMIXSINK_STS_RUNNING, ("%s: Can't write to a sink which is not running (anymore)\n",
    1538                                                         pSink->pszName));
    1539     AssertMsg(pSink->enmDir == AUDMIXSINKDIR_OUTPUT,   ("%s: Can't write to a sink which is not an output sink\n",
    1540                                                         pSink->pszName));
     1604    AssertMsg(pSink->fStatus & AUDMIXSINK_STS_RUNNING,
     1605              ("%s: Can't write to a sink which is not running (anymore) (status 0x%x)\n", pSink->pszName, pSink->fStatus));
     1606    AssertMsg(pSink->enmDir == AUDMIXSINKDIR_OUTPUT,
     1607              ("%s: Can't write to a sink which is not an output sink\n", pSink->pszName));
    15411608
    15421609    Log3Func(("[%s] enmOp=%d, cbBuf=%RU32\n", pSink->pszName, enmOp, cbBuf));
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