diff -r 14e240312f6f -r 786b94c6f0a4 bluetooth/btstack/avdtp/avdtpMuxChannel.cpp --- a/bluetooth/btstack/avdtp/avdtpMuxChannel.cpp Thu Jul 15 19:55:36 2010 +0300 +++ b/bluetooth/btstack/avdtp/avdtpMuxChannel.cpp Thu Aug 19 11:01:00 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 configBuf; + configBuf().ConfigureChannelPriority(maxPriority); + (void)iLogicalChannel->SetOption(KSolBtL2CAP, KL2CAPUpdateChannelConfig, configBuf); + } + } + + +void CMuxChannel::MaxChannelPriority(TL2CapConfig::TChannelPriority& aMaxPriority, const RArray& 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(); }