--- a/bluetooth/btstack/avdtp/avdtpMuxChannel.cpp Mon Jul 12 07:03:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMuxChannel.cpp Mon Jul 12 07:06:31 2010 +0300
@@ -295,7 +295,7 @@
#pragma message("is there n pools for eg media, or just one?")
}
*/
-TInt CMuxChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType)
+TInt CMuxChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType, TL2CapConfig::TChannelPriority aPriority)
/**
Protocol must ensure it has found appropriate muxchannel for
Recovery packets
@@ -321,7 +321,45 @@
__ASSERT_DEBUG(sessionArray, Panic(EAVDTPBadSessionAttachToTransportChannel));
- return sessionArray->Append(TUserPlaneTransportSessionState(aSession));
+ TInt err = sessionArray->Append(TUserPlaneTransportSessionState(aSession, aPriority));
+ if(err == KErrNone)
+ {
+ UpdateChannelPriority();
+ }
+ return err;
+ }
+
+void CMuxChannel::UpdateChannelPriority()
+ {
+ LOG_FUNC
+
+ TL2CapConfig::TChannelPriority maxPriority = TL2CapConfig::ELow;
+
+ MaxChannelPriority(maxPriority, iMediaSessions);
+ MaxChannelPriority(maxPriority, iReportingSessions);
+ MaxChannelPriority(maxPriority, iRecoverySessions);
+
+ if(iLogicalChannel)
+ {
+ TPckgBuf<TL2CapConfig> configBuf;
+ configBuf().ConfigureChannelPriority(maxPriority);
+ (void)iLogicalChannel->SetOption(KSolBtL2CAP, KL2CAPUpdateChannelConfig, configBuf);
+ }
+ }
+
+
+void CMuxChannel::MaxChannelPriority(TL2CapConfig::TChannelPriority& aMaxPriority, const RArray<TUserPlaneTransportSessionState>& aSessions)
+ {
+ LOG_STATIC_FUNC
+
+ for(TInt i=0; i < aSessions.Count(); ++i)
+ {
+ TL2CapConfig::TChannelPriority priority = aSessions[i].iChannelPriority;
+ if(aMaxPriority < priority)
+ {
+ aMaxPriority = priority;
+ }
+ }
}
/**
@@ -419,6 +457,7 @@
}
__ASSERT_DEBUG(found==1, Panic(EAVDTPBadSessionDetachFromTransportChannel));
+ UpdateChannelPriority();
CheckForClose();
}