Index: /trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp	(revision 59433)
+++ /trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp	(revision 59434)
@@ -265,16 +265,16 @@
     /** Host stream out. */
     PDMAUDIOHSTSTRMOUT          streamOut;
-    /* Stream description which is default on the device */
+    /** Stream description which is default on the device. */
     AudioStreamBasicDescription deviceFormat;
-    /* Stream description which is selected for using by VBox */
+    /** Stream description which is selected for using with VBox. */
     AudioStreamBasicDescription streamFormat;
-    /* The audio device ID of the currently used device */
+    /** The audio device ID of the currently used device. */
     AudioDeviceID               deviceID;
-    /* The AudioUnit used */
+    /** The AudioUnit being used. */
     AudioUnit                   audioUnit;
-    /* A ring buffer for transferring data to the playback thread. */
+    /** A ring buffer for transferring data to the playback thread. */
     PRTCIRCBUF                  pBuf;
-    /* Initialization status tracker. Used when some of the device parameters
-     * or the device itself is changed during the runtime. */
+    /** Initialization status tracker. Used when some of the device parameters
+     *  or the device itself is changed during the runtime. */
     volatile uint32_t           status;
     /** Flag whether the "default device changed" listener was registered. */
@@ -286,24 +286,24 @@
     /** Host stream in. */
     PDMAUDIOHSTSTRMIN           streamIn;
-    /* Stream description which is default on the device */
+    /** Stream description which is default on the device. */
     AudioStreamBasicDescription deviceFormat;
-    /* Stream description which is selected for using by VBox */
+    /** Stream description which is selected for using with VBox. */
     AudioStreamBasicDescription streamFormat;
-    /* The audio device ID of the currently used device */
+    /** The audio device ID of the currently used device. */
     AudioDeviceID               deviceID;
-    /* The AudioUnit used */
+    /** The AudioUnit used. */
     AudioUnit                   audioUnit;
-    /* The audio converter if necessary */
+    /** The audio converter if necessary. */
     AudioConverterRef           converter;
-    /* A temporary position value used in the caConverterCallback function */
-    uint32_t                    rpos;
-    /* The ratio between the device & the stream sample rate */
+    /** Native buffer used for render the audio data in the recording thread. */
+    AudioBufferList             bufferList;
+    /** Reading offset for the bufferList's buffer. */
+    uint32_t                    offBufferRead;
+    /** The ratio between the device & the stream sample rate. */
     Float64                     sampleRatio;
-    /* An extra buffer used for render the audio data in the recording thread */
-    AudioBufferList             bufferList;
-    /* A ring buffer for transferring data from the recording thread */
+    /** A ring buffer for transferring data from the recording thread. */
     PRTCIRCBUF                  pBuf;
-    /* Initialization status tracker. Used when some of the device parameters
-     * or the device itself is changed during the runtime. */
+    /** Initialization status tracker. Used when some of the device parameters
+     *  or the device itself is changed during the runtime. */
     volatile uint32_t           status;
     /** Flag whether the "default device changed" listener was registered. */
@@ -487,7 +487,7 @@
 
     /* Use the lower one of the packets to process & the available packets in the buffer. */
-    Assert(pBufferList->mBuffers[0].mDataByteSize >= pStreamIn->rpos);
+    Assert(pBufferList->mBuffers[0].mDataByteSize >= pStreamIn->offBufferRead);
     UInt32 cSize = RT_MIN(*pcPackets * pStreamIn->deviceFormat.mBytesPerPacket,
-                          pBufferList->mBuffers[0].mDataByteSize - pStreamIn->rpos);
+                          pBufferList->mBuffers[0].mDataByteSize - pStreamIn->offBufferRead);
 
     /* Set the new size on output, so the caller know what we have processed. */
@@ -510,7 +510,7 @@
         pBufData->mBuffers[0].mNumberChannels = pBufferList->mBuffers[0].mNumberChannels;
         pBufData->mBuffers[0].mDataByteSize   = cSize;
-        pBufData->mBuffers[0].mData           = (uint8_t *)pBufferList->mBuffers[0].mData + pStreamIn->rpos;
-
-        pStreamIn->rpos += cSize;
+        pBufData->mBuffers[0].mData           = (uint8_t *)pBufferList->mBuffers[0].mData + pStreamIn->offBufferRead;
+
+        pStreamIn->offBufferRead += cSize;
 
         err = noErr;
@@ -571,4 +571,7 @@
             tmpList.mNumberBuffers = 1;
             tmpList.mBuffers[0].mNumberChannels = pStreamIn->streamFormat.mChannelsPerFrame;
+
+            /* Set the read position to zero. */
+            pStreamIn->offBufferRead = 0;
 
             /* Iterate as long as data is available. */
@@ -1809,9 +1812,9 @@
                 RTCircBufDestroy(pStreamIn->pBuf);
 
-                pStreamIn->audioUnit   = NULL;
-                pStreamIn->deviceID    = kAudioDeviceUnknown;
-                pStreamIn->pBuf        = NULL;
-                pStreamIn->sampleRatio = 1;
-                pStreamIn->rpos        = 0;
+                pStreamIn->audioUnit     = NULL;
+                pStreamIn->deviceID      = kAudioDeviceUnknown;
+                pStreamIn->pBuf          = NULL;
+                pStreamIn->sampleRatio   = 1;
+                pStreamIn->offBufferRead = 0;
 
                 ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_UNINIT);
@@ -1935,9 +1938,9 @@
     ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_UNINIT);
 
-    pStreamIn->audioUnit   = NULL;
-    pStreamIn->deviceID    = kAudioDeviceUnknown;
-    pStreamIn->converter   = NULL;
-    pStreamIn->sampleRatio = 1;
-    pStreamIn->rpos        = 0;
+    pStreamIn->audioUnit     = NULL;
+    pStreamIn->deviceID      = kAudioDeviceUnknown;
+    pStreamIn->converter     = NULL;
+    pStreamIn->sampleRatio   = 1;
+    pStreamIn->offBufferRead = 0;
 
     bool fDeviceByUser = false;
