"Nokia submits this code under the terms of a commercial contribution
agreement with RealNetworks, and I am authorized to contribute this code
under said agreement."

        Modified by:  [EMAIL PROTECTED]

        Reviewed by: 

        Date: 05-Nov-2007

        Project: SymbianMmf_rel

      ErrorId: ELYG-78FD3P
             EGRS-78FKA2
                    
        Synopsis:  CR: Symbian Fix for crash during KErrDied from
DevSound.

        Symbian Helix client was crashing sometimes during
PlayError(KErrDied) and when pause-play is sent continuously to the
controller.

        Sending number of pause/play in quick succession resulted in the
lastsamplesplayed and samples played counter to zero. Even though this
case is valid, it fails under the conditions added for earlier versions
of devsound. This resulted in a case where negative number is assigned
to unsigned int. Proposed handling is to ignore the computation during
that case.

        Sometimes devsound invokes BufferToBeFilled call even after
PlayError(KErrDied) which should not be the case. This resulted in
buffer being used and the sample stat being effected. Now with the
proposed CR, the buffer will be handled only during PLAYING and
PLAYINIT_PENDING state.
         
        Root Cause of the problem: Implementation
         
        Files Modified:
        platform/symbian/common/CHXBaseAudioSession.cpp

        Image Size and Heap Use impact: no impact

        Module Release testing (STIF) :  Passed.

        Test case(s) Added  :  No.

        Memory leak check performed : Yes.  No new leaks introduced. 

        Platforms and Profiles Build Verified:
helix-client-s60-32-mmf-mdf-arm

        Platforms and Profiles Functionality verified: armv5,winscw

      Branch: Head & 210CayS


Index: platform/symbian/common/CHXBaseAudioSession.cpp
===================================================================
RCS file:
/cvsroot/audio/device/platform/symbian/common/CHXBaseAudioSession.cpp,v
retrieving revision 1.1.2.3
diff -w -u -b -r1.1.2.3 CHXBaseAudioSession.cpp
--- platform/symbian/common/CHXBaseAudioSession.cpp     18 Oct 2007
23:32:15 -0000      1.1.2.3
+++ platform/symbian/common/CHXBaseAudioSession.cpp     5 Nov 2007
22:04:13 -0000
@@ -761,9 +761,9 @@
         //m_samplesWritten -= m_cbFrontBufferWritten/m_cbSample;
         m_cbFrontBufferWritten = 0;

-        IHXBuffer* pBuf = (IHXBuffer*)m_pastBufferList.RemoveTail();
-        if( pBuf )
+        if(!m_pastBufferList.IsEmpty())
         {
+            IHXBuffer* pBuf =
(IHXBuffer*)m_pastBufferList.RemoveTail();
             m_cbFrontBufferWritten =  pBuf->GetSize();
             m_cbPastBufferList -= m_cbFrontBufferWritten;
             m_bufferList.AddHead( pBuf );
@@ -773,6 +773,7 @@
         {
             //it might be an overkill, it should not reach here.
             //however, in case it happens, it is handled.
+            HXLOGL1(HXLOG_ADEV,
"CHXBaseAudioSession::RetrieveUnplayedSamplesFromPastQueue ERROR: List
Empty");
             break;
         }
     }
@@ -928,9 +929,10 @@
     case PLAYING:
         break;
     default:
+        // Ignore the Buffer as it is not valid in other states.
         HX_ASSERT(FALSE);
-        HXLOGL3(HXLOG_ADEV, "CHXBaseAudioSession::BufferToBeFilled():
unexpected state %s", StringifyState(m_state));
-        break;
+        HXLOGL2(HXLOG_ADEV, "CHXBaseAudioSession::BufferToBeFilled():
WARNING unexpected state %s", StringifyState(m_state))
;
+        return;
     }

     HX_ASSERT(aBuffer);
@@ -1258,9 +1260,19 @@
     if (!m_sampleCountResetPending)
     {
         // keep track of samples that we wrote but haven't been played
yet
-        HX_ASSERT(m_samplesWritten >= m_lastSampleCount);
+        if(m_samplesWritten >= m_lastSampleCount)
+        {
         m_unplayedSampleCount = m_samplesWritten - m_lastSampleCount;
     }
+        else
+        {
+            HX_ASSERT(m_samplesWritten >= m_lastSampleCount);
+            // This case is hit when pause/play is sent
+            // continously without allowing the device to playback.
Ignore the computation
+            HXLOGL1(HXLOG_ADEV,
"CHXBaseAudioSession::UpdateUnplayedSampleCount(): WARNING state = %s
written=%lu last=%lu u
nplayed=%lu",
+                                 StringifyState(m_state),
m_samplesWritten, m_lastSampleCount, m_unplayedSampleCount);
+        }
+    }

 #ifdef HELIX_CONFIG_SYMBIAN_SAMPLESPLAYED
     RemoveOutdatedPacketsInPastQueue();


_______________________________________________
Audio-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/audio-dev

Reply via email to