Skip to content

Commit

Permalink
src: lib: stream: sink: Remove 'a=recvonly' attribute from SDPs
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso committed Dec 9, 2024
1 parent 04a237d commit 3533899
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lib/stream/sink/webrtc_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,5 +877,21 @@ fn customize_sent_sdp(sdp: &gst_sdp::SDPMessage) -> Result<gst_sdp::SDPMessage>
});
});

// 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
new_sdp.medias_mut().for_each(|media| {
let mut attributes_to_remove = media
.attributes()
.enumerate()
.filter_map(|(attribute_idx, attribute)| {
matches!(attribute.key(), "recvonly").then_some(attribute_idx)
})
.collect::<Vec<usize>>();
attributes_to_remove.reverse();

for attribute_idx in attributes_to_remove {
let _ = media.remove_attribute(attribute_idx as u32);
}
});

Ok(new_sdp)
}

0 comments on commit 3533899

Please sign in to comment.