Changeset 61089 in vbox for trunk/src/VBox
- Timestamp:
- May 20, 2016 10:05:27 AM (9 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixBuffer.cpp
r61007 r61089 158 158 #ifdef DEBUG 159 159 static uint64_t s_cSamplesMixedTotal = 0; 160 static inline void audioMixBuf Print(PPDMAUDIOMIXBUF pMixBuf);160 static inline void audioMixBufDbgPrint(PPDMAUDIOMIXBUF pMixBuf); 161 161 #endif 162 162 … … 872 872 if (pMixBuf->pParent) /* Already linked? */ 873 873 { 874 AUDMIXBUF_LOG(("%s: Already linked to \"%s\"\n",874 AUDMIXBUF_LOG(("%s: Already linked to parent '%s'\n", 875 875 pMixBuf->pszName, pMixBuf->pParent->pszName)); 876 876 return VERR_ACCESS_DENIED; … … 1068 1068 #ifdef DEBUG 1069 1069 s_cSamplesMixedTotal += cWrittenTotal; 1070 audioMixBufPrint(pDst);1070 AudioMixBufDbgPrint(pDst); 1071 1071 #endif 1072 1072 … … 1140 1140 1141 1141 #ifdef DEBUG 1142 static void audioMixBufDbgBufPrintIndentV(uint16_t uIndent, const char *pszFormat, va_list va) 1143 { 1144 char *pszValueFormat; 1145 if (RTStrAPrintfV(&pszValueFormat, pszFormat, va)) 1146 { 1147 AUDMIXBUF_LOG(("%*s%s", uIndent, "", pszValueFormat)); 1148 RTStrFree(pszValueFormat); 1149 } 1150 } 1151 1152 static void audioMixBufDbgPrintIndent(uint16_t uIdtLvl, const char *pszFormat, ...) 1153 { 1154 va_list va; 1155 va_start(va, pszFormat); 1156 audioMixBufDbgBufPrintIndentV(uIdtLvl * 4, pszFormat, va); 1157 va_end(va); 1158 } 1159 1160 /** 1161 * Prints a single mixing buffer. 1162 * Internal helper function for debugging. Do not use directly. 1163 * 1164 * @return IPRT status code. 1165 * @param pMixBuf Mixing buffer to print. 1166 * @param fIsParent Whether this is a parent buffer or not. 1167 * @param uIdtLvl Indention level to use. 1168 */ 1169 static void audioMixBufDbgPrintSingle(PPDMAUDIOMIXBUF pMixBuf, bool fIsParent, uint16_t uIdtLvl) 1170 { 1171 audioMixBufDbgPrintIndent(uIdtLvl, 1172 "[%s] %s (%RU32): offReadWrite=%RU32, cProcessed=%RU32, cMixed=%RU32 (BpS=%RU32)\n", 1173 fIsParent ? "PARENT" : "CHILD", 1174 pMixBuf->pszName, pMixBuf->cSamples, 1175 pMixBuf->offReadWrite, pMixBuf->cProcessed, pMixBuf->cMixed, 1176 AUDIOMIXBUF_S2B(pMixBuf, 1)); 1177 } 1178 1179 /** 1180 * Internal helper function for audioMixBufPrintChain(). 1181 * Do not use directly. 1182 * 1183 * @return IPRT status code. 1184 * @param pMixBuf Mixing buffer to print. 1185 * @param uIdtLvl Indention level to use. 1186 * @param pcChildren Pointer to children counter. 1187 */ 1188 static void audioMixBufDbgPrintChainHelper(PPDMAUDIOMIXBUF pMixBuf, uint16_t uIdtLvl, size_t *pcChildren) 1189 { 1190 PPDMAUDIOMIXBUF pIter; 1191 RTListForEach(&pMixBuf->lstBuffers, pIter, PDMAUDIOMIXBUF, Node) 1192 { 1193 audioMixBufDbgPrintSingle(pIter, false /* ifIsParent */, uIdtLvl + 1); 1194 audioMixBufDbgPrintChainHelper(pIter, uIdtLvl + 1, pcChildren); 1195 } 1196 } 1197 1198 /** 1199 * Prints statistics and status of the full chain of a mixing buffer to the logger, 1200 * starting from the top root mixing buffer. 1201 * For debug versions only. 1202 * 1203 * @return IPRT status code. 1204 * @param pMixBuf Mixing buffer to print. 1205 */ 1206 void AudioMixBufDbgPrintChain(PPDMAUDIOMIXBUF pMixBuf) 1207 { 1208 PPDMAUDIOMIXBUF pParent = pMixBuf->pParent; 1209 while (pParent) 1210 { 1211 if (!pParent->pParent) 1212 break; 1213 1214 pParent = pParent->pParent; 1215 } 1216 1217 if (!pParent) 1218 pParent = pMixBuf; 1219 1220 AUDMIXBUF_LOG(("********************************************\n")); 1221 1222 audioMixBufDbgPrintSingle(pParent, true /* fIsParent */, 0 /* uIdtLvl */); 1223 1224 /* Recursively iterate children. */ 1225 size_t cChildren = 0; 1226 audioMixBufDbgPrintChainHelper(pParent, 0 /* uIdtLvl */, &cChildren); 1227 1228 AUDMIXBUF_LOG(("Children: %zu - Total samples mixed: %RU64\n", cChildren, s_cSamplesMixedTotal)); 1229 AUDMIXBUF_LOG(("********************************************\n")); 1230 } 1231 1142 1232 /** 1143 1233 * Prints statistics and status of a mixing buffer to the logger. … … 1147 1237 * @param pMixBuf Mixing buffer to print. 1148 1238 */ 1149 static inline void audioMixBufPrint(PPDMAUDIOMIXBUF pMixBuf)1239 void AudioMixBufDbgPrint(PPDMAUDIOMIXBUF pMixBuf) 1150 1240 { 1151 1241 PPDMAUDIOMIXBUF pParent = pMixBuf; … … 1154 1244 1155 1245 AUDMIXBUF_LOG(("********************************************\n")); 1156 AUDMIXBUF_LOG(("[PARENT] %s (%RU32): offReadWrite=%RU32, cProcessed=%RU32, cMixed=%RU32 (BpS=%RU32)\n", 1157 pParent->pszName, pParent->cSamples, 1158 pParent->offReadWrite, pParent->cProcessed, pParent->cMixed, 1159 AUDIOMIXBUF_S2B(pParent, 1))); 1160 1161 size_t cChildren = 0; 1246 1247 audioMixBufDbgPrintSingle(pMixBuf, true /* fIsParent */, 0 /* iIdtLevel */); 1162 1248 1163 1249 PPDMAUDIOMIXBUF pIter; 1164 1250 RTListForEach(&pParent->lstBuffers, pIter, PDMAUDIOMIXBUF, Node) 1165 { 1166 AUDMIXBUF_LOG(("\t[CHILD] %s (%RU32): offReadWrite=%RU32, cProcessed=%RU32, cMixed=%RU32 (BpS=%RU32)\n", 1167 pIter->pszName, pIter->cSamples, 1168 pIter->offReadWrite, pIter->cProcessed, pIter->cMixed, 1169 AUDIOMIXBUF_S2B(pIter, 1))); 1170 cChildren++; 1171 } 1172 AUDMIXBUF_LOG(("Children: %zu - Total samples mixed: %RU64\n", cChildren, s_cSamplesMixedTotal)); 1173 AUDMIXBUF_LOG(("********************************************\n")); 1251 audioMixBufDbgPrintSingle(pMixBuf, false /* fIsParent */, 1 /* iIdtLevel */); 1174 1252 } 1175 1253 #endif … … 1255 1333 1256 1334 #ifdef DEBUG 1257 audioMixBufPrint(pMixBuf);1335 AudioMixBufDbgPrint(pMixBuf); 1258 1336 #endif 1259 1337 } … … 1317 1395 { 1318 1396 #ifdef DEBUG 1319 audioMixBufPrint(pMixBuf);1397 AudioMixBufDbgPrint(pMixBuf); 1320 1398 #endif 1321 1399 if (pcRead) … … 1400 1478 1401 1479 #ifdef DEBUG 1402 audioMixBufPrint(pMixBuf);1480 AudioMixBufDbgPrint(pMixBuf); 1403 1481 #endif 1404 1482 … … 1597 1675 cWritten = pConv(pMixBuf->pSamples + offSamples, pvBuf, cbBuf, &convOpts); 1598 1676 #ifdef DEBUG 1599 audioMixBufPrint(pMixBuf);1677 AudioMixBufDbgPrint(pMixBuf); 1600 1678 #endif 1601 1679 rc = cWritten ? VINF_SUCCESS : VERR_GENERAL_FAILURE; /** @todo Fudge! */ … … 1754 1832 1755 1833 #ifdef DEBUG 1756 audioMixBufPrint(pMixBuf);1834 AudioMixBufDbgPrint(pMixBuf); 1757 1835 #endif 1758 1836 -
trunk/src/VBox/Devices/Audio/AudioMixBuffer.h
r57451 r61089 6 6 7 7 /* 8 * Copyright (C) 2014-201 5Oracle Corporation8 * Copyright (C) 2014-2016 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 79 79 int AudioMixBufWriteCircEx(PPDMAUDIOMIXBUF pMixBuf, PDMAUDIOMIXBUFFMT enmFmt, const void *pvBuf, uint32_t cbBuf, uint32_t *pcWritten); 80 80 81 #ifdef DEBUG 82 void AudioMixBufDbgPrint(PPDMAUDIOMIXBUF pMixBuf); 83 void AudioMixBufDbgPrintChain(PPDMAUDIOMIXBUF pMixBuf); 84 #endif 85 81 86 #endif /* AUDIO_MIXBUF_H */ 82 87
Note:
See TracChangeset
for help on using the changeset viewer.