Skip to content

Commit

Permalink
refactor configs and handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
yngrtc committed Mar 8, 2024
1 parent a2a9115 commit 82c0219
Show file tree
Hide file tree
Showing 20 changed files with 17 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/description/config.rs → src/configs/media_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ use crate::description::{
RTPCodecType,
},
rtp_extensions_from_media_description,
rtp_transceiver::TYPE_RTCP_FB_TRANSPORT_CC,
rtp_transceiver::{PayloadType, RTCPFeedback, TYPE_RTCP_FB_TRANSPORT_CC},
rtp_transceiver_direction::RTCRtpTransceiverDirection,
PayloadType, RTCPFeedback,
};

//TODO: use crate::stats::stats_collector::StatsCollector;
Expand Down
3 changes: 3 additions & 0 deletions src/configs/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub(crate) mod media_config;
pub(crate) mod server_config;
pub(crate) mod session_config;
2 changes: 1 addition & 1 deletion src/server/config.rs → src/configs/server_config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::description::config::MediaConfig;
use crate::configs::media_config::MediaConfig;
use crate::server::certificate::RTCCertificate;
use std::sync::Arc;
use std::time::Duration;
Expand Down
2 changes: 1 addition & 1 deletion src/session/config.rs → src/configs/session_config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::server::config::ServerConfig;
use crate::configs::server_config::ServerConfig;
use std::net::SocketAddr;
use std::sync::Arc;

Expand Down
3 changes: 1 addition & 2 deletions src/description/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pub(crate) mod config;
pub(crate) mod fmtp;
pub(crate) mod rtp_codec;
pub(crate) mod rtp_transceiver;
pub(crate) mod rtp_transceiver_direction;
pub(crate) mod sdp_type;

use crate::configs::session_config::SessionConfig;
use crate::description::{
rtp_codec::{RTCRtpCodecCapability, RTCRtpCodecParameters, RTCRtpHeaderExtensionParameters},
rtp_transceiver::{
Expand All @@ -15,7 +15,6 @@ use crate::description::{
};
use crate::endpoint::candidate::RTCIceParameters;
use crate::server::certificate::RTCDtlsFingerprint;
use crate::session::config::SessionConfig;
use crate::types::Mid;
use sdp::description::common::{Address, ConnectionInformation};
use sdp::description::media::{MediaName, RangedPort};
Expand Down
2 changes: 1 addition & 1 deletion src/description/rtp_codec.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::configs::media_config::*;
use crate::description::{
config::*,
fmtp,
rtp_transceiver::{PayloadType, RTCPFeedback},
};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#![warn(rust_2018_idioms)]
#![allow(dead_code)]

pub(crate) mod configs;
pub(crate) mod description;
pub(crate) mod endpoint;
pub(crate) mod handler;
pub(crate) mod handlers;
pub(crate) mod interceptor;
pub(crate) mod messages;
pub(crate) mod metrics;
pub(crate) mod server;
pub(crate) mod session;
pub(crate) mod types;

pub use configs::{media_config::MediaConfig, server_config::ServerConfig};
pub use description::RTCSessionDescription;
pub use handler::{
pub use handlers::{
datachannel::DataChannelHandler, demuxer::DemuxerHandler, dtls::DtlsHandler,
exception::ExceptionHandler, gateway::GatewayHandler, interceptor::InterceptorHandler,
sctp::SctpHandler, srtp::SrtpHandler, stun::StunHandler,
};
pub use server::{certificate::RTCCertificate, config::ServerConfig, states::ServerStates};
pub use server::{certificate::RTCCertificate, states::ServerStates};
1 change: 0 additions & 1 deletion src/server/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub(crate) mod certificate;
pub(crate) mod config;
pub(crate) mod states;
5 changes: 3 additions & 2 deletions src/server/states.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use crate::configs::server_config::ServerConfig;
use crate::configs::session_config::SessionConfig;
use crate::description::RTCSessionDescription;
use crate::endpoint::{
candidate::{Candidate, ConnectionCredentials},
transport::Transport,
Endpoint,
};
use crate::metrics::Metrics;
use crate::server::config::ServerConfig;
use crate::session::{config::SessionConfig, Session};
use crate::session::Session;
use crate::types::{EndpointId, FourTuple, SessionId, UserName};
use log::{debug, info};
use opentelemetry::metrics::Meter;
Expand Down
4 changes: 1 addition & 3 deletions src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use shared::error::{Error, Result};
use std::collections::{HashMap, HashSet};
use std::rc::Rc;

pub(crate) mod config;

use crate::configs::session_config::SessionConfig;
use crate::description::{
codecs_from_media_description, get_cname, get_mid_value, get_msid, get_peer_direction,
get_rids, get_ssrc_groups, get_ssrcs, populate_sdp, rtp_extensions_from_media_description,
Expand All @@ -24,7 +23,6 @@ use crate::endpoint::{
transport::Transport,
Endpoint,
};
use crate::session::config::SessionConfig;
use crate::types::{EndpointId, Mid, SessionId};

pub(crate) struct Session {
Expand Down

0 comments on commit 82c0219

Please sign in to comment.