ts-udpsrc: Fix build on Windows

By disabling socket sharing there. This is blocked by PRs to mio/tokio
currently.
This commit is contained in:
Sebastian Dröge 2019-02-07 10:21:08 +02:00
parent 6286e496ba
commit a2582afed3
2 changed files with 21 additions and 2 deletions

View file

@ -696,7 +696,9 @@ impl UdpSrc {
} }
#[cfg(windows)] #[cfg(windows)]
unsafe { unsafe {
let fd = dup_socket(socket.as_raw_socket() as _) as _; // FIXME: Needs https://github.com/tokio-rs/tokio/pull/806
// and https://github.com/carllerche/mio/pull/859
let fd = unreachable!(); //dup_socket(socket.as_raw_socket() as _) as _;
// This is unsafe because it allows us to share the fd between the socket and the // This is unsafe because it allows us to share the fd between the socket and the
// GIO socket below, but safety of this is the job of the application // GIO socket below, but safety of this is the job of the application
@ -876,7 +878,23 @@ impl ObjectSubclass for UdpSrc {
.unwrap(); .unwrap();
klass.add_pad_template(src_pad_template); klass.add_pad_template(src_pad_template);
klass.install_properties(&PROPERTIES); #[cfg(not(windows))]
{
klass.install_properties(&PROPERTIES);
}
#[cfg(windows)]
{
let properties = PROPERTIES
.iter()
.filter(|p| match *p {
subclass::Property("socket", ..) | subclass::Property("used-socket", ..) => {
false
}
_ => true,
})
.collect::<Vec<_>>();
klass.install_properties(properties.as_slice());
}
} }
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self { fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {

View file

@ -103,6 +103,7 @@ fn test_push() {
} }
#[test] #[test]
#[cfg(not(windows))]
fn test_socket_reuse() { fn test_socket_reuse() {
init(); init();