Skip to content

Commit

Permalink
Merge pull request #28 from oddity-ai/add/ci-initial
Browse files Browse the repository at this point in the history
updated ci and some cleaning up here and there
  • Loading branch information
gerwin3 authored Jan 3, 2024
2 parents bdc4566 + 0298635 commit 2748000
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 19 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: ci

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always

jobs:

test:
runs-on: ubuntu-latest
container: jrottenberg/ffmpeg:6-ubuntu

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
apt update
apt install -y --no-install-recommends clang curl pkg-config
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable

- name: Test
run: cargo test --workspace --all-features --release

lint:
runs-on: ubuntu-latest
container: jrottenberg/ffmpeg:6-ubuntu

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
apt update
apt install -y --no-install-recommends clang curl pkg-config
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy

- name: Rustfmt
run: cargo fmt --all -- --check

- name: Clippy
run: |
cargo clippy --tests --examples --all --all-features -- -D warnings
12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[workspace]
resolver = "2"
members = [
"oddity-rtsp-protocol",
"oddity-rtsp-server",
"oddity-sdp-protocol"
]
members = ["oddity-rtsp-protocol", "oddity-rtsp-server", "oddity-sdp-protocol"]

[workspace.dependencies]
oddity-rtsp-protocol = { path = "oddity-rtsp-protocol" }
oddity-rtsp-server = { path = "oddity-rtsp-server" }
oddity-sdp-protocol = { path = "oddity-sdp-protocol" }
video-rs = { version = "0.5.0" }
9 changes: 6 additions & 3 deletions oddity-rtsp-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ license = "MIT OR Apache-2.0"
edition = "2021"

[dependencies]
http = "0.2"
http = "1.0"
bytes = { version = "1" }
tokio-util = { version = "0.7", default-features = false, features = ["codec"], optional = true }
tokio-util = { version = "0.7", default-features = false, features = [
"codec",
], optional = true }

[features]
default = ["tokio-codec"]
tokio-codec = ["tokio-util"]
tokio-codec = ["tokio-util"]

19 changes: 11 additions & 8 deletions oddity-rtsp-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ license = "MIT OR Apache-2.0"
edition = "2021"

[dependencies]
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
serde = { version = "1.0", features = ["derive"] }
config = { version = "0.13", default-features = false, features = ["yaml"] }
rand = "0.8"
futures = "0.3"
oddity-rtsp-protocol = { workspace = true, features = ["tokio-codec"] }
oddity-sdp-protocol = { workspace = true }
rand = "0.8"
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
tokio-stream = { version = "0.1" }
tokio-util = { version = "0.7.1", default-features = false, features = ["codec"] }
video-rs = "0.2.4"
oddity-rtsp-protocol = { path = "../oddity-rtsp-protocol", features = ["tokio-codec"] }
oddity-sdp-protocol = { path = "../oddity-sdp-protocol" }
tokio-util = { version = "0.7.1", default-features = false, features = [
"codec",
] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
video-rs = { workspace = true }

3 changes: 2 additions & 1 deletion oddity-sdp-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ license = "MIT OR Apache-2.0"
edition = "2021"

[dependencies]
base64 = "0.13"
base64 = "0.21"

9 changes: 7 additions & 2 deletions oddity-sdp-protocol/src/codec.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::fmt::Write;

use base64::engine::Engine;

pub use super::{fmt::FMT_RTP_PAYLOAD_DYNAMIC, Tag};

pub trait MediaAttributes {
Expand Down Expand Up @@ -58,8 +60,11 @@ fn h264_fmtp(packetization_mode: usize, sps: &[u8], pps: &[&[u8]]) -> Tag {
});

let mut parameter_sets = Vec::with_capacity(1 + pps.len());
parameter_sets.push(base64::encode(sps));
parameter_sets.extend(pps.iter().map(base64::encode));
parameter_sets.push(base64::engine::general_purpose::STANDARD.encode(sps));
parameter_sets.extend(
pps.iter()
.map(|pps| base64::engine::general_purpose::STANDARD.encode(pps)),
);
let sprop_parameter_sets = parameter_sets.join(",");

Tag::Value(
Expand Down

0 comments on commit 2748000

Please sign in to comment.