Skip to content

Commit

Permalink
add whipinto/whepfrom audio support (#224)
Browse files Browse the repository at this point in the history
Completed by the way #140


* add:whipinto/whepfrom audio support

* add whipinto/whepfrom audio support

* fix cargo fmt

* fix cargo fmt

* Remove redundant test file

* fix whipinto single video/audio error

* delete useless files

* add whipinto/whepfrom aduio rtcp



Co-authored-by: Marsyew <[email protected]>
  • Loading branch information
Marsyew and Marsyew authored Oct 1, 2024
1 parent 6e486c0 commit 3dae7cc
Show file tree
Hide file tree
Showing 9 changed files with 900 additions and 386 deletions.
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions libs/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
sync::Mutex,
};

use anyhow::Result;
use anyhow::{anyhow, Result};
use clap::ValueEnum;
use webrtc::{
api::media_engine::*,
Expand All @@ -13,7 +13,7 @@ use webrtc::{
},
};

#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
#[derive(Copy, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
pub enum Codec {
Vp8,
Vp9,
Expand Down Expand Up @@ -108,6 +108,18 @@ impl From<Codec> for RTCRtpCodecCapability {
}
}

pub fn codec_from_str(s: &str) -> Result<Codec> {
match s.to_uppercase().as_str() {
"VP8" => Ok(Codec::Vp8),
"VP9" => Ok(Codec::Vp9),
"H264" => Ok(Codec::H264),
"AV1" => Ok(Codec::AV1),
"OPUS" => Ok(Codec::Opus),
"G722" => Ok(Codec::G722),
_ => Err(anyhow!("Unknown codec: {}", s)),
}
}

pub fn get_codec_type(codec: &RTCRtpCodecCapability) -> RTPCodecType {
let mime_type = &codec.mime_type;
if mime_type.starts_with("video") {
Expand Down
3 changes: 3 additions & 0 deletions libs/rtsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ crate-type = ["lib"]

[dependencies]
anyhow = { workspace = true }
tracing = { workspace = true }

rtsp-types = "0.1.1"
sdp = "0.6"
tokio = "1.37"
sdp-types = "0.1.6"
portpicker = "0.1.1"
cli = { path = "../cli" }
webrtc = { workspace = true }
Loading

0 comments on commit 3dae7cc

Please sign in to comment.