bluetoothengine/btaudioman/src/basrvaccman.cpp
branchRCL_3
changeset 23 9386f31cc85b
parent 22 613943a21004
child 24 269724087bed
--- a/bluetoothengine/btaudioman/src/basrvaccman.cpp	Tue Aug 31 15:25:10 2010 +0300
+++ b/bluetoothengine/btaudioman/src/basrvaccman.cpp	Wed Sep 01 12:20:04 2010 +0100
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:  Implementation of an accessory management.
-*  Version     : %version:  14.1.12 %
+*  Version     : %version:  14.1.11 %
 *
 */
 
@@ -619,23 +619,27 @@
     TInt idx = FindAcc(aAddr);
     if (idx >= 0)
         {
-        TInt audiolinks = AudioLinkStatus();        
-        if ( audiolinks && audiolinks != aProfile) 
+        // Check if another audio link opened already
+        TInt audiolinks = AudioLinkStatus();
+        
+        if ( ( audiolinks && audiolinks != aProfile) || 
+            ( iAudioRequests.Count() && 
+              iAudioRequests[0].iOngoing && 
+              iAudioRequests[0].iAddr == aAddr) )
             {
-            TRACE_INFO((_L(" [global audio link check] existing audio link %x. Audio should be rejected!"),
+            // another audio type is opened while we have an audio link or pending audio request.
+            if (iAudioRequests.Count())
+                {
+                TRACE_INFO((_L(" [audio link check] existing audio link %x, audio request pending ? %d. Audio should be rejected!"),
+                        audiolinks, iAudioRequests[0].iOngoing))
+                }
+            else
+                {
+                TRACE_INFO((_L(" [audio link check] existing audio link %x. Audio should be rejected!"),
                         audiolinks))
+                }
             RejectAudioLink(aAddr, (aProfile == EStereo) ? EAccStereoAudio : EAccMonoAudio);
             }
-        else if ( iAudioRequests.Count() && 
-                iAudioRequests[0].iReqType == EOpenReqFromAudioPolicy &&
-                iAudioRequests[0].iAudioType == ((aProfile == EStereo) ? EAccStereoAudio : EAccMonoAudio) &&
-                iAudioRequests[0].iOngoing && 
-                iAudioRequests[0].iAddr == aAddr)
-            {
-            TRACE_INFO((_L(" [device-specific audio request check] audio request pending ? %d. Audio request should be cancelled!"),
-                    iAudioRequests[0].iOngoing))
-            iAccs[idx]->CancelOpenAudio();
-            }
         else
             {
             iAccs[idx]->AccOpenedAudio(aProfile);