[PORTCLS]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Sun, 7 Feb 2010 15:35:00 +0000 (15:35 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Sun, 7 Feb 2010 15:35:00 +0000 (15:35 +0000)
- Reset number of mappings and available data when a reset request arrives
- Handle case where a get position request appears before an audio buffer arrives which results in divide by zero exception

svn path=/trunk/; revision=45487

reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp
reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp

index aaa707b..7d82ae7 100644 (file)
@@ -466,6 +466,11 @@ CIrpQueue::CancelBuffers()
     KsCancelIo(&m_IrpList, &m_IrpListLock);
     // reset stream start flag
     m_StartStream = FALSE;
+    // reset number of mappings
+    m_NumMappings = 0;
+    // reset number of data available
+    m_NumDataAvailable = 0;
+
     // done
     return TRUE;
 }
index 14be43f..1162b94 100644 (file)
@@ -693,8 +693,11 @@ CPortPinWaveCyclic::UpdateCommonBuffer(
 
         if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
         {
-            // normalize position
-            m_Position.PlayOffset = m_Position.PlayOffset % m_Position.WriteOffset;
+            if (m_Position.WriteOffset)
+            {
+                // normalize position
+                m_Position.PlayOffset = m_Position.PlayOffset % m_Position.WriteOffset;
+            }
         }
     }
 }
@@ -742,8 +745,11 @@ CPortPinWaveCyclic::UpdateCommonBufferOverlap(
 
         if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
         {
-            // normalize position
-            m_Position.PlayOffset = m_Position.PlayOffset % m_Position.WriteOffset;
+            if (m_Position.WriteOffset)
+            {
+                // normalize position
+                m_Position.PlayOffset = m_Position.PlayOffset % m_Position.WriteOffset;
+            }
         }
 
     }