Skip to content

Commit 5e20e6c

Browse files
joaoantoniocardosopatrickelectric
authored andcommitted
src: lib: stream: sink: Remove 'a=recvonly' attribute from SDPs
1 parent 52d5f92 commit 5e20e6c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/lib/stream/sink/webrtc_sink.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,5 +877,21 @@ fn customize_sent_sdp(sdp: &gst_sdp::SDPMessage) -> Result<gst_sdp::SDPMessage>
877877
});
878878
});
879879

880+
// Some SDP from RTSP cameras end up with a "a=recvonly" that breaks the webrtcbin when the browser responds, so we are removing them here
881+
new_sdp.medias_mut().for_each(|media| {
882+
let mut attributes_to_remove = media
883+
.attributes()
884+
.enumerate()
885+
.filter_map(|(attribute_idx, attribute)| {
886+
matches!(attribute.key(), "recvonly").then_some(attribute_idx)
887+
})
888+
.collect::<Vec<usize>>();
889+
attributes_to_remove.reverse();
890+
891+
for attribute_idx in attributes_to_remove {
892+
let _ = media.remove_attribute(attribute_idx as u32);
893+
}
894+
});
895+
880896
Ok(new_sdp)
881897
}

0 commit comments

Comments
 (0)