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 two bugs of xwebrtc library #111 #113

Merged
merged 2 commits into from
Apr 3, 2024
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
732 changes: 454 additions & 278 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions application/xiu/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased] - ReleaseDate

## [0.12.6] - 2021-04-03
- Fix bug that the whip stream can not be established successfully #111.
- Fix the issue of not correctly recognizing Opus encoding parameters.
- Fix the issue of not being able to read HTTP resources when pulling streams using the WHEP.

## [0.12.5]
- Support querying more detailed statistic data by adding two new HTTP APIs.
- Fix publishing RTSP stream error caused by network problem. by @bailb
Expand Down
4 changes: 2 additions & 2 deletions confs/online/webrtc.Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xwebrtc"
version = "0.3.2"
version = "0.3.3"
description = "A whip/whep library."
edition = "2021"
authors = ["HarlanC <[email protected]>"]
Expand All @@ -17,7 +17,7 @@ bytes = "1.0.0"
tokio = "1.4.0"
failure = "0.1.8"
log = "0.4"
webrtc = "0.10.1"
webrtc = "0.8.0"
async-trait = "0.1.70"
fdk-aac = "0.6.0"
audiopus = "0.3.0-rc.0"
Expand Down
4 changes: 2 additions & 2 deletions confs/online/xiu.Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "xiu"
description = "A powerful live server by Rust ."
version = "0.12.5"
version = "0.12.6"
authors = ["HarlanC <[email protected]"]
repository = "https://github.com/harlanc/xiu"
license = "MIT"
Expand Down Expand Up @@ -32,7 +32,7 @@ rtmp = "0.6.3"
xrtsp = "0.2.2"
httpflv = "0.4.3"
hls = "0.5.3"
xwebrtc = "0.3.2"
xwebrtc = "0.3.3"
commonlib = "0.1.1"

[features]
Expand Down
5 changes: 5 additions & 0 deletions protocol/webrtc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased] - ReleaseDate

## [0.3.3] - 2021-04-03
- Fix bug that the whip stream can not be established successfully.
- Fix the issue of not correctly recognizing Opus encoding parameters.
- Fix the issue of not being able to read HTTP resources when pulling streams using the WHEP.

## [0.3.2] - 2021-03-15
- Upgrade failure library.
- Some changes for statistics feature.
Expand Down
2 changes: 1 addition & 1 deletion protocol/webrtc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bytes = "1.0.0"
tokio = "1.4.0"
failure = "0.1.8"
log = "0.4"
webrtc = "0.10.1"
webrtc = "0.8.0"
async-trait = "0.1.70"
fdk-aac = "0.6.0"
audiopus = "0.3.0-rc.0"
Expand Down
21 changes: 18 additions & 3 deletions protocol/webrtc/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,27 @@ impl WebRTCServerSession {
let eles: Vec<&str> = http_request.uri.path.splitn(2, '/').collect();
let pars_map = &http_request.query_pairs;

let exe_directory = if let Ok(mut exe_path) = std::env::current_exe() {
exe_path.pop();
exe_path.to_string_lossy().to_string()
} else {
"/app".to_string()
};

let request_method = http_request.method.as_str();
if request_method == http_method_name::GET {
let response = match http_request.uri.path.as_str() {
"/" => Self::gen_file_response("./index.html"),
"/whip.js" => Self::gen_file_response("./whip.js"),
"/whep.js" => Self::gen_file_response("./whep.js"),
"/" => Self::gen_file_response(
format!("{}/{}", exe_directory, "index.html").as_str(),
),
"/whip.js" => {
Self::gen_file_response(format!("{}/{}", exe_directory, "whip.js").as_str())
}

"/whep.js" => {
Self::gen_file_response(format!("{}/{}", exe_directory, "whep.js").as_str())
}

_ => {
log::warn!(
"the http get path: {} is not supported.",
Expand Down
2 changes: 1 addition & 1 deletion protocol/webrtc/src/whip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ pub async fn handle_whip(
if attr.starts_with("rtpmap:") {
if let Ok(codec) = parse_rtpmap(&attr) {
log::info!("codec: {}", codec);
match codec.name.as_str() {
match codec.name.to_uppercase().as_str() {
"H264" => {
video_codec = codec;
}
Expand Down
Loading