Skip to content

Commit

Permalink
Fix errors surfaced by the new lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jerzywilczek committed Oct 14, 2024
1 parent 3667778 commit ef12d0d
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 64 deletions.
6 changes: 2 additions & 4 deletions compositor_pipeline/src/pipeline/graphics_context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::error::InitPipelineError;
use compositor_render::{create_wgpu_ctx, error::InitRendererEngineError};
use std::sync::Arc;

#[derive(Debug)]
Expand All @@ -17,10 +18,7 @@ impl GraphicsContext {
features: wgpu::Features,
limits: wgpu::Limits,
) -> Result<Self, InitPipelineError> {
use compositor_render::{
create_wgpu_ctx, error::InitRendererEngineError, required_wgpu_features,
set_required_wgpu_limits,
};
use compositor_render::{required_wgpu_features, set_required_wgpu_limits};
use tracing::warn;

let vulkan_features =
Expand Down
9 changes: 8 additions & 1 deletion compositor_pipeline/src/pipeline/input/rtp/depayloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ pub enum VideoDepayloader {
impl VideoDepayloader {
pub fn new(options: &decoder::VideoDecoderOptions) -> Self {
match options.decoder {
VideoDecoder::FFmpegH264 | VideoDecoder::VulkanVideoH264 => VideoDepayloader::H264 {
VideoDecoder::FFmpegH264 => VideoDepayloader::H264 {
depayloader: H264Packet::default(),
buffer: vec![],
rollover_state: RolloverState::default(),
},

#[cfg(feature = "vk-video")]
VideoDecoder::VulkanVideoH264 => VideoDepayloader::H264 {
depayloader: H264Packet::default(),
buffer: vec![],
rollover_state: RolloverState::default(),
Expand Down
12 changes: 6 additions & 6 deletions integration_tests/examples/manual_graphics_initialization.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use compositor_pipeline::{
pipeline::{GraphicsContext, Options},
Pipeline,
};
use live_compositor::config::read_config;

// This example illustrates how to initialize a GraphicsContext separately to get access to a wgpu
// instance, adapter, queue and device.

#[cfg(target_os = "linux")]
fn main() {
use compositor_pipeline::{
pipeline::{GraphicsContext, Options},
Pipeline,
};
use live_compositor::config::read_config;

let graphics_context =
GraphicsContext::new(false, wgpu::Features::default(), wgpu::Limits::default()).unwrap();

Expand Down
114 changes: 61 additions & 53 deletions integration_tests/examples/vulkan.rs
Original file line number Diff line number Diff line change
@@ -1,60 +1,9 @@
use anyhow::Result;
use compositor_api::types::Resolution;
use compositor_pipeline::{
pipeline::{
decoder::VideoDecoderOptions,
encoder::{
ffmpeg_h264::{EncoderPreset, Options as H264Options},
VideoEncoderOptions,
},
input::{
rtp::{InputVideoStream, RtpReceiverOptions, RtpStream},
InputOptions,
},
output::{
rtp::{RtpConnectionOptions, RtpSenderOptions},
OutputOptions, OutputProtocolOptions,
},
rtp::{RequestedPort, TransportProtocol},
Options, OutputVideoOptions, PipelineOutputEndCondition, Port, RegisterInputOptions,
RegisterOutputOptions, VideoCodec, VideoDecoder,
},
queue::QueueInputOptions,
Pipeline,
};
use compositor_render::{
error::ErrorStack,
scene::{
Component, ComponentId, HorizontalAlign, InputStreamComponent, RGBAColor, TilesComponent,
VerticalAlign,
},
InputId, OutputId,
};
use integration_tests::examples::download_all_assets;
use live_compositor::{
config::{read_config, LoggerConfig, LoggerFormat},
config::{LoggerConfig, LoggerFormat},
logger::{self, FfmpegLogLevel},
};
use signal_hook::{consts, iterator::Signals};
use std::{
sync::{Arc, Mutex},
time::Duration,
};

use integration_tests::{
examples::{download_all_assets, TestSample},
ffmpeg::{start_ffmpeg_receive, start_ffmpeg_send},
};

const VIDEO_RESOLUTION: Resolution = Resolution {
width: 1280,
height: 720,
};

const IP: &str = "127.0.0.1";
const INPUT_PORT: u16 = 8002;
const OUTPUT_PORT: u16 = 8004;

const VIDEOS: u16 = 6;

fn main() {
ffmpeg_next::format::network::init();
Expand All @@ -69,7 +18,66 @@ fn main() {
client_code().unwrap();
}

#[cfg(target_os = "macos")]
fn client_code() -> Result<()> {
panic!("Your OS does not support vulkan");
}

#[cfg(target_os = "linux")]
fn client_code() -> Result<()> {
use compositor_api::types::Resolution;
use compositor_pipeline::{
pipeline::{
decoder::VideoDecoderOptions,
encoder::{
ffmpeg_h264::{EncoderPreset, Options as H264Options},
VideoEncoderOptions,
},
input::{
rtp::{InputVideoStream, RtpReceiverOptions, RtpStream},
InputOptions,
},
output::{
rtp::{RtpConnectionOptions, RtpSenderOptions},
OutputOptions, OutputProtocolOptions,
},
rtp::{RequestedPort, TransportProtocol},
Options, OutputVideoOptions, PipelineOutputEndCondition, Port, RegisterInputOptions,
RegisterOutputOptions, VideoCodec, VideoDecoder,
},
queue::QueueInputOptions,
Pipeline,
};
use compositor_render::{
error::ErrorStack,
scene::{
Component, ComponentId, HorizontalAlign, InputStreamComponent, RGBAColor,
TilesComponent, VerticalAlign,
},
InputId, OutputId,
};
use live_compositor::config::read_config;
use signal_hook::{consts, iterator::Signals};
use std::{
sync::{Arc, Mutex},
time::Duration,
};

use integration_tests::{
examples::TestSample,
ffmpeg::{start_ffmpeg_receive, start_ffmpeg_send},
};

const VIDEO_RESOLUTION: Resolution = Resolution {
width: 1280,
height: 720,
};

const IP: &str = "127.0.0.1";
const INPUT_PORT: u16 = 8002;
const OUTPUT_PORT: u16 = 8004;

const VIDEOS: u16 = 6;
start_ffmpeg_receive(Some(OUTPUT_PORT), None)?;

let config = read_config();
Expand Down

0 comments on commit ef12d0d

Please sign in to comment.