chore(avhw): clean up debug tracing in VA-API pipeline
This commit is contained in:
@@ -158,7 +158,6 @@ impl EncState {
|
|||||||
);
|
);
|
||||||
// 1. VAAPI device
|
// 1. VAAPI device
|
||||||
let hw_device_ctx = AvHwDevCtx::new_vaapi(drm_device)?;
|
let hw_device_ctx = AvHwDevCtx::new_vaapi(drm_device)?;
|
||||||
tracing::debug!("EncState::new: VAAPI device created");
|
|
||||||
|
|
||||||
// 2. Frame context for capture (XRGB/RGBZ)
|
// 2. Frame context for capture (XRGB/RGBZ)
|
||||||
let frames_rgb =
|
let frames_rgb =
|
||||||
@@ -166,7 +165,6 @@ impl EncState {
|
|||||||
|
|
||||||
// 3. Filter graph — must be built BEFORE encoder config so we can derive
|
// 3. Filter graph — must be built BEFORE encoder config so we can derive
|
||||||
// hw_frames_ctx from the buffersink output (correct surface pool dimensions).
|
// hw_frames_ctx from the buffersink output (correct surface pool dimensions).
|
||||||
tracing::debug!("EncState::new: building filter graph...");
|
|
||||||
let video_filter = build_filter_graph(
|
let video_filter = build_filter_graph(
|
||||||
&hw_device_ctx,
|
&hw_device_ctx,
|
||||||
&frames_rgb,
|
&frames_rgb,
|
||||||
@@ -248,12 +246,10 @@ impl EncState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 5. Open encoder. Video::open() returns Encoder(Video); .0 extracts the Video.
|
// 5. Open encoder. Video::open() returns Encoder(Video); .0 extracts the Video.
|
||||||
tracing::debug!("EncState::new: opening encoder...");
|
|
||||||
let opened = enc
|
let opened = enc
|
||||||
.open()
|
.open()
|
||||||
.map_err(|e| anyhow::anyhow!("Failed to open h264_vaapi encoder: {e}"))?;
|
.map_err(|e| anyhow::anyhow!("Failed to open h264_vaapi encoder: {e}"))?;
|
||||||
let enc_video = opened.0;
|
let enc_video = opened.0;
|
||||||
tracing::debug!("EncState::new: encoder opened");
|
|
||||||
|
|
||||||
// 6. Muxer setup (strict order)
|
// 6. Muxer setup (strict order)
|
||||||
let output_cstr = CString::new(output_path.to_str().unwrap())?;
|
let output_cstr = CString::new(output_path.to_str().unwrap())?;
|
||||||
@@ -490,8 +486,6 @@ fn build_filter_graph(
|
|||||||
let scale_vaapi = ff::filter::find("scale_vaapi")
|
let scale_vaapi = ff::filter::find("scale_vaapi")
|
||||||
.ok_or_else(|| anyhow::anyhow!("filter 'scale_vaapi' not found"))?;
|
.ok_or_else(|| anyhow::anyhow!("filter 'scale_vaapi' not found"))?;
|
||||||
|
|
||||||
tracing::debug!("filter_graph: filters found");
|
|
||||||
|
|
||||||
// buffersrc — use AVBufferSrcParameters to set hw_frames_ctx properly
|
// buffersrc — use AVBufferSrcParameters to set hw_frames_ctx properly
|
||||||
let args = format!(
|
let args = format!(
|
||||||
"video_size={}x{}:pix_fmt={}:time_base=1/{fps}:pixel_aspect=1/1",
|
"video_size={}x{}:pix_fmt={}:time_base=1/{fps}:pixel_aspect=1/1",
|
||||||
@@ -500,7 +494,6 @@ fn build_filter_graph(
|
|||||||
Into::<ffi::AVPixelFormat>::into(ff::format::Pixel::VAAPI) as i32,
|
Into::<ffi::AVPixelFormat>::into(ff::format::Pixel::VAAPI) as i32,
|
||||||
);
|
);
|
||||||
let mut src_ctx = graph.add(&buffersrc, "in", &args)?;
|
let mut src_ctx = graph.add(&buffersrc, "in", &args)?;
|
||||||
tracing::debug!("filter_graph: buffersrc added");
|
|
||||||
|
|
||||||
// SAFETY: av_buffersrc_parameters_alloc allocates params for the buffersrc.
|
// SAFETY: av_buffersrc_parameters_alloc allocates params for the buffersrc.
|
||||||
let par = unsafe { ffi::av_buffersrc_parameters_alloc() };
|
let par = unsafe { ffi::av_buffersrc_parameters_alloc() };
|
||||||
@@ -533,7 +526,6 @@ fn build_filter_graph(
|
|||||||
|
|
||||||
// buffersink
|
// buffersink
|
||||||
let mut sink_ctx = graph.add(&buffersink, "out", "")?;
|
let mut sink_ctx = graph.add(&buffersink, "out", "")?;
|
||||||
tracing::debug!("filter_graph: all filters added, linking...");
|
|
||||||
|
|
||||||
// Build filter chain: src -> scale -> [transpose] -> sink
|
// Build filter chain: src -> scale -> [transpose] -> sink
|
||||||
src_ctx.link(0, &mut scale_ctx, 0);
|
src_ctx.link(0, &mut scale_ctx, 0);
|
||||||
@@ -569,7 +561,6 @@ fn build_filter_graph(
|
|||||||
graph
|
graph
|
||||||
.validate()
|
.validate()
|
||||||
.map_err(|e| anyhow::anyhow!("Filter graph validation failed: {e}"))?;
|
.map_err(|e| anyhow::anyhow!("Filter graph validation failed: {e}"))?;
|
||||||
tracing::debug!("filter_graph: graph validated");
|
|
||||||
|
|
||||||
Ok(graph)
|
Ok(graph)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user