VirtualBox

Changeset 64967 in vbox


Ignore:
Timestamp:
Dec 20, 2016 6:52:11 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
112443
Message:

Logging.

File:
1 edited

Legend:

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

    r64956 r64967  
    137137# endif /* unused */
    138138
     139#ifdef LOG_ENABLED
     140/**
     141 * Converts an audio stream status to a string.
     142 *
     143 * @returns Stringified stream status flags. Must be free'd with RTStrFree().
     144 *          "NONE" if no flags set.
     145 * @param   fFlags              Stream status flags to convert.
     146 */
     147char *dbgAudioStreamStatusToStr(PDMAUDIOSTRMSTS fStatus)
     148{
     149#define APPEND_FLAG_TO_STR(_aFlag)              \
     150    if (fStatus & PDMAUDIOSTRMSTS_FLAG_##_aFlag) \
     151    {                                            \
     152        if (pszFlags)                            \
     153        {                                        \
     154            rc2 = RTStrAAppend(&pszFlags, " ");  \
     155            if (RT_FAILURE(rc2))                 \
     156                break;                           \
     157        }                                        \
     158                                                 \
     159        rc2 = RTStrAAppend(&pszFlags, #_aFlag);  \
     160        if (RT_FAILURE(rc2))                     \
     161            break;                               \
     162    }                                            \
     163
     164    char *pszFlags = NULL;
     165    int rc2 = VINF_SUCCESS;
     166
     167    do
     168    {
     169        APPEND_FLAG_TO_STR(NONE           );
     170        APPEND_FLAG_TO_STR(INITIALIZED    );
     171        APPEND_FLAG_TO_STR(ENABLED        );
     172        APPEND_FLAG_TO_STR(PAUSED         );
     173        APPEND_FLAG_TO_STR(PENDING_DISABLE);
     174        APPEND_FLAG_TO_STR(DATA_READABLE  );
     175        APPEND_FLAG_TO_STR(DATA_WRITABLE  );
     176        APPEND_FLAG_TO_STR(PENDING_REINIT );
     177    } while (0);
     178
     179    if (   RT_FAILURE(rc2)
     180        && pszFlags)
     181    {
     182        RTStrFree(pszFlags);
     183        pszFlags = NULL;
     184    }
     185
     186#undef APPEND_FLAG_TO_STR
     187
     188    return pszFlags;
     189}
     190#endif /* LOG_ENABLED */
     191
    139192/**
    140193 * Returns the host stream part of an audio stream pair, or NULL
     
    311364    AssertPtr(pGstStream);
    312365
    313     LogFlowFunc(("Status host=0x%x, guest=0x%x\n", pHstStream->fStatus, pGstStream->fStatus));
     366#ifdef LOG_ENABLED
     367    char *pszHstFlags = dbgAudioStreamStatusToStr(pHstStream->fStatus);
     368    char *pszGstFlags = dbgAudioStreamStatusToStr(pHstStream->fStatus);
     369    LogFlowFunc(("Status host=%s, guest=%s\n", pszHstFlags, pszGstFlags));
     370    RTStrFree(pszGstFlags);
     371    RTStrFree(pszHstFlags);
     372#endif /* LOG_ENABLED */
    314373
    315374    int rc = VINF_SUCCESS;
     
    421480        return VERR_NOT_FOUND;
    422481
    423     LogFlowFunc(("[%s] enmStreamCmd=%RU32, fStatus=0x%x\n", pHstStream->szName, enmStreamCmd, pHstStream->fStatus));
     482#ifdef LOG_ENABLED
     483    char *pszHstFlags = dbgAudioStreamStatusToStr(pHstStream->fStatus);
     484    LogFlowFunc(("[%s] enmStreamCmd=%RU32, fStatus=%s\n", pHstStream->szName, enmStreamCmd, pszHstFlags));
     485    RTStrFree(pszHstFlags);
     486#endif /* LOG_ENABLED */
    424487
    425488    AssertPtr(pThis->pHostDrvAudio);
     
    9931056    }
    9941057
    995     Log3Func(("[%s] fStatus=0x%x\n", pHstStream->szName, pHstStream->fStatus));
     1058#ifdef LOG_ENABLED
     1059    char *pszHstFlags = dbgAudioStreamStatusToStr(pHstStream->fStatus);
     1060    Log3Func(("[%s] fStatus=%s\n", pHstStream->szName, pszHstFlags));
     1061    RTStrFree(pszHstFlags);
     1062#endif /* LOG_ENABLED */
    9961063
    9971064    /* Not enabled or paused? Skip iteration. */
     
    12741341                    STAM_COUNTER_ADD(&pHstStream->In.StatSamplesCaptured, cSamplesCaptured);
    12751342#endif
     1343                    Log3Func(("[%s] %RU32 samples captured\n", pHstStream->szName, cSamplesCaptured));
    12761344                }
    12771345            }
    1278         }
    1279 
    1280         Log3Func(("[%s] stsBackend=0x%x, cSamplesLive=%RU32, cSamplesCaptured=%RU32, rc=%Rrc\n",
    1281                   pHstStream->szName, stsBackend, cSamplesLive, cSamplesCaptured, rc));
     1346            else
     1347                Log3Func(("[%s] Skipping (backend status 0x%x)\n", pHstStream->szName, stsBackend));
     1348        }
     1349        else
     1350            Log3Func(("[%s] Skipping (still has %RU32 live samples)\n", pHstStream->szName, cSamplesLive));
    12821351
    12831352    } while (0);
     
    12881357            *pcSamplesCaptured = cSamplesCaptured;
    12891358    }
     1359    else
     1360        LogFunc(("[%s] Failed with %Rrc\n", rc));
    12901361
    12911362    int rc2 = RTCritSectLeave(&pThis->CritSect);
     
    23652436    int rc = VINF_SUCCESS;
    23662437
    2367     LogFlowFunc(("%s: fStatus=0x%x\n", pHstStream->szName, pHstStream->fStatus));
     2438#ifdef LOG_ENABLED
     2439    char *pszHstFlags = dbgAudioStreamStatusToStr(pHstStream->fStatus);
     2440    LogFunc(("%s: fStatus=%s\n", pHstStream->szName, pszHstFlags));
     2441    RTStrFree(pszHstFlags);
     2442#endif /* LOG_ENABLED */
    23682443
    23692444    if (pHstStream->fStatus & PDMAUDIOSTRMSTS_FLAG_INITIALIZED)
Note: See TracChangeset for help on using the changeset viewer.

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