chore: format thread names

This commit is contained in:
2025-06-12 17:29:22 +01:00
parent a7ff18b34c
commit cc973f0d9b
6 changed files with 25 additions and 16 deletions

View File

@ -13,7 +13,7 @@ pub async fn listen(out_dir: String, path: PathBuf, overseer: Arc<dyn Overseer>)
let info = ConnectionInfo { let info = ConnectionInfo {
id: Uuid::new_v4(), id: Uuid::new_v4(),
ip_addr: "127.0.0.1:6969".to_string(), ip_addr: "127.0.0.1:6969".to_string(),
endpoint: "file-input".to_owned(), endpoint: "file-input",
app_name: "".to_string(), app_name: "".to_string(),
key: "test".to_string(), key: "test".to_string(),
}; };

View File

@ -21,8 +21,8 @@ pub struct ConnectionInfo {
/// Unique ID of this connection / pipeline /// Unique ID of this connection / pipeline
pub id: Uuid, pub id: Uuid,
/// Endpoint of the ingress /// Name of the ingest point
pub endpoint: String, pub endpoint: &'static str,
/// IP address of the connection /// IP address of the connection
pub ip_addr: String, pub ip_addr: String,
@ -58,7 +58,10 @@ pub fn run_pipeline(mut pl: PipelineRunner) -> anyhow::Result<()> {
info!("New client connected: {}", &pl.connection.ip_addr); info!("New client connected: {}", &pl.connection.ip_addr);
std::thread::Builder::new() std::thread::Builder::new()
.name(format!("pipeline-{}", pl.connection.id)) .name(format!(
"client:{}:{}",
pl.connection.endpoint, pl.connection.id
))
.spawn(move || { .spawn(move || {
pl.run(); pl.run();
})?; })?;

View File

@ -272,12 +272,12 @@ pub async fn listen(out_dir: String, addr: String, overseer: Arc<dyn Overseer>)
info!("RTMP listening on: {}", &addr); info!("RTMP listening on: {}", &addr);
while let Ok((socket, ip)) = listener.accept().await { while let Ok((socket, ip)) = listener.accept().await {
let mut cc = RtmpClient::new(socket.into_std()?)?; let mut cc = RtmpClient::new(socket.into_std()?)?;
let addr = addr.clone();
let overseer = overseer.clone(); let overseer = overseer.clone();
let out_dir = out_dir.clone(); let out_dir = out_dir.clone();
let handle = Handle::current(); let handle = Handle::current();
let new_id = Uuid::new_v4();
std::thread::Builder::new() std::thread::Builder::new()
.name("rtmp-client".to_string()) .name(format!("client:rtmp:{}", new_id))
.spawn(move || { .spawn(move || {
if let Err(e) = cc.handshake() { if let Err(e) = cc.handshake() {
bail!("Error during handshake: {}", e) bail!("Error during handshake: {}", e)
@ -288,9 +288,9 @@ pub async fn listen(out_dir: String, addr: String, overseer: Arc<dyn Overseer>)
let pr = cc.published_stream.as_ref().unwrap(); let pr = cc.published_stream.as_ref().unwrap();
let info = ConnectionInfo { let info = ConnectionInfo {
id: Uuid::new_v4(), id: new_id,
ip_addr: ip.to_string(), ip_addr: ip.to_string(),
endpoint: addr.clone(), endpoint: "rtmp",
app_name: pr.0.clone(), app_name: pr.0.clone(),
key: pr.1.clone(), key: pr.1.clone(),
}; };
@ -307,8 +307,6 @@ pub async fn listen(out_dir: String, addr: String, overseer: Arc<dyn Overseer>)
bail!("Failed to create PipelineRunner {}", e) bail!("Failed to create PipelineRunner {}", e)
} }
}; };
//pl.set_demuxer_format("flv");
//pl.set_demuxer_buffer_size(1024 * 64);
pl.run(); pl.run();
Ok(()) Ok(())
})?; })?;

View File

@ -22,7 +22,7 @@ pub async fn listen(out_dir: String, addr: String, overseer: Arc<dyn Overseer>)
let socket = request.accept(None).await?; let socket = request.accept(None).await?;
let info = ConnectionInfo { let info = ConnectionInfo {
id: Uuid::new_v4(), id: Uuid::new_v4(),
endpoint: addr.clone(), endpoint: "srt",
ip_addr: socket.settings().remote.to_string(), ip_addr: socket.settings().remote.to_string(),
app_name: "".to_string(), app_name: "".to_string(),
key: socket key: socket

View File

@ -15,7 +15,7 @@ pub async fn listen(out_dir: String, addr: String, overseer: Arc<dyn Overseer>)
let info = ConnectionInfo { let info = ConnectionInfo {
id: Uuid::new_v4(), id: Uuid::new_v4(),
ip_addr: ip.to_string(), ip_addr: ip.to_string(),
endpoint: addr.clone(), endpoint: "tcp",
app_name: "".to_string(), app_name: "".to_string(),
key: "test".to_string(), key: "test".to_string(),
}; };

View File

@ -4,7 +4,9 @@ use crate::overseer::Overseer;
use anyhow::Result; use anyhow::Result;
use ffmpeg_rs_raw::ffmpeg_sys_the_third::AVPixelFormat::AV_PIX_FMT_YUV420P; use ffmpeg_rs_raw::ffmpeg_sys_the_third::AVPixelFormat::AV_PIX_FMT_YUV420P;
use ffmpeg_rs_raw::ffmpeg_sys_the_third::AVSampleFormat::AV_SAMPLE_FMT_FLTP; use ffmpeg_rs_raw::ffmpeg_sys_the_third::AVSampleFormat::AV_SAMPLE_FMT_FLTP;
use ffmpeg_rs_raw::ffmpeg_sys_the_third::{av_frame_free, av_packet_free, AV_PROFILE_H264_MAIN, AVRational}; use ffmpeg_rs_raw::ffmpeg_sys_the_third::{
av_frame_free, av_packet_free, AVRational, AV_PROFILE_H264_MAIN,
};
use ffmpeg_rs_raw::{Encoder, Muxer}; use ffmpeg_rs_raw::{Encoder, Muxer};
use log::info; use log::info;
use ringbuf::traits::{Observer, Split}; use ringbuf::traits::{Observer, Split};
@ -25,7 +27,7 @@ pub async fn listen(out_dir: String, overseer: Arc<dyn Overseer>) -> Result<()>
let info = ConnectionInfo { let info = ConnectionInfo {
id: Uuid::new_v4(), id: Uuid::new_v4(),
endpoint: "test-pattern".to_string(), endpoint: "test-pattern",
ip_addr: "test-pattern".to_string(), ip_addr: "test-pattern".to_string(),
app_name: "".to_string(), app_name: "".to_string(),
key: "test".to_string(), key: "test".to_string(),
@ -115,8 +117,14 @@ impl TestPatternSrc {
SAMPLE_RATE, SAMPLE_RATE,
frame_size, frame_size,
1, 1,
AVRational { num: 1, den: VIDEO_FPS as i32 }, AVRational {
AVRational { num: 1, den: SAMPLE_RATE as i32 }, num: 1,
den: VIDEO_FPS as i32,
},
AVRational {
num: 1,
den: SAMPLE_RATE as i32,
},
)?, )?,
video_encoder, video_encoder,
audio_encoder, audio_encoder,