Changeset 88061 in vbox
- Timestamp:
- Mar 9, 2021 6:14:19 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudiohostenuminline.h
r88055 r88061 92 92 Assert(pDev->uMagic == PDMAUDIOHOSTDEV_MAGIC); 93 93 Assert(pDev->cRefCount == 0); 94 pDev->uMagic = PDMAUDIOHOSTDEV_MAGIC_DEAD;94 pDev->uMagic = ~PDMAUDIOHOSTDEV_MAGIC; 95 95 pDev->cbSelf = 0; 96 96 -
trunk/include/VBox/vmm/pdmaudioifs.h
r88059 r88061 236 236 237 237 #include <VBox/types.h> 238 # include <VBox/vmm/pdmcommon.h> 238 239 #ifdef VBOX_WITH_STATISTICS 239 240 # include <VBox/vmm/stam.h> … … 404 405 typedef PDMAUDIOHOSTDEV const *PCPDMAUDIOHOSTDEV; 405 406 406 /** Magic value for PDMAUDIOHOSTDEV. (Armando Anthony "Chick" Corea) */ 407 #define PDMAUDIOHOSTDEV_MAGIC UINT32_C(0x19410612) 408 /** Magic value for PDMAUDIOHOSTDEV after free. */ 409 #define PDMAUDIOHOSTDEV_MAGIC_DEAD UINT32_C(0x20210209) 407 /** Magic value for PDMAUDIOHOSTDEV. */ 408 #define PDMAUDIOHOSTDEV_MAGIC PDM_VERSION_MAKE(0xa0d0, 1, 0) 410 409 411 410 … … 429 428 typedef PDMAUDIOHOSTENUM const *PCPDMAUDIOHOSTENUM; 430 429 431 /** Magic for the host audio device enumeration. (Herbert Jeffrey "Herbie" Hancock)*/432 #define PDMAUDIOHOSTENUM_MAGIC UINT32_C(0x19400412)430 /** Magic for the host audio device enumeration. */ 431 #define PDMAUDIOHOSTENUM_MAGIC PDM_VERSION_MAKE(0xa0d1, 1, 0) 433 432 434 433 … … 999 998 typedef struct PDMAUDIOMIXBUF 1000 999 { 1001 RTLISTNODE Node; 1000 /** Magic value (PDMAUDIOMIXBUF_MAGIC). */ 1001 uint32_t uMagic; 1002 /** For quickly converting frames <-> bytes and vice versa. */ 1003 uint8_t cShift; 1004 uint8_t abPadding[3]; 1005 /* ???Undocumented??? */ 1006 RTLISTNODE Node; 1002 1007 /** Name of the buffer. */ 1003 char *pszName;1008 char *pszName; 1004 1009 /** Frame buffer. */ 1005 PPDMAUDIOFRAME pFrames;1010 PPDMAUDIOFRAME pFrames; 1006 1011 /** Size of the frame buffer (in audio frames). */ 1007 uint32_t cFrames;1012 uint32_t cFrames; 1008 1013 /** The current read position (in frames). */ 1009 uint32_t offRead;1014 uint32_t offRead; 1010 1015 /** The current write position (in frames). */ 1011 uint32_t offWrite; 1012 /** 1013 * Total frames already mixed down to the parent buffer (if any). 1016 uint32_t offWrite; 1017 /** Total frames already mixed down to the parent buffer (if any). 1014 1018 * 1015 1019 * Always starting at the parent's offRead position. 1016 1020 * @note Count always is specified in parent frames, as the sample count can 1017 * differ between parent and child. 1018 */ 1019 uint32_t cMixed; 1021 * differ between parent and child. */ 1022 uint32_t cMixed; 1020 1023 /** How much audio frames are currently being used 1021 1024 * in this buffer. 1022 1025 * Note: This also is known as the distance in ring buffer terms. */ 1023 uint32_t cUsed; 1026 uint32_t cUsed; 1027 /** Number of children mix buffers kept in lstChildren. */ 1028 uint32_t cChildren; 1029 /** List of children mix buffers to keep in sync with (if being a parent buffer). */ 1030 RTLISTANCHOR lstChildren; 1024 1031 /** Pointer to parent buffer (if any). */ 1025 PPDMAUDIOMIXBUF pParent; 1026 /** List of children mix buffers to keep in sync with (if being a parent buffer). */ 1027 RTLISTANCHOR lstChildren; 1028 /** Number of children mix buffers kept in lstChildren. */ 1029 uint32_t cChildren; 1032 PPDMAUDIOMIXBUF pParent; 1030 1033 /** Intermediate structure for buffer conversion tasks. */ 1031 PPDMAUDIOSTREAMRATE pRate;1034 PPDMAUDIOSTREAMRATE pRate; 1032 1035 /** Internal representation of current volume used for mixing. */ 1033 PDMAUDMIXBUFVOL Volume;1036 PDMAUDMIXBUFVOL Volume; 1034 1037 /** This buffer's audio format. 1035 1038 * @todo r=bird: This seems to be a value created by AUDMIXBUF_AUDIO_FMT_MAKE(), 1036 1039 * which is not define here. Does this structure really belong here at 1037 1040 * all? */ 1038 PDMAUDIOMIXBUFFMT uAudioFmt;1041 PDMAUDIOMIXBUFFMT uAudioFmt; 1039 1042 /** Standard conversion-to function for set uAudioFmt. */ 1040 PFNPDMAUDIOMIXBUFCONVTO pfnConvTo;1043 PFNPDMAUDIOMIXBUFCONVTO pfnConvTo; 1041 1044 /** Standard conversion-from function for set uAudioFmt. */ 1042 PFNPDMAUDIOMIXBUFCONVFROM pfnConvFrom; 1043 /** 1044 * Ratio of the associated parent stream's frequency by this stream's 1045 PFNPDMAUDIOMIXBUFCONVFROM pfnConvFrom; 1046 /** Ratio of the associated parent stream's frequency by this stream's 1045 1047 * frequency (1<<32), represented as a signed 64 bit integer. 1046 1048 * … … 1049 1051 * (44/11 * (1 << 32)). 1050 1052 * 1051 * Currently this does not get changed once assigned. 1052 */ 1053 int64_t iFreqRatio; 1054 /** For quickly converting frames <-> bytes and vice versa. */ 1055 uint8_t cShift; 1053 * Currently this does not get changed once assigned. */ 1054 int64_t iFreqRatio; 1056 1055 } PDMAUDIOMIXBUF; 1056 1057 /** Magic value for PDMAUDIOMIXBUF. */ 1058 #define PDMAUDIOMIXBUF_MAGIC PDM_VERSION_MAKE(0xa0d2, 1, 0) 1057 1059 1058 1060 /** @name PDMAUDIOFILE_FLAGS_XXX … … 1182 1184 PPDMAUDIOFILE pFileCaptureNonInterleaved; 1183 1185 } Dbg; 1184 #ifdef VBOX_WITH_STATISTICS1185 1186 struct 1186 1187 { … … 1192 1193 STAMCOUNTER TotalTimesRead; 1193 1194 } Stats; 1194 #endif1195 1195 } PDMAUDIOSTREAMIN; 1196 1196 /** Pointer to the specifics for an audio input stream. */ … … 1211 1211 PPDMAUDIOFILE pFilePlayNonInterleaved; 1212 1212 } Dbg; 1213 #ifdef VBOX_WITH_STATISTICS1214 1213 struct 1215 1214 { … … 1221 1220 STAMCOUNTER TotalTimesWritten; 1222 1221 } Stats; 1223 #endif1224 1222 } PDMAUDIOSTREAMOUT; 1225 1223 /** Pointer to the specifics for an audio output stream. */ … … 1312 1310 } PDMAUDIOSTREAM; 1313 1311 1314 /** Magic value for PDMAUDIOSTREAM. (Ahmad Jamal)*/1315 #define PDMAUDIOSTREAM_MAGIC UINT32_C(0x19300702)1312 /** Magic value for PDMAUDIOSTREAM. */ 1313 #define PDMAUDIOSTREAM_MAGIC PDM_VERSION_MAKE(0xa0d3, 1, 0) 1316 1314 1317 1315 … … 1396 1394 /** 1397 1395 * Host audio callback function. 1396 * 1398 1397 * This function will be called from a backend to communicate with the host audio interface. 1399 1398 * -
trunk/src/VBox/Devices/Audio/AudioMixBuffer.cpp
r87936 r88061 332 332 if (!pMixBuf) 333 333 return; 334 335 /* Ignore calls for an uninitialized (zeroed) or already destroyed instance. Happens a lot. */ 336 if ( pMixBuf->uMagic == 0 337 || pMixBuf->uMagic == ~PDMAUDIOMIXBUF_MAGIC) 338 { 339 Assert(!pMixBuf->pszName); 340 Assert(!pMixBuf->pRate); 341 Assert(!pMixBuf->pFrames); 342 Assert(!pMixBuf->cFrames); 343 return; 344 } 345 346 Assert(pMixBuf->uMagic == PDMAUDIOMIXBUF_MAGIC); 347 pMixBuf->uMagic = ~PDMAUDIOMIXBUF_MAGIC; 334 348 335 349 AudioMixBufUnlink(pMixBuf); … … 816 830 AssertPtrReturn(pProps, VERR_INVALID_POINTER); 817 831 832 pMixBuf->uMagic = PDMAUDIOMIXBUF_MAGIC; 818 833 pMixBuf->pParent = NULL; 819 834 -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88060 r88061 553 553 * @param pCfgGuest Stream configuration to use for the guest side. 554 554 */ 555 static int drvAudioStreamInitInternal(PDRVAUDIO pThis, 556 PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfgHost, PPDMAUDIOSTREAMCFG pCfgGuest)555 static int drvAudioStreamInitInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream, 556 PPDMAUDIOSTREAMCFG pCfgHost, PPDMAUDIOSTREAMCFG pCfgGuest) 557 557 { 558 558 AssertPtrReturn(pThis, VERR_INVALID_POINTER); … … 767 767 LogFunc(("[%s]\n", pStream->szName)); 768 768 Assert(pStream->uMagic == PDMAUDIOSTREAM_MAGIC); 769 pStream->uMagic = ~PDMAUDIOSTREAM_MAGIC; 770 771 if (pStream->pvBackend) 772 { 773 Assert(pStream->cbBackend); 774 RTMemFree(pStream->pvBackend); 775 pStream->pvBackend = NULL; 776 } 769 770 pStream->uMagic = ~PDMAUDIOSTREAM_MAGIC; 771 pStream->pvBackend = NULL; 777 772 778 773 RTMemFree(pStream); … … 2605 2600 * Allocate and initialize common state. 2606 2601 */ 2607 pStream = (PPDMAUDIOSTREAM)RTMemAllocZ(sizeof(PDMAUDIOSTREAM) );2602 pStream = (PPDMAUDIOSTREAM)RTMemAllocZ(sizeof(PDMAUDIOSTREAM) + RT_ALIGN_Z(cbHstStrm, 64)); 2608 2603 AssertPtrBreakStmt(pStream, rc = VERR_NO_MEMORY); 2609 2604 … … 2619 2614 pCfgHost->szName[0] != '\0' ? pCfgHost->szName : "<Untitled>"); 2620 2615 2621 pStream->enmDir = pCfgHost->enmDir; 2622 2623 /* 2624 * Allocate and init backend-specific data. 2625 */ 2626 if (cbHstStrm) /* High unlikely that backends do not have an own space for data, but better check. */ 2627 { 2628 pStream->pvBackend = RTMemAllocZ(cbHstStrm); 2629 AssertBreakStmt(pStream->pvBackend, rc = VERR_NO_MEMORY); 2630 2631 pStream->cbBackend = (uint32_t)cbHstStrm; 2632 } 2616 pStream->enmDir = pCfgHost->enmDir; 2617 pStream->cbBackend = (uint32_t)cbHstStrm; 2618 if (cbHstStrm) 2619 pStream->pvBackend = pStream + 1; 2633 2620 2634 2621 /* -
trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
r88055 r88061 101 101 RTCRITSECT CritSect; 102 102 /** Current (last reported) device enumeration. */ 103 PDMAUDIOHOSTENUM Devices;103 PDMAUDIOHOSTENUM Devices; 104 104 /** Pointer to the currently used input device in the device enumeration. 105 105 * Can be NULL if none assigned. */
Note:
See TracChangeset
for help on using the changeset viewer.