Skip to content

Commit

Permalink
Merge branch 'master' into WHIP-server
Browse files Browse the repository at this point in the history
  • Loading branch information
wkazmierczak committed Dec 12, 2024
2 parents 44f5914 + 97405df commit 8c46d9d
Show file tree
Hide file tree
Showing 40 changed files with 1,226 additions and 738 deletions.
62 changes: 48 additions & 14 deletions .github/workflows/package_for_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: live_compositor_linux_x86_64.tar.gz
path: live_compositor_linux_x86_64.tar.gz
name: smelter_linux_x86_64.tar.gz
path: smelter_linux_x86_64.tar.gz

- uses: actions/upload-artifact@v4
with:
name: live_compositor_with_web_renderer_linux_x86_64.tar.gz
path: live_compositor_with_web_renderer_linux_x86_64.tar.gz
name: smelter_with_web_renderer_linux_x86_64.tar.gz
path: smelter_with_web_renderer_linux_x86_64.tar.gz

linux-aarch64:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -75,8 +75,8 @@ jobs:
cp *.tar.gz /artifacts
- uses: actions/upload-artifact@v4
with:
name: live_compositor_linux_aarch64.tar.gz
path: artifacts/live_compositor_linux_aarch64.tar.gz
name: smelter_linux_aarch64.tar.gz
path: artifacts/smelter_linux_aarch64.tar.gz

macos_x86_64:
runs-on: macos-12
Expand All @@ -95,13 +95,13 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: live_compositor_darwin_x86_64.tar.gz
path: live_compositor_darwin_x86_64.tar.gz
name: smelter_darwin_x86_64.tar.gz
path: smelter_darwin_x86_64.tar.gz

- uses: actions/upload-artifact@v4
with:
name: live_compositor_with_web_renderer_darwin_x86_64.tar.gz
path: live_compositor_with_web_renderer_darwin_x86_64.tar.gz
name: smelter_with_web_renderer_darwin_x86_64.tar.gz
path: smelter_with_web_renderer_darwin_x86_64.tar.gz

macos-aarch64:
runs-on: macos-14
Expand All @@ -120,10 +120,44 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: live_compositor_darwin_aarch64.tar.gz
path: live_compositor_darwin_aarch64.tar.gz
name: smelter_darwin_aarch64.tar.gz
path: smelter_darwin_aarch64.tar.gz

- uses: actions/upload-artifact@v4
with:
name: live_compositor_with_web_renderer_darwin_aarch64.tar.gz
path: live_compositor_with_web_renderer_darwin_aarch64.tar.gz
name: smelter_with_web_renderer_darwin_aarch64.tar.gz
path: smelter_with_web_renderer_darwin_aarch64.tar.gz

docker:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repo
uses: actions/checkout@v4

- name: 🛠️ Setup Docker
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: 🔨 Build Smelter image
run: |
docker buildx build --platform linux/amd64 -t ghcr.io/software-mansion/smelter:${{ github.sha }} -f build_tools/docker/slim.Dockerfile .
- name: 📤 Upload image
run: docker push ghcr.io/software-mansion/smelter:${{ github.sha }}

docker-with-web-renderer:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repo
uses: actions/checkout@v4

- name: 🛠️ Setup Docker
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: 🔨 Build Smelter with Web Renderer image
run: |
docker buildx build --platform linux/amd64 -t ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer -f build_tools/docker/full.Dockerfile .
- name: 📤 Upload image
run: docker push ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer
26 changes: 14 additions & 12 deletions build_tools/docker/full.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:noble-20240423 as builder

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG USERNAME=compositor
ARG USERNAME=smelter
ARG RUST_VERSION=1.81

ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -27,17 +27,19 @@ RUN source ~/.cargo/env && cargo build --release
# Runtime image
FROM ubuntu:noble-20240423

LABEL org.opencontainers.image.source https://github.com/software-mansion/smelter

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG USERNAME=compositor
ARG USERNAME=smelter

ENV DEBIAN_FRONTEND=noninteractive
ENV NVIDIA_DRIVER_CAPABILITIES=compute,graphics,utility

ENV LIVE_COMPOSITOR_MAIN_EXECUTABLE_PATH=/home/$USERNAME/live_compositor/main_process
ENV LIVE_COMPOSITOR_PROCESS_HELPER_PATH=/home/$USERNAME/live_compositor/process_helper
ENV LD_LIBRARY_PATH=/home/$USERNAME/live_compositor/lib
ENV XDG_RUNTIME_DIR=/home/$USERNAME/live_compositor/xdg_runtime
ENV LIVE_COMPOSITOR_MAIN_EXECUTABLE_PATH=/home/$USERNAME/smelter/main_process
ENV LIVE_COMPOSITOR_PROCESS_HELPER_PATH=/home/$USERNAME/smelter/process_helper
ENV LD_LIBRARY_PATH=/home/$USERNAME/smelter/lib
ENV XDG_RUNTIME_DIR=/home/$USERNAME/smelter/xdg_runtime

RUN apt-get update -y -qq && \
apt-get install -y \
Expand All @@ -48,12 +50,12 @@ RUN apt-get update -y -qq && \
RUN useradd -ms /bin/bash $USERNAME && adduser $USERNAME sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER $USERNAME
RUN mkdir -p /home/$USERNAME/live_compositor/xdg_runtime
WORKDIR /home/$USERNAME/live_compositor
RUN mkdir -p /home/$USERNAME/smelter/xdg_runtime
WORKDIR /home/$USERNAME/smelter

COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/target/release/main_process /home/$USERNAME/live_compositor/main_process
COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/target/release/process_helper /home/$USERNAME/live_compositor/process_helper
COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/target/release/lib /home/$USERNAME/live_compositor/lib
COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/docker/entrypoint.sh /home/$USERNAME/live_compositor/entrypoint.sh
COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/target/release/main_process /home/$USERNAME/smelter/main_process
COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/target/release/process_helper /home/$USERNAME/smelter/process_helper
COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/target/release/lib /home/$USERNAME/smelter/lib
COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/docker/entrypoint.sh /home/$USERNAME/smelter/entrypoint.sh

ENTRYPOINT ["./entrypoint.sh"]
14 changes: 8 additions & 6 deletions build_tools/docker/slim.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:noble-20240423 as builder

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG USERNAME=compositor
ARG USERNAME=smelter
ARG RUST_VERSION=1.81

ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -26,9 +26,11 @@ RUN source ~/.cargo/env && cargo build --release --no-default-features
# Runtime image
FROM ubuntu:noble-20240423

LABEL org.opencontainers.image.source https://github.com/software-mansion/smelter

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG USERNAME=compositor
ARG USERNAME=smelter

ENV DEBIAN_FRONTEND=noninteractive
ENV NVIDIA_DRIVER_CAPABILITIES=compute,graphics,utility
Expand All @@ -41,12 +43,12 @@ RUN apt-get update -y -qq && \
RUN useradd -ms /bin/bash $USERNAME && adduser $USERNAME sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER $USERNAME
RUN mkdir -p /home/$USERNAME/live_compositor
WORKDIR /home/$USERNAME/live_compositor
RUN mkdir -p /home/$USERNAME/smelter
WORKDIR /home/$USERNAME/smelter

COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/target/release/main_process /home/$USERNAME/live_compositor/main_process
COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/target/release/main_process /home/$USERNAME/smelter/main_process

ENV LIVE_COMPOSITOR_WEB_RENDERER_ENABLE=0
ENV LIVE_COMPOSITOR_WEB_RENDERER_GPU_ENABLE=0

ENTRYPOINT ["/home/compositor/live_compositor/main_process"]
ENTRYPOINT ["/home/smelter/smelter/main_process"]
11 changes: 9 additions & 2 deletions compositor_pipeline/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,20 @@ pub struct Options {
pub force_gpu: bool,
pub download_root: PathBuf,
pub output_sample_rate: u32,
pub stun_servers: Arc<Vec<String>>,
pub wgpu_features: WgpuFeatures,
pub load_system_fonts: Option<bool>,
pub wgpu_ctx: Option<GraphicsContext>,
pub whip_whep_server_port: u16,
pub start_whip_whep: bool,
pub tokio_rt: Arc<Runtime>,
pub tokio_rt: Option<Arc<Runtime>>,
}

#[derive(Clone)]
pub struct PipelineCtx {
pub output_sample_rate: u32,
pub output_framerate: Framerate,
pub stun_servers: Arc<Vec<String>>,
pub download_dir: Arc<PathBuf>,
pub event_emitter: Arc<EventEmitter>,
pub whip_whep_state: Arc<WhipWhepState>,
Expand Down Expand Up @@ -193,6 +195,10 @@ impl Pipeline {
.join(format!("live-compositor-{}", rand::random::<u64>()));
std::fs::create_dir_all(&download_dir).map_err(InitPipelineError::CreateDownloadDir)?;

let tokio_rt = match opts.tokio_rt {
Some(tokio_rt) => tokio_rt,
None => Arc::new(Runtime::new().map_err(InitPipelineError::CreateTokioRuntime)?),
};
let event_emitter = Arc::new(EventEmitter::new());
let pipeline = Pipeline {
outputs: HashMap::new(),
Expand All @@ -204,12 +210,13 @@ impl Pipeline {
ctx: PipelineCtx {
output_sample_rate: opts.output_sample_rate,
output_framerate: opts.queue_options.output_framerate,
stun_servers: opts.stun_servers,
download_dir: download_dir.into(),
event_emitter,
tokio_rt,
whip_whep_state: WhipWhepState::new(),
whip_whep_server_port: opts.whip_whep_server_port,
start_whip_whep: opts.start_whip_whep,
tokio_rt: opts.tokio_rt,
#[cfg(feature = "vk-video")]
vulkan_ctx: preinitialized_ctx.and_then(|ctx| ctx.vulkan_ctx),
},
Expand Down
15 changes: 13 additions & 2 deletions compositor_pipeline/src/pipeline/input.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::time::Duration;

use crate::{
error::{InputInitError, RegisterInputError},
queue::PipelineEvent,
Expand Down Expand Up @@ -50,8 +52,17 @@ pub struct RawDataInputOptions {
}

pub enum InputInitInfo {
Port(Option<Port>),
BearerToken(String),
Rtp {
port: Option<Port>,
},
Mp4 {
video_duration: Option<Duration>,
audio_duration: Option<Duration>,
},
Whip {
bearer_token: String,
},
Other,
}

struct InputInitResult {
Expand Down
2 changes: 1 addition & 1 deletion compositor_pipeline/src/pipeline/input/decklink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl DeckLink {
sample_receiver: rec,
sample_rate: AUDIO_SAMPLE_RATE,
}),
init_info: InputInitInfo::Port(None),
init_info: InputInitInfo::Other,
})
}
}
Expand Down
Loading

0 comments on commit 8c46d9d

Please sign in to comment.