Changeset 88025 in vbox
- Timestamp:
- Mar 8, 2021 6:31:56 PM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r88023 r88025 2180 2180 const uint32_t fStreamStatus = pMixStream->pConn->pfnStreamGetStatus(pMixStream->pConn, pMixStream->pStream); 2181 2181 2182 if ( DrvAudioHlpStreamStatusIsReady(fStreamStatus))2182 if (PDMAudioStrmStatusIsReady(fStreamStatus)) 2183 2183 pMixStream->fStatus |= AUDMIXSTREAM_STATUS_ENABLED; 2184 2184 … … 2187 2187 { 2188 2188 case AUDMIXSINKDIR_INPUT: 2189 if ( DrvAudioHlpStreamStatusCanRead(fStreamStatus))2189 if (PDMAudioStrmStatusCanRead(fStreamStatus)) 2190 2190 pMixStream->fStatus |= AUDMIXSTREAM_STATUS_CAN_READ; 2191 2191 break; 2192 2192 2193 2193 case AUDMIXSINKDIR_OUTPUT: 2194 if ( DrvAudioHlpStreamStatusCanWrite(fStreamStatus))2194 if (PDMAudioStrmStatusCanWrite(fStreamStatus)) 2195 2195 pMixStream->fStatus |= AUDMIXSTREAM_STATUS_CAN_WRITE; 2196 2196 break; -
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r88023 r88025 1558 1558 { 1559 1559 if ( pDrv->Out.pStream 1560 && DrvAudioHlpStreamStatusCanWrite(pDrv->pConnector->pfnStreamGetStatus(pDrv->pConnector, pDrv->Out.pStream)))1560 && PDMAudioStrmStatusCanWrite(pDrv->pConnector->pfnStreamGetStatus(pDrv->pConnector, pDrv->Out.pStream))) 1561 1561 { 1562 1562 uint32_t cbWrittenToStream = 0; -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88023 r88025 303 303 return rc; 304 304 305 LogFlowFunc(("[%s] enmStreamCmd=%s\n", pStream->szName, DrvAudioHlpStreamCmdToStr(enmStreamCmd)));305 LogFlowFunc(("[%s] enmStreamCmd=%s\n", pStream->szName, PDMAudioStrmCmdGetName(enmStreamCmd))); 306 306 307 307 rc = drvAudioStreamControlInternal(pThis, pStream, enmStreamCmd); … … 327 327 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 328 328 329 LogFunc(("[%s] enmStreamCmd=%s\n", pStream->szName, DrvAudioHlpStreamCmdToStr(enmStreamCmd)));329 LogFunc(("[%s] enmStreamCmd=%s\n", pStream->szName, PDMAudioStrmCmdGetName(enmStreamCmd))); 330 330 331 331 #ifdef LOG_ENABLED … … 441 441 #ifdef LOG_ENABLED 442 442 char *pszStreamSts = dbgAudioStreamStatusToStr(pStream->fStatus); 443 LogFlowFunc(("[%s] enmStreamCmd=%s, fStatus=%s\n", pStream->szName, DrvAudioHlpStreamCmdToStr(enmStreamCmd), pszStreamSts));443 LogFlowFunc(("[%s] enmStreamCmd=%s, fStatus=%s\n", pStream->szName, PDMAudioStrmCmdGetName(enmStreamCmd), pszStreamSts)); 444 444 RTStrFree(pszStreamSts); 445 445 #endif /* LOG_ENABLED */ … … 468 468 && pThis->Out.fEnabled); 469 469 470 LogRel2(("Audio: %s stream '%s' in backend (%s is %s)\n", DrvAudioHlpStreamCmdToStr(enmStreamCmd), pStream->szName,470 LogRel2(("Audio: %s stream '%s' in backend (%s is %s)\n", PDMAudioStrmCmdGetName(enmStreamCmd), pStream->szName, 471 471 DrvAudioHlpAudDirToStr(pStream->enmDir), 472 472 fEnabled ? "enabled" : "disabled")); … … 526 526 && rc != VERR_AUDIO_STREAM_NOT_READY) 527 527 { 528 LogRel(("Audio: %s stream '%s' failed with %Rrc\n", DrvAudioHlpStreamCmdToStr(enmStreamCmd), pStream->szName, rc));529 } 530 531 LogFunc(("[%s] %s failed with %Rrc\n", pStream->szName, DrvAudioHlpStreamCmdToStr(enmStreamCmd), rc));528 LogRel(("Audio: %s stream '%s' failed with %Rrc\n", PDMAudioStrmCmdGetName(enmStreamCmd), pStream->szName, rc)); 529 } 530 531 LogFunc(("[%s] %s failed with %Rrc\n", pStream->szName, PDMAudioStrmCmdGetName(enmStreamCmd), rc)); 532 532 } 533 533 … … 963 963 do 964 964 { 965 if (! DrvAudioHlpStreamStatusIsReady(pStream->fStatus))965 if (!PDMAudioStrmStatusIsReady(pStream->fStatus)) 966 966 { 967 967 rc = VERR_AUDIO_STREAM_NOT_READY; … … 979 979 { 980 980 /* If the backend's stream is not writable, all written data goes to /dev/null. */ 981 if (! DrvAudioHlpStreamStatusCanWrite(981 if (!PDMAudioStrmStatusCanWrite( 982 982 pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStream->pvBackend))) 983 983 { … … 1533 1533 1534 1534 if ( !pThis->Out.fEnabled 1535 || ! DrvAudioHlpStreamStatusIsReady(fStrmStatus))1535 || !PDMAudioStrmStatusIsReady(fStrmStatus)) 1536 1536 { 1537 1537 rc = VERR_AUDIO_STREAM_NOT_READY; … … 1912 1912 1913 1913 if ( !pThis->In.fEnabled 1914 || ! DrvAudioHlpStreamStatusCanRead(pStream->fStatus))1914 || !PDMAudioStrmStatusCanRead(pStream->fStatus)) 1915 1915 { 1916 1916 rc = VERR_AUDIO_STREAM_NOT_READY; … … 2290 2290 PDRVAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO); 2291 2291 2292 LogFlowFunc(("enmCmd=%s\n", DrvAudioHlpStreamCmdToStr(enmCmd)));2292 LogFlowFunc(("enmCmd=%s\n", PDMAudioStrmCmdGetName(enmCmd))); 2293 2293 2294 2294 int rc2 = RTCritSectEnter(&pThis->CritSect); … … 2451 2451 if (pThis->In.fEnabled) /* Input for this audio driver enabled? See #9822. */ 2452 2452 { 2453 if (! DrvAudioHlpStreamStatusCanRead(pStream->fStatus))2453 if (!PDMAudioStrmStatusCanRead(pStream->fStatus)) 2454 2454 { 2455 2455 rc = VERR_AUDIO_STREAM_NOT_READY; … … 2942 2942 2943 2943 if ( pThis->pHostDrvAudio 2944 && ( DrvAudioHlpStreamStatusCanRead(pStream->fStatus)2944 && ( PDMAudioStrmStatusCanRead(pStream->fStatus) 2945 2945 || fDisabled) 2946 2946 ) … … 2963 2963 if (pThis->pHostDrvAudio->pfnStreamGetStatus) 2964 2964 fStatus = pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStream->pvBackend); 2965 if ( ! DrvAudioHlpStreamStatusCanRead(fStatus)2965 if ( !PDMAudioStrmStatusCanRead(fStatus) 2966 2966 || fDisabled) 2967 2967 { … … 3016 3016 /* Note: We don't propage the backend stream's status to the outside -- it's the job of this 3017 3017 * audio connector to make sense of it. */ 3018 if ( DrvAudioHlpStreamStatusCanWrite(pStream->fStatus))3018 if (PDMAudioStrmStatusCanWrite(pStream->fStatus)) 3019 3019 { 3020 3020 cbWritable = AudioMixBufFreeBytes(&pStream->Host.MixBuf); -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r88023 r88025 238 238 /** @name Audio stream command helper methods. 239 239 * @{ */ 240 const char * DrvAudioHlpStreamCmdToStr(PDMAUDIOSTREAMCMD enmCmd);240 const char *PDMAudioStrmCmdGetName(PDMAUDIOSTREAMCMD enmCmd); 241 241 /** @} */ 242 242 243 243 /** @name Audio stream status helper methods. 244 244 * @{ */ 245 bool DrvAudioHlpStreamStatusCanRead(PDMAUDIOSTREAMSTS fStatus);246 bool DrvAudioHlpStreamStatusCanWrite(PDMAUDIOSTREAMSTS fStatus);247 bool DrvAudioHlpStreamStatusIsReady(PDMAUDIOSTREAMSTS fStatus);245 bool PDMAudioStrmStatusCanRead(PDMAUDIOSTREAMSTS fStatus); 246 bool PDMAudioStrmStatusCanWrite(PDMAUDIOSTREAMSTS fStatus); 247 bool PDMAudioStrmStatusIsReady(PDMAUDIOSTREAMSTS fStatus); 248 248 /** @} */ 249 249 … … 262 262 /** @} */ 263 263 264 /** @name Audio device enum artion methods.264 /** @name Audio device enumeration methods. 265 265 * @{ */ 266 266 int DrvAudioHlpDeviceEnumInit(PPDMAUDIODEVICEENUM pDevEnm); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r88024 r88025 889 889 890 890 /** 891 * Converts a stream command to a string. 892 * 893 * @returns Stringified stream command, or "Unknown", if not found. 894 * @param enmCmd Stream command to convert. 895 */ 896 const char *DrvAudioHlpStreamCmdToStr(PDMAUDIOSTREAMCMD enmCmd) 891 * Converts a stream command enum value to a string. 892 * 893 * @returns Pointer to read-only stream command name on success, 894 * "Unknown" if invalid command value. 895 * @param enmCmd The stream command to name. 896 */ 897 const char *PDMAudioStrmCmdGetName(PDMAUDIOSTREAMCMD enmCmd) 897 898 { 898 899 switch (enmCmd) … … 908 909 case PDMAUDIOSTREAMCMD_32BIT_HACK: 909 910 break; 910 } 911 AssertMsgFailed(("Invalid stream command %d\n", enmCmd)); 912 return "Unknown"; 913 } 914 915 /** 916 * Returns @c true if the given stream status indicates a can-be-read-from stream, 917 * @c false if not. 918 * 919 * @returns @c true if ready to be read from, @c if not. 911 /* no default! */ 912 } 913 AssertMsgFailedReturn(("Invalid stream command %d\n", enmCmd), "Unknown"); 914 } 915 916 /** 917 * Checks if the stream status is one that can be read from. 918 * 919 * @returns @c true if ready to be read from, @c false if not. 920 920 * @param fStatus Stream status to evaluate, PDMAUDIOSTREAMSTS_FLAGS_XXX. 921 921 */ 922 bool DrvAudioHlpStreamStatusCanRead(PDMAUDIOSTREAMSTS fStatus)922 bool PDMAudioStrmStatusCanRead(PDMAUDIOSTREAMSTS fStatus) 923 923 { 924 924 AssertReturn(fStatus & PDMAUDIOSTREAMSTS_VALID_MASK, false); 925 925 /* 926 926 return fStatus & PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED 927 927 && fStatus & PDMAUDIOSTREAMSTS_FLAGS_ENABLED 928 928 && !(fStatus & PDMAUDIOSTREAMSTS_FLAGS_PAUSED) 929 && !(fStatus & PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT); 930 } 931 932 /** 933 * Returns @c true if the given stream status indicates a can-be-written-to stream, 934 * @c false if not. 935 * 936 * @returns @c true if ready to be written to, @c if not. 929 && !(fStatus & PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT);*/ 930 return (fStatus & ( PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED 931 | PDMAUDIOSTREAMSTS_FLAGS_ENABLED 932 | PDMAUDIOSTREAMSTS_FLAGS_PAUSED 933 | PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT )) 934 == ( PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED 935 | PDMAUDIOSTREAMSTS_FLAGS_ENABLED); 936 } 937 938 /** 939 * Checks if the stream status is one that can be written to. 940 * 941 * @returns @c true if ready to be written to, @c false if not. 937 942 * @param fStatus Stream status to evaluate, PDMAUDIOSTREAMSTS_FLAGS_XXX. 938 943 */ 939 bool DrvAudioHlpStreamStatusCanWrite(PDMAUDIOSTREAMSTS fStatus)944 bool PDMAudioStrmStatusCanWrite(PDMAUDIOSTREAMSTS fStatus) 940 945 { 941 946 AssertReturn(fStatus & PDMAUDIOSTREAMSTS_VALID_MASK, false); 942 947 /* 943 948 return fStatus & PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED 944 949 && fStatus & PDMAUDIOSTREAMSTS_FLAGS_ENABLED 945 950 && !(fStatus & PDMAUDIOSTREAMSTS_FLAGS_PAUSED) 946 951 && !(fStatus & PDMAUDIOSTREAMSTS_FLAGS_PENDING_DISABLE) 947 && !(fStatus & PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT); 948 } 949 950 /** 951 * Returns @c true if the given stream status indicates a ready-to-operate stream, 952 * @c false if not. 953 * 954 * @returns @c true if ready to operate, @c if not. 955 * @param fStatus Stream status to evaluate. 956 */ 957 bool DrvAudioHlpStreamStatusIsReady(PDMAUDIOSTREAMSTS fStatus) 952 && !(fStatus & PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT);*/ 953 return (fStatus & ( PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED 954 | PDMAUDIOSTREAMSTS_FLAGS_ENABLED 955 | PDMAUDIOSTREAMSTS_FLAGS_PAUSED 956 | PDMAUDIOSTREAMSTS_FLAGS_PENDING_DISABLE 957 | PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT)) 958 == ( PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED 959 | PDMAUDIOSTREAMSTS_FLAGS_ENABLED); 960 } 961 962 /** 963 * Checks if the stream status is a read-to-operate one. 964 * 965 * @returns @c true if ready to operate, @c false if not. 966 * @param fStatus Stream status to evaluate, PDMAUDIOSTREAMSTS_FLAGS_XXX. 967 */ 968 bool PDMAudioStrmStatusIsReady(PDMAUDIOSTREAMSTS fStatus) 958 969 { 959 970 AssertReturn(fStatus & PDMAUDIOSTREAMSTS_VALID_MASK, false); 960 971 /* 961 972 return fStatus & PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED 962 973 && fStatus & PDMAUDIOSTREAMSTS_FLAGS_ENABLED 963 && !(fStatus & PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT); 974 && !(fStatus & PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT);*/ 975 return (fStatus & ( PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED 976 | PDMAUDIOSTREAMSTS_FLAGS_ENABLED 977 | PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT)) 978 == ( PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED 979 | PDMAUDIOSTREAMSTS_FLAGS_ENABLED); 964 980 } 965 981
Note:
See TracChangeset
for help on using the changeset viewer.