- Timestamp:
- Jun 1, 2021 8:42:04 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144797
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/Devices/Audio/DrvHostAudioOss.cpp ¶
r89258 r89443 376 376 /* 377 377 * Configure it. 378 * 379 * Note! We limit the output channels to mono or stereo for now just 380 * to keep things simple and avoid wasting time here. If the 381 * channel count isn't a power of two, our code below trips up 382 * on the fragment size. We'd also need to try report/get 383 * channel mappings and whatnot. 378 384 */ 379 385 OSSAUDIOSTREAMCFG ReqOssCfg; … … 381 387 382 388 memcpy(&ReqOssCfg.Props, &pCfgReq->Props, sizeof(PDMAUDIOPCMPROPS)); 389 if (PDMAudioPropsChannels(&ReqOssCfg.Props) > 2) 390 { 391 LogRel2(("OSS: Limiting output to two channels, requested %u.\n", PDMAudioPropsChannels(&ReqOssCfg.Props) )); 392 PDMAudioPropsSetChannels(&ReqOssCfg.Props, 2); 393 } 394 383 395 ReqOssCfg.cbFragmentLog2 = 12; 384 396 ReqOssCfg.cbFragment = RT_BIT_32(ReqOssCfg.cbFragmentLog2); 385 uint32_t const cbBuffer = PDMAudioPropsFramesToBytes(& pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);397 uint32_t const cbBuffer = PDMAudioPropsFramesToBytes(&ReqOssCfg.Props, pCfgReq->Backend.cFramesBufferSize); 386 398 ReqOssCfg.cFragments = cbBuffer >> ReqOssCfg.cbFragmentLog2; 387 399 AssertLogRelStmt(cbBuffer < ((uint32_t)0x7ffe << ReqOssCfg.cbFragmentLog2), ReqOssCfg.cFragments = 0x7ffe); … … 744 756 745 757 /* 758 * Return immediately if this is a draining service call. 759 * 760 * Otherwise the ioctl below will race the drain thread and sometimes fail, 761 * triggering annoying assertion and release logging. 762 */ 763 if (cbBuf || !pStreamOSS->fDraining) 764 { /* likely */ } 765 else 766 { 767 *pcbWritten = 0; 768 return VINF_SUCCESS; 769 } 770 771 /* 746 772 * Figure out now much to write. 747 773 */ 748 774 audio_buf_info BufInfo; 749 775 int rc2 = ioctl(pStreamOSS->hFile, SNDCTL_DSP_GETOSPACE, &BufInfo); 750 AssertLogRelMsgReturn(rc2 >= 0, ("OSS: Failed to retrieve current playback buffer: %s (%d)\n", strerror(errno), errno), 776 AssertLogRelMsgReturn(rc2 >= 0, ("OSS: Failed to retrieve current playback buffer: %s (%d, hFile=%d, rc2=%d)\n", 777 strerror(errno), errno, pStreamOSS->hFile, rc2), 751 778 RTErrConvertFromErrno(errno)); 752 779
Note:
See TracChangeset
for help on using the changeset viewer.