Changeset 62117 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Jul 7, 2016 4:16:01 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 108603
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r61887 r62117 829 829 } 830 830 831 /* Update last updated timestamp. */ 832 pSink->tsLastUpdatedMS = RTTimeMilliTS(); 833 831 834 /* Reset status. */ 832 835 pSink->fStatus = AUDMIXSINK_STS_NONE; … … 921 924 uint8_t cStreamsDisabled = 0; 922 925 923 /* Update last updated timestamp. */ 924 pSink->tsLastUpdatedNS = RTTimeNanoTS(); 926 /* Get the time delta and calculate the bytes that need to be processed. */ 927 uint64_t tsDeltaMS = RTTimeMilliTS() - pSink->tsLastUpdatedMS; 928 uint32_t cbDelta = (pSink->PCMProps.cbBitrate / 1000 /* s to ms */) * tsDeltaMS; 929 930 Log3Func(("[%s] Bitrate is %RU32 bytes/s -> %RU64ms / %RU32 bytes elapsed\n", 931 pSink->pszName, pSink->PCMProps.cbBitrate, tsDeltaMS, cbDelta)); 932 933 if (pSink->enmDir == AUDMIXSINKDIR_INPUT) 934 { 935 pSink->In.cbReadable = cbDelta; 936 } 937 else if (pSink->enmDir == AUDMIXSINKDIR_OUTPUT) 938 { 939 pSink->Out.cbWritable = cbDelta; 940 } 941 942 uint8_t uCurLUN = 0; 925 943 926 944 PAUDMIXSTREAM pMixStream, pMixStreamNext; … … 993 1011 # error "Implement me!" 994 1012 #else 995 pSink->In.cbReadable = pConn->pfnStreamGetReadable(pConn, pMixStream->pStream); 1013 if (uCurLUN == 0) 1014 { 1015 pSink->In.cbReadable = pConn->pfnStreamGetReadable(pConn, pMixStream->pStream); 1016 Log3Func(("\t%s: cbReadable=%RU32\n", pMixStream->pStream->szName, pSink->In.cbReadable)); 1017 uCurLUN++; 1018 } 996 1019 #endif 997 1020 } … … 1001 1024 # error "Implement me!" 1002 1025 #else 1003 pSink->Out.cbWritable = pConn->pfnStreamGetWritable(pConn, pMixStream->pStream); 1026 if (uCurLUN == 0) 1027 { 1028 pSink->Out.cbWritable = pConn->pfnStreamGetWritable(pConn, pMixStream->pStream); 1029 Log3Func(("\t%s: cbWritable=%RU32\n", pMixStream->pStream->szName, pSink->Out.cbWritable)); 1030 uCurLUN++; 1031 } 1004 1032 #endif 1005 1033 } … … 1016 1044 } 1017 1045 1018 if (RT_FAILURE(rc)) 1019 LogFlowFunc(("Failed with rc=%Rrc\n", rc)); 1046 /* Update last updated timestamp. */ 1047 pSink->tsLastUpdatedMS = RTTimeMilliTS(); 1048 1049 Log3Func(("[%s] cbReadable=%RU32, cbWritable=%RU32, rc=%Rrc\n", 1050 pSink->pszName, pSink->In.cbReadable, pSink->Out.cbWritable, rc)); 1020 1051 1021 1052 return rc; … … 1025 1056 { 1026 1057 AssertPtrReturn(pSink, VERR_INVALID_POINTER); 1027 1028 uint64_t tsElapsed = RTTimeNanoTS() - pSink->tsLastUpdatedNS;1029 1058 1030 1059 /* -
trunk/src/VBox/Devices/Audio/AudioMixer.h
r61887 r62117 37 37 /** The master volume of this mixer. */ 38 38 PDMAUDIOVOLUME VolMaster; 39 /* List of audio mixer sinks. */39 /** List of audio mixer sinks. */ 40 40 RTLISTANCHOR lstSinks; 41 41 /** Number of used audio sinks. */ … … 90 90 typedef enum AUDMIXSINKDIR 91 91 { 92 /** Unknown direction. */ 92 93 AUDMIXSINKDIR_UNKNOWN = 0, 94 /** Input (capturing from a device). */ 93 95 AUDMIXSINKDIR_INPUT, 96 /** Output (playing to a device). */ 94 97 AUDMIXSINKDIR_OUTPUT, 95 98 /** The usual 32-bit hack. */ … … 183 186 /** The volume of this sink, combined with the last set master volume. */ 184 187 PDMAUDIOVOLUME VolumeCombined; 185 /** Timestamp (in ns) since last update. */186 uint64_t tsLastUpdated NS;188 /** Timestamp (in ms) since last update. */ 189 uint64_t tsLastUpdatedMS; 187 190 } AUDMIXSINK, *PAUDMIXSINK; 188 191 -
trunk/src/VBox/Devices/Audio/DevIchHda.cpp
r61888 r62117 3067 3067 /* Also make sure to handle the DMA position enable bit. */ 3068 3068 pThis->fDMAPosition = RT_BOOL(pThis->u64DPBase & RT_BIT_64(0)); 3069 LogRel (("HDA: %s DMA position buffer\n", pThis->fDMAPosition ? "Enabled" : "Disabled"));3069 LogRel2(("HDA: %s DMA position buffer\n", pThis->fDMAPosition ? "Enabled" : "Disabled")); 3070 3070 break; 3071 3071 } … … 3778 3778 PHDAMIXERSTREAM pStream = NULL; 3779 3779 3780 if (pCfg->enmDir == PDMAUDIODIR_IN) 3780 PPDMAUDIOSTREAMCFG pStreamCfg = (PPDMAUDIOSTREAMCFG)RTMemDup(pCfg, sizeof(PDMAUDIOSTREAMCFG)); 3781 if (!pStreamCfg) 3781 3782 { 3782 LogFunc(("enmRecSource=%ld\n", pCfg->DestSource.Source)); 3783 3784 switch (pCfg->DestSource.Source) 3783 rc = VERR_NO_MEMORY; 3784 break; 3785 } 3786 3787 /* Include the driver's LUN in the stream name for easier identification. */ 3788 RTStrPrintf(pStreamCfg->szName, RT_ELEMENTS(pStreamCfg->szName), "[LUN#%RU8] %s", pDrv->uLUN, pCfg->szName); 3789 3790 if (pStreamCfg->enmDir == PDMAUDIODIR_IN) 3791 { 3792 LogFunc(("enmRecSource=%ld\n", pStreamCfg->DestSource.Source)); 3793 3794 switch (pStreamCfg->DestSource.Source) 3785 3795 { 3786 3796 case PDMAUDIORECSOURCE_LINE: … … 3797 3807 } 3798 3808 } 3799 else if (p Cfg->enmDir == PDMAUDIODIR_OUT)3809 else if (pStreamCfg->enmDir == PDMAUDIODIR_OUT) 3800 3810 { 3801 LogFunc(("enmPlaybackDest=%ld\n", p Cfg->DestSource.Dest));3802 3803 switch (p Cfg->DestSource.Dest)3811 LogFunc(("enmPlaybackDest=%ld\n", pStreamCfg->DestSource.Dest)); 3812 3813 switch (pStreamCfg->DestSource.Dest) 3804 3814 { 3805 3815 case PDMAUDIOPLAYBACKDEST_FRONT: … … 3832 3842 3833 3843 PAUDMIXSTREAM pMixStrm; 3834 rc2 = AudioMixerSinkCreateStream(pSink->pMixSink, pDrv->pConnector, p Cfg, 0 /* fFlags */, &pMixStrm);3844 rc2 = AudioMixerSinkCreateStream(pSink->pMixSink, pDrv->pConnector, pStreamCfg, 0 /* fFlags */, &pMixStrm); 3835 3845 if (RT_SUCCESS(rc2)) 3836 3846 { 3837 3847 rc2 = AudioMixerSinkAddStream(pSink->pMixSink, pMixStrm); 3838 LogFlowFunc(("LUN#%RU8: Added \"%s\" to sink, rc=%Rrc\n", pDrv->uLUN, p Cfg->szName , rc2));3848 LogFlowFunc(("LUN#%RU8: Added \"%s\" to sink, rc=%Rrc\n", pDrv->uLUN, pStreamCfg->szName , rc2)); 3839 3849 } 3840 3850 … … 3845 3855 if (RT_SUCCESS(rc)) 3846 3856 rc = rc2; 3857 3858 if (pStreamCfg) 3859 { 3860 RTMemFree(pStreamCfg); 3861 pStreamCfg = NULL; 3862 } 3847 3863 } 3848 3864 -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r62068 r62117 657 657 if (rc == VINF_BUFFER_OVERFLOW) 658 658 { 659 LogRel2(("Audio: Lost audio samples from guest stream '%s' (only %zu / %zu bytes written), expect stuttering audio output\n", 660 pGstStream->szName, AUDIOMIXBUF_S2B(&pGstStream->MixBuf, cWritten), cbBuf)); 659 LogRel2(("Audio: Lost audio samples from guest stream '%s', expect stuttering audio output\n", pGstStream->szName)); 661 660 rc = VINF_SUCCESS; 662 661 } … … 825 824 } 826 825 827 static DECLCALLBACK(int) drvAudioStreamPlay(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOSTREAM pStream,828 uint32_t *pcSamplesPlayed)826 static DECLCALLBACK(int) drvAudioStreamPlay(PPDMIAUDIOCONNECTOR pInterface, 827 PPDMAUDIOSTREAM pStream, uint32_t *pcSamplesPlayed) 829 828 { 830 829 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); … … 851 850 if (pThis->pHostDrvAudio->pfnGetStatus(pThis->pHostDrvAudio, PDMAUDIODIR_OUT) != PDMAUDIOBACKENDSTS_RUNNING) 852 851 { 852 /* Pull the new config from the backend and check again. */ 853 853 rc = pThis->pHostDrvAudio->pfnGetConfig(pThis->pHostDrvAudio, &pThis->BackendCfg); 854 854 AssertRC(rc); … … 927 927 } 928 928 929 static DECLCALLBACK(int) drvAudioStreamCapture(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOSTREAM pStream,930 uint32_t *pcSamplesCaptured)929 static DECLCALLBACK(int) drvAudioStreamCapture(PPDMIAUDIOCONNECTOR pInterface, 930 PPDMAUDIOSTREAM pStream, uint32_t *pcSamplesCaptured) 931 931 { 932 932 PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r61177 r62117 459 459 pProps->cShift = (pCfg->cChannels == 2) + cShift; 460 460 pProps->uAlign = (1 << pProps->cShift) - 1; 461 pProps->cb PerSec = pProps->uHz << pProps->cShift;461 pProps->cbBitrate = (pProps->cBits * pProps->uHz * pProps->cChannels) / 8; 462 462 pProps->fSwapEndian = pCfg->enmEndianness != PDMAUDIOHOSTENDIANNESS; 463 463 } -
trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
r62071 r62117 1855 1855 /* Move offset. */ 1856 1856 cbRead += cbToRead; 1857 Assert(pBufData->mBuffers[0].mDataByteSize >= cbRead); 1857 1858 /* Check if we're lagging behind. */ 1859 if (cbRead > pBufData->mBuffers[0].mDataByteSize) 1860 { 1861 LogRel2(("CoreAudio: Host output lagging behind, expect stuttering guest audio output\n")); 1862 cbRead = pBufData->mBuffers[0].mDataByteSize; 1863 break; 1864 } 1858 1865 1859 1866 Assert(cbToRead <= cbLeft); … … 1861 1868 } 1862 1869 1863 /* Write the bytes to the core audio buffer which where really written. */ 1870 /* Write the bytes to the core audio buffer which were really written. */ 1871 Assert(pBufData->mBuffers[0].mDataByteSize >= cbRead); 1864 1872 pBufData->mBuffers[0].mDataByteSize = cbRead; 1865 1873
Note:
See TracChangeset
for help on using the changeset viewer.