Changeset 88004 in vbox
- Timestamp:
- Mar 8, 2021 11:55:51 AM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88002 r88004 940 940 pStream->szName, DrvAudioHlpAudDirToStr(pStream->enmDir))); 941 941 942 AssertMsg(DrvAudioHlp BytesIsAligned(cbBuf, &pStream->Guest.Cfg.Props),942 AssertMsg(DrvAudioHlpIsBytesAligned(cbBuf, &pStream->Guest.Cfg.Props), 943 943 ("Stream '%s' got a non-frame-aligned write (%RU32 bytes)\n", pStream->szName, cbBuf)); 944 944 -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r88003 r88004 199 199 uint32_t DrvAudioHlpGetBitrate(PCPDMAUDIOPCMPROPS pProps); 200 200 uint32_t DrvAudioHlpBytesAlign(uint32_t cbSize, PCPDMAUDIOPCMPROPS pProps); 201 bool DrvAudioHlp BytesIsAligned(uint32_t cbSize, PCPDMAUDIOPCMPROPS pProps);201 bool DrvAudioHlpIsBytesAligned(PCPDMAUDIOPCMPROPS pProps, uint32_t cb); 202 202 uint32_t DrvAudioHlpBytesToFrames(uint32_t cbBytes, PCPDMAUDIOPCMPROPS pProps); 203 203 uint64_t DrvAudioHlpBytesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cb); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r88003 r88004 1177 1177 1178 1178 /** 1179 * Returns if the the given size is properly aligned to the given PCM properties. 1180 * 1181 * @return @c true if properly aligned, @c false if not. 1182 * @param cbSize Size (in bytes) to check alignment for. 1183 * @param pProps PCM properties to use for checking the alignment. 1184 */ 1185 bool DrvAudioHlpBytesIsAligned(uint32_t cbSize, PCPDMAUDIOPCMPROPS pProps) 1186 { 1187 AssertPtrReturn(pProps, 0); 1188 1189 if (!cbSize) 1190 return true; 1191 1192 return (cbSize % PDMAUDIOPCMPROPS_F2B(pProps, 1 /* Frame */) == 0); 1179 * Checks if the given size is aligned on a frame boundrary. 1180 * 1181 * @returns @c true if properly aligned, @c false if not. 1182 * @param pProps PCM properties to use. 1183 * @param cb The size (in bytes) to check. 1184 */ 1185 bool DrvAudioHlpIsBytesAligned(PCPDMAUDIOPCMPROPS pProps, uint32_t cb) 1186 { 1187 AssertPtrReturn(pProps, false); 1188 uint32_t const cbFrame = PDMAUDIOPCMPROPS_F2B(pProps, 1 /* Frame */); 1189 AssertReturn(cbFrame, false); 1190 return cb % cbFrame == 0; 1193 1191 } 1194 1192 -
trunk/src/VBox/Devices/Audio/HDAStream.cpp
r88002 r88004 532 532 if (cbTransferHeuristics >= 8) 533 533 { 534 ASSERT_GUEST_LOGREL_MSG(DrvAudioHlp BytesIsAligned(cbTransferHeuristics, &pStreamR3->State.Mapping.PCMProps),534 ASSERT_GUEST_LOGREL_MSG(DrvAudioHlpIsBytesAligned(cbTransferHeuristics, &pStreamR3->State.Mapping.PCMProps), 535 535 ("We arrived at a misaligned transfer size for stream #%RU8: %#x (%u)\n", 536 536 uSD, cbTransferHeuristics, cbTransferHeuristics)); … … 549 549 pStreamShared->State.cbTransferSize = cbTransferHeuristics; 550 550 pStreamShared->State.cbTransferChunk = cbTransferHeuristics; 551 ASSERT_GUEST_LOGREL_MSG(DrvAudioHlp BytesIsAligned(cbTransferHeuristics, &pStreamR3->State.Mapping.PCMProps),551 ASSERT_GUEST_LOGREL_MSG(DrvAudioHlpIsBytesAligned(cbTransferHeuristics, &pStreamR3->State.Mapping.PCMProps), 552 552 ("We arrived at a misaligned transfer size for stream #%RU8: %#x (%u)\n", 553 553 uSD, cbTransferHeuristics, cbTransferHeuristics)); -
trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp
r88003 r88004 71 71 RTTESTI_CHECK_MSG(PDMAUDIOPCMPROPS_F2B(&s_Cfg441StereoU32, 1) == 8, 72 72 ("got %x, expected 4\n", PDMAUDIOPCMPROPS_F2B(&s_Cfg441StereoU32, 1))); 73 74 for (uint32_t i = 0; i < 256; i += 8) 75 { 76 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i) == true); 77 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i+1) == false); 78 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i+2) == false); 79 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i+3) == false); 80 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i+4) == false); 81 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i+5) == false); 82 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i+6) == false); 83 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i+7) == false); 84 } 85 for (uint32_t i = 0; i < 4096; i += 4) 86 { 87 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoS16, i) == true); 88 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoS16, i+1) == false); 89 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoS16, i+2) == false); 90 RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoS16, i+3) == false); 91 } 73 92 74 93 uint32_t u32;
Note:
See TracChangeset
for help on using the changeset viewer.