gst-plugins-rs/net/webrtchttp/src/lib.rs
Sanchayan Maity 6be5796888 Add a WebRTC WHEP source element
This implements WHEP specification based on
https://datatracker.ietf.org/doc/html/draft-murillo-whep-00

and has been tested with Cloudflare.

Server offers are likely to be removed from the WHEP specification
in upcoming revisions, to avoid compatibility issues. None of the
commercial services implementing WHEP support server initiated offers.
So we only support client side initiated offers.

Follows session setup and tear down as covered in Figure 1, Section 3
of the specification.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/949>
2022-12-05 11:04:45 +05:30

54 lines
1.5 KiB
Rust

// Copyright (C) 2022, Asymptotic Inc.
// Author: Taruntej Kanakamalla <taruntej@asymptotic.io>
// Author: Sanchayan Maity <sanchayan@asymptotic.io>
//
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at
// <https://mozilla.org/MPL/2.0/>.
//
// SPDX-License-Identifier: MPL-2.0
#![allow(clippy::non_send_fields_in_send_ty, unused_doc_comments)]
/**
* plugin-webrtchttp:
*
* Since: plugins-rs-0.9.0
*/
use gst::glib;
mod whepsrc;
mod whipsink;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)]
#[repr(u32)]
#[enum_type(name = "GstRsWebRTCICETransportPolicy")]
#[non_exhaustive]
pub enum GstRsWebRTCICETransportPolicy {
#[enum_value(name = "All: get both STUN and TURN candidate pairs", nick = "all")]
All = 0,
#[enum_value(name = "Relay: get only TURN candidate pairs", nick = "relay")]
Relay = 1,
}
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
#[cfg(feature = "doc")]
{
GstRsWebRTCICETransportPolicy::static_type()
.mark_as_plugin_api(gst::PluginAPIFlags::empty());
}
whipsink::register(plugin)?;
whepsrc::register(plugin)?;
Ok(())
}
gst::plugin_define!(
webrtchttp,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MPL",
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);