Skip to content
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
2 changes: 1 addition & 1 deletion src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub struct ClientCommand {
pub size: Option<u64>,
}

pub fn do_input(mut rx: Receiver<InputCommand>, startx: u32, starty: u32) -> anyhow::Result<()> {
pub fn do_input(mut rx: Receiver<InputCommand>, startx: i32, starty: i32) -> anyhow::Result<()> {
#[cfg(target_os = "windows")]
let _ = crate::windows_service::sync_thread_desktop();

Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,11 @@ pub struct AppState {
#[derive(Deserialize, Clone, Debug)]
struct Config {
target_bitrate: u32,
startx: u32,
startx: i32,
#[serde(default)]
starty: u32,
endx: Option<u32>,
endy: Option<u32>,
starty: i32,
endx: Option<i32>,
endy: Option<i32>,

// Windows-only
windows_monitor_index: Option<i32>,
Expand Down
2 changes: 1 addition & 1 deletion src/rtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ pub async fn run(
.clamp(500, state.config.target_bitrate as u64 + 3000)
as u32;
if audio.1.is_some() {
bwe -= 64;
bwe -= 96;
}

video.0.set_bitrate(bwe);
Expand Down
37 changes: 19 additions & 18 deletions src/rtc/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ impl AudioRecordingPipeline {
let opusenc = ElementFactory::make("opusenc")
// According to a comment in GStreamer's webrtcsink, this is required for Chrome
.property("perfect-timestamp", true)
.property("bitrate", 96000i32)
.build()?;

let opus_caps = gstreamer::Caps::builder("audio/x-opus").build();
Expand Down Expand Up @@ -228,6 +229,7 @@ impl AudioRecordingPipeline {
let opusenc = ElementFactory::make("opusenc")
// According to a comment in GStreamer's webrtcsink, this is required for Chrome
.property("perfect-timestamp", true)
.property("bitrate", 96000i32)
.build()?;

let opus_caps = gstreamer::Caps::builder("audio/x-opus").build();
Expand Down Expand Up @@ -323,10 +325,10 @@ impl ScreenRecordingPipeline {
elements.push(
ElementFactory::make("ximagesrc")
.property("use-damage", false)
.property("startx", config.startx)
.property("starty", config.starty)
.property_if_some("endx", config.endx)
.property_if_some("endy", config.endy)
.property("startx", config.startx as u32)
.property("starty", config.starty as u32)
.property_if_some("endx", config.endx.map(|endx| endx as u32))
.property_if_some("endy", config.endy.map(|endy| endy as u32))
.property("show-pointer", show_mouse)
.property("blocksize", 16384u32)
.property("remote", true)
Expand Down Expand Up @@ -381,7 +383,7 @@ impl ScreenRecordingPipeline {
.property("vbv-buf-capacity", config.vbv_buf_capacity)
.property_from_str("speed-preset", "superfast")
.property_from_str("tune", "zerolatency")
.property("bitrate", config.target_bitrate - 64)
.property("bitrate", config.target_bitrate - 96)
.property("key-int-max", 2560u32)
.build()?
} else {
Expand All @@ -394,10 +396,10 @@ impl ScreenRecordingPipeline {
.property("ref-frames", 1u32)
.property("target-usage", 6u32)
.property_from_str("rate-control", "cbr")
.property("bitrate", config.target_bitrate - 64)
.property("bitrate", config.target_bitrate - 96)
.property(
"cpb-size",
((config.target_bitrate - 64) * config.vbv_buf_capacity) / 1000,
((config.target_bitrate - 96) * config.vbv_buf_capacity) / 1000,
)
.property_from_str("mbbrc", "enabled")
.build()?
Expand Down Expand Up @@ -480,15 +482,15 @@ impl ScreenRecordingPipeline {
let pipeline = Pipeline::default();
elements.push(
ElementFactory::make("avfvideosrc")
.property("screen-crop-x", config.startx)
.property("screen-crop-y", config.starty)
.property("screen-crop-x", config.startx as u32)
.property("screen-crop-y", config.starty as u32)
.property_if_some(
"screen-crop-width",
config.endx.map(|endx| endx - config.startx),
config.endx.map(|endx| endx as u32 - config.startx as u32),
)
.property_if_some(
"screen-crop-height",
config.endy.map(|endy| endy - config.starty),
config.endy.map(|endy| endy as u32 - config.starty as u32),
)
.property("capture-screen", true)
.property("capture-screen-cursor", show_mouse)
Expand Down Expand Up @@ -534,13 +536,13 @@ impl ScreenRecordingPipeline {
.property("vbv-buf-capacity", config.vbv_buf_capacity)
.property_from_str("speed-preset", "superfast")
.property_from_str("tune", "zerolatency")
.property("bitrate", config.target_bitrate - 64)
.property("bitrate", config.target_bitrate - 96)
.property("key-int-max", 2560u32)
.build()?
} else {
ElementFactory::make("vtenc_h264")
.property("allow-frame-reordering", false)
.property("bitrate", config.target_bitrate - 64)
.property("bitrate", config.target_bitrate - 96)
.property("realtime", true)
.build()?
};
Expand Down Expand Up @@ -641,14 +643,13 @@ impl ScreenRecordingPipeline {
let mut elements = vec![];
let pipeline = Pipeline::default();
let src = ElementFactory::make("d3d11screencapturesrc")
.property("crop-x", config.startx)
/*.property("crop-x", config.startx)
.property("crop-y", config.starty)
.property_if_some("crop-width", config.endx.map(|endx| endx - config.startx))
.property_if_some("crop-height", config.endy.map(|endy| endy - config.starty))
.property_if_some("crop-height", config.endy.map(|endy| endy - config.starty))*/
.property_if_some("monitor-index", config.windows_monitor_index)
.property_from_str_if_some("capture-api", config.windows_capture_api.as_deref())
.property("show-cursor", show_mouse)
//.property_from_str("capture-api", "wgc")
.build()?;
elements.push(src);

Expand Down Expand Up @@ -701,7 +702,7 @@ impl ScreenRecordingPipeline {
.property("vbv-buf-capacity", config.vbv_buf_capacity)
.property_from_str("speed-preset", "superfast")
.property_from_str("tune", "zerolatency")
.property("bitrate", config.target_bitrate - 64)
.property("bitrate", config.target_bitrate - 96)
.property("key-int-max", 2560u32)
.build()?
} else {
Expand All @@ -710,7 +711,7 @@ impl ScreenRecordingPipeline {
.property("bframes", 0u32)
.property("cabac", false)
.property_from_str("rc-mode", "cbr")
.property("bitrate", config.target_bitrate - 64)
.property("bitrate", config.target_bitrate - 96)
.property("vbv-buffer-size", config.vbv_buf_capacity)
.property("gop-size", 2560i32)
.property(
Expand Down
14 changes: 14 additions & 0 deletions startx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

export DISPLAY=:1

sudo X :1 -config xorg.conf &
sleep 2

cd ../../
startxfce4 &
sleep 2

cd Documents/tenebra
sudo ./target/release/tenebra

Loading