Changeset 65014 in vbox
- Timestamp:
- Dec 27, 2016 12:08:21 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r65005 r65014 836 836 { 837 837 RT_NOREF(pThis); 838 AssertPtrReturn(pDstStream, VERR_INVALID_POINTER); 839 AssertPtrReturn(pSrcMixSink, VERR_INVALID_POINTER); 840 AssertReturn(cbToWrite, VERR_INVALID_PARAMETER); 841 /* pcbWritten is optional. */ 838 842 839 843 PRTCIRCBUF pCircBuf = pDstStream->State.pCircBuf; … … 883 887 { 884 888 RT_NOREF(pThis); 889 AssertPtrReturn(pSrcStream, VERR_INVALID_POINTER); 890 AssertPtrReturn(pDstMixSink, VERR_INVALID_POINTER); 891 AssertReturn(cbToRead, VERR_INVALID_PARAMETER); 892 /* pcbRead is optional. */ 885 893 886 894 PRTCIRCBUF pCircBuf = pSrcStream->State.pCircBuf; … … 1115 1123 PAC97STREAMSTATEAIO pAIO = &pStream->State.AIO; 1116 1124 1125 if (!ASMAtomicReadBool(&pAIO->fStarted)) 1126 return; 1127 1117 1128 int rc2 = RTCritSectEnter(&pAIO->CritSect); 1118 1129 AssertRC(rc2); … … 1127 1138 { 1128 1139 PAC97STREAMSTATEAIO pAIO = &pStream->State.AIO; 1140 1141 if (!ASMAtomicReadBool(&pAIO->fStarted)) 1142 return; 1129 1143 1130 1144 int rc2 = RTCritSectLeave(&pAIO->CritSect); … … 1176 1190 STAM_PROFILE_START(&pThis->StatOut, a); 1177 1191 1192 /* 1193 * Read from DMA. 1194 */ 1195 1178 1196 void *pvDst; 1179 1197 size_t cbDst; … … 1190 1208 RTCircBufReleaseWriteBlock(pCircBuf, cbProcessed); 1191 1209 1192 if (cbProcessed) 1210 /* 1211 * Process backends. 1212 */ 1213 1214 /* Do we have data left to write to the backends? */ 1215 uint32_t cbUsed = (uint32_t)RTCircBufUsed(pCircBuf); 1216 if (cbUsed) 1193 1217 { 1194 1218 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO … … 1196 1220 ichac97StreamAsyncIONotify(pThis, pStream); 1197 1221 #else 1222 /* Read audio data from the AC'97 stream and write to the backends. */ 1198 1223 rc2 = ichac97StreamRead(pThis, pStream, pMixSink, cbProcessed, NULL /* pcbRead */); 1199 1224 AssertRC(rc2); … … 1201 1226 } 1202 1227 1228 /* All DMA transfers done for now? */ 1203 1229 if ( !cbProcessed 1204 1230 #ifndef VBOX_WITH_AUDIO_AC97_ASYNC_IO 1231 /* All data read *and* processed for now? */ 1205 1232 && RTCircBufUsed(pCircBuf) == 0 1206 1233 #endif … … 1210 1237 } 1211 1238 1239 #ifndef VBOX_WITH_AUDIO_AC97_ASYNC_IO 1240 rc2 = AudioMixerSinkUpdate(pMixSink); 1241 AssertRC(rc2); 1242 #endif 1212 1243 STAM_PROFILE_STOP(&pThis->StatOut, a); 1213 1244 } … … 1217 1248 STAM_PROFILE_START(&pThis->StatIn, a); 1218 1249 1250 /* 1251 * Process backends. 1252 */ 1253 1254 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO 1255 /* Let the asynchronous thread know that there is some new data to process. */ 1256 ichac97StreamAsyncIONotify(pThis, pStream); 1257 #else 1258 rc2 = AudioMixerSinkUpdate(pMixSink); 1259 AssertRC(rc2); 1260 1261 /* Write read data from the backend to the AC'97 stream. */ 1262 rc2 = ichac97StreamWrite(pThis, pStream, pMixSink, 256 /** @todo Fix this! */, NULL /* pcbWritten */); 1263 AssertRC(rc2); 1264 #endif 1265 /* 1266 * Write to DMA. 1267 */ 1268 1219 1269 void *pvSrc; 1220 1270 size_t cbSrc; 1221 1271 1222 RTCircBufAcquireReadBlock(pCircBuf, 256 /** @todo */, &pvSrc, &cbSrc);1272 RTCircBufAcquireReadBlock(pCircBuf, 256 /** @todo Fix this! */, &pvSrc, &cbSrc); 1223 1273 1224 1274 if (cbSrc) … … 1231 1281 RTCircBufReleaseReadBlock(pCircBuf, cbProcessed); 1232 1282 1233 if (cbProcessed) 1234 { 1235 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO 1236 /* Let the asynchronous thread know that there is some new data to process. */ 1237 ichac97StreamAsyncIONotify(pThis, pStream); 1238 #else 1239 rc2 = ichac97StreamWrite(pThis, pStream, pMixSink, cbProcessed, NULL /* pcbWritten */); 1240 AssertRC(rc2); 1241 #endif 1242 } 1243 1244 /** @todo: Check this! */ 1245 if ( !cbProcessed 1246 #ifndef VBOX_WITH_AUDIO_AC97_ASYNC_IO 1247 && RTCircBufUsed(pCircBuf) == 0 1248 #endif 1249 ) 1250 { 1283 /* All DMA transfers done for now? */ 1284 if (!cbProcessed) 1251 1285 fDone = true; 1252 }1253 1286 1254 1287 STAM_PROFILE_STOP(&pThis->StatIn, a); … … 1257 1290 AssertFailed(); 1258 1291 1259 #ifndef VBOX_WITH_AUDIO_AC97_ASYNC_IO1260 rc2 = AudioMixerSinkUpdate(pMixSink);1261 AssertRC(rc2);1262 #endif1263 1292 if (fDone) 1264 1293 break;
Note:
See TracChangeset
for help on using the changeset viewer.

