@@ -137,8 +137,7 @@ struct MSRPPortState<P: AVBPort>: Sendable {
137137}
138138
139139public final class MSRPApplication < P: AVBPort > : BaseApplication , BaseApplicationEventObserver ,
140- BaseApplicationContextObserver ,
141- ApplicationEventHandler , CustomStringConvertible , @unchecked Sendable where P == P
140+ BaseApplicationContextObserver , CustomStringConvertible , @unchecked Sendable where P == P
142141{
143142 private typealias TalkerRegistration = ( Participant < MSRPApplication > , any MSRPTalkerValue )
144143
@@ -397,49 +396,6 @@ public final class MSRPApplication<P: AVBPort>: BaseApplication, BaseApplication
397396 . normalParticipant
398397 }
399398
400- // If an MSRP message is received from a Port with an event value specifying
401- // the JoinIn or JoinMt message, and if the StreamID (35.2.2.8.2,
402- // 35.2.2.10.2), and Direction (35.2.1.2) all match those of an attribute
403- // already registered on that Port, and the Attribute Type (35.2.2.4) or
404- // FourPackedEvent (35.2.2.7.2) has changed, then the Bridge should behave as
405- // though an rLv! event (with immediate leavetimer expiration in the
406- // Registrar state table) was generated for the MAD in the Received MSRP
407- // Attribute Declarations before the rJoinIn! or rJoinMt! event for the
408- // attribute in the received message is processed
409- public func willHandleEvent(
410- context: EventContext < MSRPApplication >
411- ) async throws {
412- guard context. eventSource != . application else { return } // don't recurse
413- guard context. event == . rJoinIn || context. event == . rJoinMt else { return }
414-
415- let contextAttributeType = MSRPAttributeType ( rawValue: context. attributeType) !
416- guard let contextDirection = contextAttributeType. direction else { return }
417-
418- let contextStreamID = ( context. attributeValue as! MSRPStreamIDRepresentable ) . streamID
419-
420- try await context. participant. leaveNow { attributeType, attributeSubtype, attributeValue in
421- let attributeType = MSRPAttributeType ( rawValue: attributeType) !
422- guard let direction = attributeType. direction else { return false }
423- let streamID = ( attributeValue as! MSRPStreamIDRepresentable ) . streamID
424-
425- // force immediate leave if the streamID and direction match and the
426- // attribute type has changed
427- let isIncluded = contextStreamID == streamID &&
428- contextDirection == direction &&
429- ( contextAttributeType != attributeType || context. attributeSubtype != attributeSubtype)
430-
431- if isIncluded {
432- _logger
433- . debug (
434- " MSRP: forcing immediate leave for stream \( streamID) owing to attribute change: \( attributeType) -> \( contextAttributeType) "
435- )
436- }
437- return isIncluded
438- }
439- }
440-
441- public func didHandleEvent( context: EventContext < MSRPApplication > ) { }
442-
443399 // On receipt of a REGISTER_STREAM.request the MSRP Participant shall issue a
444400 // MAD_Join.request service primitive (10.2, 10.3). The attribute_type (10.2)
445401 // parameter of the request shall carry the appropriate Talker Attribute Type
@@ -904,12 +860,12 @@ extension MSRPApplication {
904860
905861 // Leave the opposite talker declaration type to ensure mutual exclusion
906862 // (per spec, only one talker declaration type should exist per stream)
907- try await participant . leaveNow { attributeType , _ , attributeValue in
908- let attributeType = MSRPAttributeType ( rawValue : attributeType ) !
909- return attributeType. direction == . talker && attributeType != declarationType
910- . attributeType &&
911- ( attributeValue as! MSRPStreamIDRepresentable ) . streamID == talkerValue . streamID
912- }
863+ let oppositeType : MSRPAttributeType = declarationType == . talkerAdvertise ? . talkerFailed : . talkerAdvertise
864+ try ? await participant . leave (
865+ attributeType: oppositeType . rawValue ,
866+ attributeValue : talkerValue ,
867+ eventSource : eventSource
868+ )
913869
914870 if declarationType == . talkerAdvertise {
915871 do {
0 commit comments