- Timestamp:
- May 31, 2021 8:56:37 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/include/VBox/vmm/pdmaudioinline.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioinline.h
r89381 r89416 476 476 { 477 477 AssertPtrReturn(pProps, 0); 478 uint32_t const cbFrame = PDMA UDIOPCMPROPS_F2B(pProps, 1 /* Frame */);478 uint32_t const cbFrame = PDMAudioPropsFrameSize(pProps); 479 479 AssertReturn(cbFrame, 0); 480 480 return PDMAUDIOPCMPROPS_F2B(pProps, PDMAUDIOPCMPROPS_B2F(pProps, cb + cbFrame - 1)); … … 491 491 { 492 492 AssertPtrReturn(pProps, false); 493 uint32_t const cbFrame = PDMA UDIOPCMPROPS_F2B(pProps, 1 /* Frame */);493 uint32_t const cbFrame = PDMAudioPropsFrameSize(pProps); 494 494 AssertReturn(cbFrame, false); 495 495 return cb % cbFrame == 0; … … 526 526 if (uHz) 527 527 { 528 const unsigned cbFrame = PDMA UDIOPCMPROPS_F2B(pProps, 1 /* Frame */);528 const unsigned cbFrame = PDMAudioPropsFrameSize(pProps); 529 529 if (cbFrame) 530 530 { … … 556 556 if (uHz) 557 557 { 558 const unsigned cbFrame = PDMA UDIOPCMPROPS_F2B(pProps, 1 /* Frame */);558 const unsigned cbFrame = PDMAudioPropsFrameSize(pProps); 559 559 if (cbFrame) 560 560 { … … 586 586 if (uHz) 587 587 { 588 const unsigned cbFrame = PDMA UDIOPCMPROPS_F2B(pProps, 1 /* Frame */);588 const unsigned cbFrame = PDMAudioPropsFrameSize(pProps); 589 589 if (cbFrame) 590 590 { … … 594 594 /* Convert to nanoseconds. */ 595 595 return (cb * (uint64_t)RT_NS_1SEC + uHz - 1) / uHz; 596 } 597 } 598 return 0; 599 } 600 601 /** 602 * Converts bytes to nanoseconds, 64-bit version. 603 * 604 * @return Number nanoseconds @a cb takes to play or record. 605 * @param pProps PCM properties to use. 606 * @param cb The number of bytes to convert (64-bit). 607 * 608 * @note Rounds up the result. 609 */ 610 DECLINLINE(uint64_t) PDMAudioPropsBytesToNano64(PCPDMAUDIOPCMPROPS pProps, uint64_t cb) 611 { 612 AssertPtrReturn(pProps, 0); 613 614 /* Check parameters to prevent division by chainsaw: */ 615 uint32_t const uHz = pProps->uHz; 616 if (uHz) 617 { 618 const unsigned cbFrame = PDMAudioPropsFrameSize(pProps); 619 if (cbFrame) 620 { 621 /* Round cb up to closest frame size: */ 622 cb = (cb + cbFrame - 1) / cbFrame; 623 624 /* Convert to nanoseconds. */ 625 return (cb * RT_NS_1SEC + uHz - 1) / uHz; 596 626 } 597 627 }
Note:
See TracChangeset
for help on using the changeset viewer.

