Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong typos cause publish error #93

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clusters/local/src/media_hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl LocalMediaHub {
}

pub fn forward(&self, consumer_id: ConsumerId, event: ClusterRemoteTrackIncomingEvent) {
//TODO optimize this by create map beetween consumer_id and track_uuid
//TODO optimize this by create map between consumer_id and track_uuid
for (_, channel) in &self.channels {
if channel.consumers.contains_key(&consumer_id) {
if let Some((track_id, tx)) = &channel.track {
Expand Down
4 changes: 2 additions & 2 deletions packages/cluster/Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cluster intergration interface
# Cluster integration interface

This package define intergration interface for cluster mode, which support multi-servers, multi-zones
This package define integration interface for cluster mode, which support multi-servers, multi-zones

16 changes: 8 additions & 8 deletions packages/endpoint/src/endpoint_wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use media_utils::{EndpointSubscribeScope, Timer};
use transport::{Transport, TransportError};

use crate::{
endpoint_wrap::internal::{MediaEndpointInteralEvent, MediaInternalAction},
endpoint_wrap::internal::{MediaEndpointInternalEvent, MediaInternalAction},
rpc::{EndpointRpcIn, EndpointRpcOut, LocalTrackRpcIn, LocalTrackRpcOut, RemoteTrackRpcIn, RemoteTrackRpcOut},
};

use self::internal::MediaEndpointInteral;
use self::internal::MediaEndpointInternal;

mod internal;
pub use internal::BitrateLimiterType;
Expand All @@ -27,7 +27,7 @@ where
C: ClusterEndpoint,
{
_tmp_e: std::marker::PhantomData<E>,
internal: MediaEndpointInteral,
internal: MediaEndpointInternal,
transport: T,
cluster: C,
tick: async_std::stream::Interval,
Expand All @@ -51,7 +51,7 @@ where
}
Self {
_tmp_e: std::marker::PhantomData,
internal: MediaEndpointInteral::new(room, peer, bitrate_type),
internal: MediaEndpointInternal::new(room, peer, bitrate_type),
transport,
cluster,
tick: async_std::stream::interval(std::time::Duration::from_millis(100)),
Expand All @@ -69,21 +69,21 @@ where
while let Some(out) = self.internal.pop_action() {
match out {
MediaInternalAction::Internal(e) => match e {
MediaEndpointInteralEvent::ConnectionClosed => {
MediaEndpointInternalEvent::ConnectionClosed => {
return Ok(MediaEndpointOutput::ConnectionClosed);
}
MediaEndpointInteralEvent::ConnectionCloseRequest => {
MediaEndpointInternalEvent::ConnectionCloseRequest => {
return Ok(MediaEndpointOutput::ConnectionCloseRequest);
}
MediaEndpointInteralEvent::SubscribePeer(peer) => {
MediaEndpointInternalEvent::SubscribePeer(peer) => {
if matches!(self.sub_scope, EndpointSubscribeScope::RoomManual) {
self.peer_subscribe.insert(peer.clone(), ());
if let Err(_e) = self.cluster.on_event(cluster::ClusterEndpointOutgoingEvent::SubscribePeer(peer)) {
todo!("handle error")
}
}
}
MediaEndpointInteralEvent::UnsubscribePeer(peer) => {
MediaEndpointInternalEvent::UnsubscribePeer(peer) => {
if matches!(self.sub_scope, EndpointSubscribeScope::RoomManual) {
self.peer_subscribe.remove(&peer);
if let Err(_e) = self.cluster.on_event(cluster::ClusterEndpointOutgoingEvent::UnsubscribePeer(peer)) {
Expand Down
40 changes: 20 additions & 20 deletions packages/endpoint/src/endpoint_wrap/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod remote_track;
pub use bitrate_limiter::BitrateLimiterType;

#[derive(Debug, PartialEq, Eq)]
pub enum MediaEndpointInteralEvent {
pub enum MediaEndpointInternalEvent {

Check warning

Code scanning / clippy

variants `SubscribePeer` and `UnsubscribePeer` are never constructed

variants `SubscribePeer` and `UnsubscribePeer` are never constructed
ConnectionClosed,
ConnectionCloseRequest,
SubscribePeer(String),
Expand All @@ -32,12 +32,12 @@ pub enum MediaEndpointInteralEvent {

#[derive(Debug, PartialEq, Eq)]
pub enum MediaInternalAction {
Internal(MediaEndpointInteralEvent),
Internal(MediaEndpointInternalEvent),
Endpoint(TransportOutgoingEvent<EndpointRpcOut, RemoteTrackRpcOut, LocalTrackRpcOut>),
Cluster(ClusterEndpointOutgoingEvent),
}

pub struct MediaEndpointInteral {
pub struct MediaEndpointInternal {
room_id: String,
peer_id: String,
cluster_track_map: HashMap<(String, String), MediaKind>,
Expand All @@ -49,9 +49,9 @@ pub struct MediaEndpointInteral {
bitrate_limiter: bitrate_limiter::BitrateLimiter,
}

impl MediaEndpointInteral {
impl MediaEndpointInternal {

Check warning

Code scanning / clippy

method `push_cluster` is never used

method `push_cluster` is never used
pub fn new(room_id: &str, peer_id: &str, bitrate_limiter: BitrateLimiterType) -> Self {
log::info!("[MediaEndpointInteral {}/{}] create", room_id, peer_id);
log::info!("[MediaEndpointInternal {}/{}] create", room_id, peer_id);
Self {
room_id: room_id.into(),
peer_id: peer_id.into(),
Expand All @@ -73,7 +73,7 @@ impl MediaEndpointInteral {
self.output_actions.push_back(MediaInternalAction::Cluster(event));
}

fn push_internal(&mut self, event: MediaEndpointInteralEvent) {
fn push_internal(&mut self, event: MediaEndpointInternalEvent) {
self.output_actions.push_back(MediaInternalAction::Internal(event));
}

Expand Down Expand Up @@ -122,7 +122,7 @@ impl MediaEndpointInteral {
TransportStateEvent::Reconnecting => {}
TransportStateEvent::Reconnected => {}
TransportStateEvent::Disconnected => {
self.push_internal(MediaEndpointInteralEvent::ConnectionClosed);
self.push_internal(MediaEndpointInternalEvent::ConnectionClosed);
}
}
}
Expand Down Expand Up @@ -244,7 +244,7 @@ impl MediaEndpointInteral {
fn process_rpc(&mut self, rpc: EndpointRpcIn) {
match rpc {
EndpointRpcIn::PeerClose => {
self.push_internal(MediaEndpointInteralEvent::ConnectionCloseRequest);
self.push_internal(MediaEndpointInternalEvent::ConnectionCloseRequest);
}
EndpointRpcIn::SubscribePeer(peer) => {}
EndpointRpcIn::UnsubscribePeer(peer) => {}
Expand Down Expand Up @@ -400,23 +400,23 @@ impl MediaEndpointInteral {
pub fn before_drop(&mut self, now_ms: u64) {
let local_tracks = std::mem::take(&mut self.local_tracks);
for (track_id, mut track) in local_tracks {
log::info!("[MediaEndpointInteral {}/{}] close local track {}", self.room_id, self.peer_id, track_id);
log::info!("[MediaEndpointInternal {}/{}] close local track {}", self.room_id, self.peer_id, track_id);
track.close();
self.pop_local_track_actions(now_ms, track_id, &mut track);
}

let remote_tracks = std::mem::take(&mut self.remote_tracks);
for (track_id, mut track) in remote_tracks {
log::info!("[MediaEndpointInteral {}/{}] close remote track {}", self.room_id, self.peer_id, track_id);
log::info!("[MediaEndpointInternal {}/{}] close remote track {}", self.room_id, self.peer_id, track_id);
track.close();
self.pop_remote_track_actions(track_id, &mut track);
}
}
}

impl Drop for MediaEndpointInteral {
impl Drop for MediaEndpointInternal {
fn drop(&mut self) {
log::info!("[MediaEndpointInteral {}/{}] drop", self.room_id, self.peer_id);
log::info!("[MediaEndpointInternal {}/{}] drop", self.room_id, self.peer_id);
assert!(self.local_tracks.is_empty());
assert!(self.remote_tracks.is_empty());
}
Expand All @@ -430,16 +430,16 @@ mod tests {
};

use crate::{
endpoint_wrap::internal::{bitrate_limiter::BitrateLimiterType, MediaEndpointInteralEvent, MediaInternalAction, DEFAULT_BITRATE_OUT_BPS},
endpoint_wrap::internal::{bitrate_limiter::BitrateLimiterType, MediaEndpointInternalEvent, MediaInternalAction, DEFAULT_BITRATE_OUT_BPS},
rpc::{LocalTrackRpcIn, LocalTrackRpcOut, ReceiverSwitch, RemoteStream, TrackInfo},
EndpointRpcOut, RpcRequest, RpcResponse,
};

use super::MediaEndpointInteral;
use super::MediaEndpointInternal;

#[test]
fn should_fire_cluster_when_remote_track_added_then_close() {
let mut endpoint = MediaEndpointInteral::new("room1", "peer1", BitrateLimiterType::DynamicWithConsumers);
let mut endpoint = MediaEndpointInternal::new("room1", "peer1", BitrateLimiterType::DynamicWithConsumers);

let cluster_track_uuid = generate_cluster_track_uuid("room1", "peer1", "audio_main");
endpoint.on_transport(0, TransportIncomingEvent::RemoteTrackAdded("audio_main".to_string(), 100, TrackMeta::new_audio(None)));
Expand Down Expand Up @@ -483,7 +483,7 @@ mod tests {

#[test]
fn should_fire_cluster_when_remote_track_added_then_removed() {
let mut endpoint = MediaEndpointInteral::new("room1", "peer1", BitrateLimiterType::DynamicWithConsumers);
let mut endpoint = MediaEndpointInternal::new("room1", "peer1", BitrateLimiterType::DynamicWithConsumers);

let cluster_track_uuid = generate_cluster_track_uuid("room1", "peer1", "audio_main");
endpoint.on_transport(0, TransportIncomingEvent::RemoteTrackAdded("audio_main".to_string(), 100, TrackMeta::new_audio(None)));
Expand Down Expand Up @@ -526,7 +526,7 @@ mod tests {

#[test]
fn should_fire_rpc_when_cluster_track_added() {
let mut endpoint = MediaEndpointInteral::new("room1", "peer1", BitrateLimiterType::DynamicWithConsumers);
let mut endpoint = MediaEndpointInternal::new("room1", "peer1", BitrateLimiterType::DynamicWithConsumers);

endpoint.on_cluster(
0,
Expand Down Expand Up @@ -558,18 +558,18 @@ mod tests {

#[test]
fn should_fire_disconnect_when_transport_disconnect() {
let mut endpoint = MediaEndpointInteral::new("room1", "peer1", BitrateLimiterType::DynamicWithConsumers);
let mut endpoint = MediaEndpointInternal::new("room1", "peer1", BitrateLimiterType::DynamicWithConsumers);

endpoint.on_transport(0, TransportIncomingEvent::State(TransportStateEvent::Disconnected));

// should output internal event
assert_eq!(endpoint.pop_action(), Some(MediaInternalAction::Internal(MediaEndpointInteralEvent::ConnectionClosed)));
assert_eq!(endpoint.pop_action(), Some(MediaInternalAction::Internal(MediaEndpointInternalEvent::ConnectionClosed)));
assert_eq!(endpoint.pop_action(), None);
}

#[test]
fn should_fire_answer_rpc() {
let mut endpoint = MediaEndpointInteral::new("room1", "peer1", BitrateLimiterType::DynamicWithConsumers);
let mut endpoint = MediaEndpointInternal::new("room1", "peer1", BitrateLimiterType::DynamicWithConsumers);

endpoint.on_transport(0, TransportIncomingEvent::LocalTrackAdded("video_0".to_string(), 1, TrackMeta::new_video(None)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ mod test {
Input::SetTarget(spatial, temporal, key_only, need_key) => {
assert_eq!(filter.set_target_layer(spatial, temporal, key_only), need_key, "index: {}", index);
}
Input::Packet(is_key, spatial, temporal, pic_id, tl01, layer_sync, seq, time, (result, swiched, exp_pic_id, exp_tl01)) => {
Input::Packet(is_key, spatial, temporal, pic_id, tl01, layer_sync, seq, time, (result, switched, exp_pic_id, exp_tl01)) => {
let mut pkt = MediaPacket::simple_video(
PayloadCodec::Vp8(
is_key,
Expand All @@ -189,7 +189,7 @@ mod test {
vec![1, 2, 3],
);
let res = filter.should_send(&mut pkt);
assert_eq!(res, (result, swiched), "index: {}", index);
assert_eq!(res, (result, switched), "index: {}", index);
if matches!(res.0, FilterResult::Send) {
match &pkt.codec {
PayloadCodec::Vp8(_, Some(sim)) => {
Expand Down Expand Up @@ -238,7 +238,7 @@ mod test {
}

#[test]
fn rewrite_pic_id_tl01_spatial_switch_stream_remain_continuos() {
fn rewrite_pic_id_tl01_spatial_switch_stream_remain_continuous() {
test(vec![
Input::SetTarget(0, 1, false, true),
Input::Packet(false, 0, 0, Some(1), Some(1), false, 0, 100, (FilterResult::Reject, false, None, None)),
Expand Down
2 changes: 1 addition & 1 deletion servers/media/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update Rust crate clap to 4.4.8 ([#53](https://github.com/8xFF/atm0s-media-server/pull/53))
- Update Rust crate clap to 4.4.7 ([#23](https://github.com/8xFF/atm0s-media-server/pull/23))
- simple rtmp server with SAN I/O style ([#40](https://github.com/8xFF/atm0s-media-server/pull/40))
- 17 intergrate with bluesea sdn v4 ([#18](https://github.com/8xFF/atm0s-media-server/pull/18))
- 17 integrate with bluesea sdn v4 ([#18](https://github.com/8xFF/atm0s-media-server/pull/18))
- cargo fmt
- break between media-server and transports ([#12](https://github.com/8xFF/atm0s-media-server/pull/12))
2 changes: 1 addition & 1 deletion servers/media/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ media-utils = { workspace = true }
async-std = { workspace = true }
parking_lot = { workspace = true }
futures = { workspace = true }
log = { workpsace = true }
log = { workspace = true }
poem = { version = "1.3", features = ["embed"] }
poem-openapi = { version = "3.0", features = ["swagger-ui", "static-files"] }
serde = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion servers/media/public/whep/whep.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class WHEPClient extends EventTarget
//Get current config
const config = pc.getConfiguration();

//If it has ice server info and it is not overriden by the client
//If it has ice server info and it is not overridden by the client
if ((!config.iceServer || !config.iceServer.length) && links.hasOwnProperty("ice-server"))
{
//ICe server config
Expand Down
2 changes: 1 addition & 1 deletion servers/media/public/whip/whip.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class WHIPClient
//Get current config
const config = pc.getConfiguration();

//If it has ice server info and it is not overriden by the client
//If it has ice server info and it is not overridden by the client
if ((!config.iceServer || !config.iceServer.length) && links.hasOwnProperty("ice-server"))
{
//ICe server config
Expand Down
2 changes: 1 addition & 1 deletion servers/media/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async fn main() {
let mut server = MediaServer::<C, CR>::new(cluster);

while let Ok(event) = rx.recv().await {
server.on_incomming(event).await;
server.on_incoming(event).await;
}
}

Expand Down
6 changes: 3 additions & 3 deletions servers/media/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ where
}
}

pub async fn on_incomming(&mut self, event: RpcEvent) {
pub async fn on_incoming(&mut self, event: RpcEvent) {
let peers = self.peers.clone();
let conns = self.conns.clone();

Expand Down Expand Up @@ -132,7 +132,7 @@ where
}
});
} else {
res.answer(404, Err(ServerError::build("NOT_FOUND", "Connnection not found")));
res.answer(404, Err(ServerError::build("NOT_FOUND", "Connection not found")));
}
}
RpcEvent::WhepConnect(token, sdp, mut res) => {
Expand Down Expand Up @@ -187,7 +187,7 @@ where
}
});
} else {
res.answer(404, Err(ServerError::build("NOT_FOUND", "Connnection not found")));
res.answer(404, Err(ServerError::build("NOT_FOUND", "Connection not found")));
}
}
RpcEvent::WebrtcConnect(req, mut res) => {
Expand Down
2 changes: 1 addition & 1 deletion servers/sip-gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ media-utils = { workspace = true }
async-std = { workspace = true }
parking_lot = { workspace = true }
futures = { workspace = true }
log = { workpsace = true }
log = { workspace = true }
poem = "1.3"
poem-openapi = { version = "3.0", features = ["swagger-ui"] }
env_logger = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion transports/sip/src/SIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Process request in order: authentication -> method -> header -> others

For authentication, read rfc for more info.

If not support -> Must generate 405 response with allow types in Alow header (how to generate response in https://www.rfceditor.org/rfc/rfc3261.html#section-8.2.6)
If not support -> Must generate 405 response with allow types in Allow header (how to generate response in https://www.rfceditor.org/rfc/rfc3261.html#section-8.2.6)

If support -> continue

Expand Down
4 changes: 2 additions & 2 deletions transports/sip/src/sip/processor/call_in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ mod test {
assert_eq!(res.raw.status_code, rsip::StatusCode::Trying);
assert_eq!(processor.pop_action(), None);

//after call ringing shoudl send Ringing
//after call ringing should send Ringing
processor.ringing(T1 + 1000).expect("Should ok");
let (_, res) = cast2!(processor.pop_action().expect("Should have action"), ProcessorAction::SendResponse);
assert_eq!(res.raw.status_code, rsip::StatusCode::Ringing);
Expand Down Expand Up @@ -360,7 +360,7 @@ mod test {
assert_eq!(res.raw.status_code, rsip::StatusCode::Trying);
assert_eq!(processor.pop_action(), None);

//after call ringing shoudl send Ringing
//after call ringing should send Ringing
processor.ringing(T1 + 1000).expect("Should ok");
let (_, res) = cast2!(processor.pop_action().expect("Should have action"), ProcessorAction::SendResponse);
assert_eq!(res.raw.status_code, rsip::StatusCode::Ringing);
Expand Down
4 changes: 2 additions & 2 deletions transports/webrtc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- update few simple unit tests ([#60](https://github.com/8xFF/atm0s-media-server/pull/60))
- Bump criterion from 0.4.0 to 0.5.1 ([#28](https://github.com/8xFF/atm0s-media-server/pull/28))
- Bump lz4_flex from 0.9.5 to 0.11.1 ([#27](https://github.com/8xFF/atm0s-media-server/pull/27))
- Update Rust crate flate2 to 1.0.28 ([#22](https://github.com/8xFF/atm0s-media-server/pull/22))
- Update Rust crate flat2 to 1.0.28 ([#22](https://github.com/8xFF/atm0s-media-server/pull/22))
- update with newest sdn ([#21](https://github.com/8xFF/atm0s-media-server/pull/21))
- 17 intergrate with bluesea sdn v4 ([#18](https://github.com/8xFF/atm0s-media-server/pull/18))
- 17 integrate with bluesea sdn v4 ([#18](https://github.com/8xFF/atm0s-media-server/pull/18))
- cargo fmt
- dynamic payload type from remote ([#16](https://github.com/8xFF/atm0s-media-server/pull/16))
- update udp_sas for fixing unstable ([#14](https://github.com/8xFF/atm0s-media-server/pull/14))
Expand Down
2 changes: 1 addition & 1 deletion transports/webrtc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ media-utils = { workspace = true }
poem-openapi = { version = "3.0", features = ["swagger-ui"] }
str0m = { version = "0.1.0", package = "atm0s-custom-str0m" }
futures = { workspace = true }
log = { workpsace = true }
log = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
lz4_flex = { version = "0.11.1" }
Expand Down
2 changes: 1 addition & 1 deletion transports/webrtc/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ where
)
}
Ok(Err(e)) => {
log::error!("[TransportWebrtc] network eror {:?}", e);
log::error!("[TransportWebrtc] network error {:?}", e);
return Err(TransportError::NetworkError);
}
Err(_e) => {
Expand Down
Loading