Changeset 59434 in vbox
- Timestamp:
- Jan 22, 2016 8:42:22 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 105172
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
r59433 r59434 265 265 /** Host stream out. */ 266 266 PDMAUDIOHSTSTRMOUT streamOut; 267 /* Stream description which is default on the device*/267 /** Stream description which is default on the device. */ 268 268 AudioStreamBasicDescription deviceFormat; 269 /* Stream description which is selected for using by VBox*/269 /** Stream description which is selected for using with VBox. */ 270 270 AudioStreamBasicDescription streamFormat; 271 /* The audio device ID of the currently used device*/271 /** The audio device ID of the currently used device. */ 272 272 AudioDeviceID deviceID; 273 /* The AudioUnit used*/273 /** The AudioUnit being used. */ 274 274 AudioUnit audioUnit; 275 /* A ring buffer for transferring data to the playback thread. */275 /** A ring buffer for transferring data to the playback thread. */ 276 276 PRTCIRCBUF pBuf; 277 /* Initialization status tracker. Used when some of the device parameters278 * or the device itself is changed during the runtime. */277 /** Initialization status tracker. Used when some of the device parameters 278 * or the device itself is changed during the runtime. */ 279 279 volatile uint32_t status; 280 280 /** Flag whether the "default device changed" listener was registered. */ … … 286 286 /** Host stream in. */ 287 287 PDMAUDIOHSTSTRMIN streamIn; 288 /* Stream description which is default on the device*/288 /** Stream description which is default on the device. */ 289 289 AudioStreamBasicDescription deviceFormat; 290 /* Stream description which is selected for using by VBox*/290 /** Stream description which is selected for using with VBox. */ 291 291 AudioStreamBasicDescription streamFormat; 292 /* The audio device ID of the currently used device*/292 /** The audio device ID of the currently used device. */ 293 293 AudioDeviceID deviceID; 294 /* The AudioUnit used*/294 /** The AudioUnit used. */ 295 295 AudioUnit audioUnit; 296 /* The audio converter if necessary*/296 /** The audio converter if necessary. */ 297 297 AudioConverterRef converter; 298 /* A temporary position value used in the caConverterCallback function */ 299 uint32_t rpos; 300 /* The ratio between the device & the stream sample rate */ 298 /** Native buffer used for render the audio data in the recording thread. */ 299 AudioBufferList bufferList; 300 /** Reading offset for the bufferList's buffer. */ 301 uint32_t offBufferRead; 302 /** The ratio between the device & the stream sample rate. */ 301 303 Float64 sampleRatio; 302 /* An extra buffer used for render the audio data in the recording thread */ 303 AudioBufferList bufferList; 304 /* A ring buffer for transferring data from the recording thread */ 304 /** A ring buffer for transferring data from the recording thread. */ 305 305 PRTCIRCBUF pBuf; 306 /* Initialization status tracker. Used when some of the device parameters307 * or the device itself is changed during the runtime. */306 /** Initialization status tracker. Used when some of the device parameters 307 * or the device itself is changed during the runtime. */ 308 308 volatile uint32_t status; 309 309 /** Flag whether the "default device changed" listener was registered. */ … … 487 487 488 488 /* Use the lower one of the packets to process & the available packets in the buffer. */ 489 Assert(pBufferList->mBuffers[0].mDataByteSize >= pStreamIn-> rpos);489 Assert(pBufferList->mBuffers[0].mDataByteSize >= pStreamIn->offBufferRead); 490 490 UInt32 cSize = RT_MIN(*pcPackets * pStreamIn->deviceFormat.mBytesPerPacket, 491 pBufferList->mBuffers[0].mDataByteSize - pStreamIn-> rpos);491 pBufferList->mBuffers[0].mDataByteSize - pStreamIn->offBufferRead); 492 492 493 493 /* Set the new size on output, so the caller know what we have processed. */ … … 510 510 pBufData->mBuffers[0].mNumberChannels = pBufferList->mBuffers[0].mNumberChannels; 511 511 pBufData->mBuffers[0].mDataByteSize = cSize; 512 pBufData->mBuffers[0].mData = (uint8_t *)pBufferList->mBuffers[0].mData + pStreamIn-> rpos;513 514 pStreamIn-> rpos+= cSize;512 pBufData->mBuffers[0].mData = (uint8_t *)pBufferList->mBuffers[0].mData + pStreamIn->offBufferRead; 513 514 pStreamIn->offBufferRead += cSize; 515 515 516 516 err = noErr; … … 571 571 tmpList.mNumberBuffers = 1; 572 572 tmpList.mBuffers[0].mNumberChannels = pStreamIn->streamFormat.mChannelsPerFrame; 573 574 /* Set the read position to zero. */ 575 pStreamIn->offBufferRead = 0; 573 576 574 577 /* Iterate as long as data is available. */ … … 1809 1812 RTCircBufDestroy(pStreamIn->pBuf); 1810 1813 1811 pStreamIn->audioUnit = NULL;1812 pStreamIn->deviceID = kAudioDeviceUnknown;1813 pStreamIn->pBuf = NULL;1814 pStreamIn->sampleRatio = 1;1815 pStreamIn-> rpos= 0;1814 pStreamIn->audioUnit = NULL; 1815 pStreamIn->deviceID = kAudioDeviceUnknown; 1816 pStreamIn->pBuf = NULL; 1817 pStreamIn->sampleRatio = 1; 1818 pStreamIn->offBufferRead = 0; 1816 1819 1817 1820 ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_UNINIT); … … 1935 1938 ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_UNINIT); 1936 1939 1937 pStreamIn->audioUnit = NULL;1938 pStreamIn->deviceID = kAudioDeviceUnknown;1939 pStreamIn->converter = NULL;1940 pStreamIn->sampleRatio = 1;1941 pStreamIn-> rpos= 0;1940 pStreamIn->audioUnit = NULL; 1941 pStreamIn->deviceID = kAudioDeviceUnknown; 1942 pStreamIn->converter = NULL; 1943 pStreamIn->sampleRatio = 1; 1944 pStreamIn->offBufferRead = 0; 1942 1945 1943 1946 bool fDeviceByUser = false;
Note:
See TracChangeset
for help on using the changeset viewer.