Changeset 76846 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Jan 17, 2019 11:07:07 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r76778 r76846 2977 2977 * @param pCfgReq Requested audio stream configuration to use for stream creation. 2978 2978 * @param pCfgAcq Acquired audio stream configuration returned by the backend. 2979 * 2980 * @note Configuration precedence for requested audio stream configuration (first has highest priority, if set): 2981 * - per global extra-data 2982 * - per-VM extra-data 2983 * - requested configuration (by pCfgReq) 2984 * - default value 2979 2985 */ 2980 2986 static int drvAudioStreamCreateInternalBackend(PDRVAUDIO pThis, … … 2995 3001 * All parameters in principle can be changed and returned by the backend via the acquired configuration. */ 2996 3002 3003 char szWhat[64]; /* Log where a value came from. */ 3004 2997 3005 /* 2998 3006 * Period size 2999 3007 */ 3000 3008 if (pDrvCfg->uPeriodSizeMs) 3009 { 3001 3010 pCfgReq->Backend.cfPeriod = DrvAudioHlpMilliToFrames(pDrvCfg->uPeriodSizeMs, &pCfgReq->Props); 3002 else /* Set default period size. */ 3011 RTStrPrintf(szWhat, sizeof(szWhat), "global / per-VM"); 3012 } 3013 3014 if (!pCfgReq->Backend.cfPeriod) /* Set default period size if nothing explicitly is set. */ 3015 { 3003 3016 pCfgReq->Backend.cfPeriod = DrvAudioHlpMilliToFrames(50 /* ms */, &pCfgReq->Props); 3017 RTStrPrintf(szWhat, sizeof(szWhat), "default"); 3018 } 3019 else 3020 RTStrPrintf(szWhat, sizeof(szWhat), "device-specific"); 3004 3021 3005 3022 LogRel2(("Audio: Using %s period size (%RU64ms, %RU32 frames) for stream '%s'\n", 3006 pDrvCfg->uPeriodSizeMs ? "custom" : "default", DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPeriod, &pCfgReq->Props),3007 pCfgReq->Backend.cfPeriod, pStream->szName));3023 szWhat, 3024 DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPeriod, &pCfgReq->Props), pCfgReq->Backend.cfPeriod, pStream->szName)); 3008 3025 3009 3026 /* … … 3011 3028 */ 3012 3029 if (pDrvCfg->uBufferSizeMs) 3030 { 3013 3031 pCfgReq->Backend.cfBufferSize = DrvAudioHlpMilliToFrames(pDrvCfg->uBufferSizeMs, &pCfgReq->Props); 3014 else /* Set default buffer size. */ 3032 RTStrPrintf(szWhat, sizeof(szWhat), "global / per-VM"); 3033 } 3034 3035 if (!pCfgReq->Backend.cfBufferSize) /* Set default period size if nothing explicitly is set. */ 3036 { 3015 3037 pCfgReq->Backend.cfBufferSize = DrvAudioHlpMilliToFrames(250 /* ms */, &pCfgReq->Props); 3038 RTStrPrintf(szWhat, sizeof(szWhat), "default"); 3039 } 3040 else 3041 RTStrPrintf(szWhat, sizeof(szWhat), "device-specific"); 3016 3042 3017 3043 LogRel2(("Audio: Using %s buffer size (%RU64ms, %RU32 frames) for stream '%s'\n", 3018 pDrvCfg->uBufferSizeMs ? "custom" : "default", DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props),3019 pCfgReq->Backend.cfBufferSize, pStream->szName));3044 szWhat, 3045 DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props), pCfgReq->Backend.cfBufferSize, pStream->szName)); 3020 3046 3021 3047 /* … … 3025 3051 { 3026 3052 pCfgReq->Backend.cfPreBuf = DrvAudioHlpMilliToFrames(pDrvCfg->uPreBufSizeMs, &pCfgReq->Props); 3027 } 3028 else /* Set default pre-buffering size. */ 3053 RTStrPrintf(szWhat, sizeof(szWhat), "global / per-VM"); 3054 } 3055 3056 if (pCfgReq->Backend.cfPreBuf == UINT32_MAX) /* Set default period size if nothing explicitly is set. */ 3029 3057 { 3030 3058 /* For pre-buffering to finish the buffer at least must be full one time. */ 3031 3059 pCfgReq->Backend.cfPreBuf = pCfgReq->Backend.cfBufferSize; 3032 } 3060 RTStrPrintf(szWhat, sizeof(szWhat), "default"); 3061 } 3062 else 3063 RTStrPrintf(szWhat, sizeof(szWhat), "device-specific"); 3033 3064 3034 3065 LogRel2(("Audio: Using %s pre-buffering size (%RU64ms, %RU32 frames) for stream '%s'\n", 3035 pDrvCfg->uPreBufSizeMs != UINT32_MAX ? "custom" : "default", DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPreBuf, &pCfgReq->Props),3036 pCfgReq->Backend.cfPreBuf, pStream->szName));3066 szWhat, 3067 DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPreBuf, &pCfgReq->Props), pCfgReq->Backend.cfPreBuf, pStream->szName)); 3037 3068 3038 3069 /*
Note:
See TracChangeset
for help on using the changeset viewer.