| | |
| | | }) |
| | | } |
| | | |
| | | fn is_bound_user_participant(identity: &str, expected: Option<&str>) -> bool { |
| | | expected.is_none_or(|value| identity == value) |
| | | } |
| | | |
| | | async fn observe_user_audio_events( |
| | | mut events: UnboundedReceiver<RoomEvent>, |
| | | call_id: String, |
| | |
| | | publication: _, |
| | | participant, |
| | | } => { |
| | | if user_participant_identity |
| | | .as_deref() |
| | | .is_some_and(|expected| participant.identity().to_string() != expected) |
| | | { |
| | | if !is_bound_user_participant( |
| | | &participant.identity().to_string(), |
| | | user_participant_identity.as_deref(), |
| | | ) { |
| | | warn!(call_id = %call_id, trace_id = %trace_id, |
| | | metadata_status = "wrong_participant", |
| | | "runtime helper ignored non-user audio participant"); |
| | |
| | | } |
| | | |
| | | #[test] |
| | | fn production_observer_rejects_wrong_participant_before_vad_session() { |
| | | assert!(!is_bound_user_participant( |
| | | "participant-other", |
| | | Some("participant-user") |
| | | )); |
| | | assert!(is_bound_user_participant( |
| | | "participant-user", |
| | | Some("participant-user") |
| | | )); |
| | | assert!(is_bound_user_participant("participant-any", None)); |
| | | } |
| | | |
| | | #[test] |
| | | fn reply_chunk_marker_state_emits_turn_first_once_and_later_segment_first_once() { |
| | | let mut state = ReplyChunkMarkerState::default(); |
| | | |