mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-09-02 09:43:48 +00:00
Revert "threadshare: udp: avoid getifaddrs in android"
This reverts commit 75a0baa6fa
.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1918>
This commit is contained in:
parent
78c8d4df55
commit
4e2c16a2af
5 changed files with 54 additions and 128 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3409,7 +3409,6 @@ version = "0.15.0-alpha.1"
|
|||
dependencies = [
|
||||
"async-lock",
|
||||
"async-task",
|
||||
"bitflags 2.9.1",
|
||||
"byte-slice-cast",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
|
|
|
@ -29,15 +29,12 @@ slab = "0.4.7"
|
|||
socket2 = {features = ["all"], version = "0.6"}
|
||||
thiserror = "2"
|
||||
waker-fn = "1.1"
|
||||
bitflags = "2.6.0"
|
||||
getifaddrs = "0.2"
|
||||
libc = "0.2"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
windows-sys = { version = ">=0.52, <=0.60", features = ["Win32_Foundation"] }
|
||||
|
||||
[target.'cfg(not(target_os = "android"))'.dependencies]
|
||||
getifaddrs = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
gst-check.workspace = true
|
||||
gst-app = { workspace = true, features = [ "v1_20" ] }
|
||||
|
|
|
@ -8,60 +8,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
//FIXME: Remove this when https://github.com/mmastrac/getifaddrs/issues/5 is fixed in the `getifaddrs` crate
|
||||
#[cfg(target_os = "android")]
|
||||
pub mod getifaddrs {
|
||||
use bitflags::bitflags;
|
||||
|
||||
bitflags! {
|
||||
/// Flags representing the status and capabilities of a network interface.
|
||||
///
|
||||
/// These flags provide information about the current state and features of a network interface.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct InterfaceFlags: u32 {
|
||||
/// The interface is up and running.
|
||||
const UP = 0x1;
|
||||
/// The interface is in a running state.
|
||||
const RUNNING = 0x2;
|
||||
/// The interface supports broadcast.
|
||||
const BROADCAST = 0x4;
|
||||
/// The interface is a loopback interface.
|
||||
const LOOPBACK = 0x8;
|
||||
/// The interface is a point-to-point link.
|
||||
const POINTTOPOINT = 0x10;
|
||||
/// The interface supports multicast.
|
||||
const MULTICAST = 0x20;
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a network interface.
|
||||
///
|
||||
/// This struct contains information about a network interface, including its name,
|
||||
/// IP address, netmask, flags, and index.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct Interface {
|
||||
/// The name of the interface.
|
||||
pub name: String,
|
||||
/// The description of the interface (Windows-specific).
|
||||
#[cfg(windows)]
|
||||
pub description: String,
|
||||
/// The IP address associated with the interface.
|
||||
pub address: std::net::IpAddr,
|
||||
// TODO: This may be implementable for Windows.
|
||||
#[cfg(not(windows))]
|
||||
/// The associated address of the interface. For broadcast interfaces, this
|
||||
/// is the broadcast address. For point-to-point interfaces, this is the
|
||||
/// peer address.
|
||||
pub associated_address: Option<std::net::IpAddr>,
|
||||
/// The netmask of the interface, if available.
|
||||
pub netmask: Option<std::net::IpAddr>,
|
||||
/// The flags indicating the interface's properties and state.
|
||||
pub flags: InterfaceFlags,
|
||||
/// The index of the interface, if available.
|
||||
pub index: Option<u32>,
|
||||
}
|
||||
}
|
||||
|
||||
use getifaddrs::Interface;
|
||||
|
||||
#[cfg(unix)]
|
||||
|
|
|
@ -36,10 +36,6 @@ use std::net::{IpAddr, SocketAddr, UdpSocket};
|
|||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
|
||||
//FIXME: Remove this when https://github.com/mmastrac/getifaddrs/issues/5 is fixed in the `getifaddrs` crate
|
||||
#[cfg(target_os = "android")]
|
||||
use net::getifaddrs;
|
||||
|
||||
const DEFAULT_HOST: Option<&str> = Some("127.0.0.1");
|
||||
const DEFAULT_PORT: i32 = 5004;
|
||||
const DEFAULT_SYNC: bool = true;
|
||||
|
@ -160,9 +156,6 @@ impl UdpSinkPadHandler {
|
|||
// So we first get all the interfaces and then apply filter
|
||||
// for name and description (Friendly Name) of each interface.
|
||||
|
||||
//FIXME: Remove this when https://github.com/mmastrac/getifaddrs/issues/5 is fixed in the `getifaddrs` crate
|
||||
#[cfg(not(target_os = "android"))]
|
||||
{
|
||||
let ifaces = getifaddrs::getifaddrs().map_err(|err| {
|
||||
gst::error_msg!(
|
||||
gst::ResourceError::OpenRead,
|
||||
|
@ -200,7 +193,6 @@ impl UdpSinkPadHandler {
|
|||
|
||||
inner.multicast_ifaces = iface_filter.collect();
|
||||
}
|
||||
}
|
||||
|
||||
for addr in inner.clients.iter() {
|
||||
inner.configure_client(addr)?;
|
||||
|
|
|
@ -39,10 +39,6 @@ use crate::socket::{wrap_socket, GioSocketWrapper, Socket, SocketError, SocketRe
|
|||
use futures::channel::mpsc::{channel, Receiver, Sender};
|
||||
use futures::pin_mut;
|
||||
|
||||
//FIXME: Remove this when https://github.com/mmastrac/getifaddrs/issues/5 is fixed in the `getifaddrs` crate
|
||||
#[cfg(target_os = "android")]
|
||||
use net::getifaddrs;
|
||||
|
||||
const DEFAULT_ADDRESS: Option<&str> = Some("0.0.0.0");
|
||||
const DEFAULT_PORT: i32 = 5004;
|
||||
const DEFAULT_REUSE: bool = true;
|
||||
|
@ -378,9 +374,6 @@ impl TaskImpl for UdpSrcTask {
|
|||
let multi_ifaces: Vec<String> =
|
||||
multicast_iface.split(',').map(|s| s.to_string()).collect();
|
||||
|
||||
//FIXME: Remove this when https://github.com/mmastrac/getifaddrs/issues/5 is fixed in the `getifaddrs` crate
|
||||
#[cfg(not(target_os = "android"))]
|
||||
{
|
||||
let iter = getifaddrs::getifaddrs().map_err(|err| {
|
||||
gst::error_msg!(
|
||||
gst::ResourceError::OpenRead,
|
||||
|
@ -418,7 +411,6 @@ impl TaskImpl for UdpSrcTask {
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if self.multicast_ifaces.is_empty() {
|
||||
gst::warning!(
|
||||
|
|
Loading…
Reference in a new issue