ci: satisfy rust 1.92 clippy gate
This commit is contained in:
parent
42e58fcd03
commit
e5261cb323
@ -212,7 +212,6 @@ impl LesavkaClientApp {
|
||||
let initial_camera_profile = initial_camera_profile.clone();
|
||||
let active_camera_source = active_camera_source.clone();
|
||||
let active_camera_profile = active_camera_profile.clone();
|
||||
let active_camera_codec = active_camera_codec;
|
||||
std::thread::spawn(move || {
|
||||
let mut waiting_for_hevc_keyframe = false;
|
||||
while !stop.load(Ordering::Relaxed) {
|
||||
@ -273,8 +272,6 @@ impl LesavkaClientApp {
|
||||
let media_controls = media_controls.clone();
|
||||
let initial_microphone_source = initial_microphone_source.clone();
|
||||
let active_microphone_source = active_microphone_source.clone();
|
||||
let active_audio_codec = active_audio_codec;
|
||||
let active_noise_suppression = active_noise_suppression;
|
||||
let active_camera_requested = camera_requested;
|
||||
std::thread::spawn(move || {
|
||||
while !stop.load(Ordering::Relaxed) {
|
||||
|
||||
@ -153,7 +153,7 @@ impl OpusPacketEncoder {
|
||||
.iter()
|
||||
.position(|packet| packet.pts == pts_us)
|
||||
{
|
||||
return self.pending_packets.drain(..=index).last();
|
||||
return self.pending_packets.drain(..=index).next_back();
|
||||
}
|
||||
self.pending_packets.pop_front()
|
||||
}
|
||||
|
||||
@ -73,12 +73,8 @@ impl CameraCapture {
|
||||
return Self::new_ffmpeg_hevc_nvenc(
|
||||
&dev_label,
|
||||
source_profile,
|
||||
capture_width,
|
||||
capture_height,
|
||||
capture_fps,
|
||||
width,
|
||||
height,
|
||||
fps,
|
||||
(capture_width, capture_height, capture_fps),
|
||||
(width, height, fps),
|
||||
keyframe_interval,
|
||||
camera_preview_tap_path(),
|
||||
);
|
||||
@ -301,16 +297,14 @@ impl CameraCapture {
|
||||
fn new_ffmpeg_hevc_nvenc(
|
||||
dev_label: &str,
|
||||
source_profile: CameraSourceProfile,
|
||||
capture_width: u32,
|
||||
capture_height: u32,
|
||||
capture_fps: u32,
|
||||
width: u32,
|
||||
height: u32,
|
||||
fps: u32,
|
||||
capture_profile: (u32, u32, u32),
|
||||
output_profile: (u32, u32, u32),
|
||||
keyframe_interval: u32,
|
||||
preview_tap_path: Option<PathBuf>,
|
||||
) -> anyhow::Result<Self> {
|
||||
let bitrate_kbit = env_u32("LESAVKA_CAM_HEVC_KBIT", 3000).max(250);
|
||||
let (capture_width, capture_height, capture_fps) = capture_profile;
|
||||
let (width, height, fps) = output_profile;
|
||||
let fps = fps.max(1);
|
||||
let capture_fps = capture_fps.max(1);
|
||||
let keyframe_interval = keyframe_interval.max(1);
|
||||
|
||||
@ -241,11 +241,11 @@ fn preview_decoder_candidates() -> Vec<String> {
|
||||
}
|
||||
candidates.sort();
|
||||
candidates.dedup();
|
||||
if let Some(preferred) = preferred {
|
||||
if let Some(pos) = candidates.iter().position(|name| name == &preferred) {
|
||||
let decoder = candidates.remove(pos);
|
||||
candidates.insert(0, decoder);
|
||||
}
|
||||
if let Some(preferred) = preferred
|
||||
&& let Some(pos) = candidates.iter().position(|name| name == &preferred)
|
||||
{
|
||||
let decoder = candidates.remove(pos);
|
||||
candidates.insert(0, decoder);
|
||||
}
|
||||
candidates
|
||||
}
|
||||
|
||||
@ -77,14 +77,13 @@ fn remember_active_audio_capture(generation: u64, pipeline: &gst::Pipeline) {
|
||||
};
|
||||
if let Some((previous_generation, previous_pipeline)) =
|
||||
active.replace((generation, pipeline.clone()))
|
||||
&& previous_generation != generation
|
||||
{
|
||||
if previous_generation != generation {
|
||||
warn!(
|
||||
previous_generation,
|
||||
generation, "🔊 replacing overlapping downstream audio capture"
|
||||
);
|
||||
let _ = previous_pipeline.set_state(gst::State::Null);
|
||||
}
|
||||
warn!(
|
||||
previous_generation,
|
||||
generation, "🔊 replacing overlapping downstream audio capture"
|
||||
);
|
||||
let _ = previous_pipeline.set_state(gst::State::Null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,7 +227,7 @@ fn level_message_looks_like_digital_silence(structure: &gst::StructureRef) -> bo
|
||||
fn log_remote_speaker_silence_hint() {
|
||||
static SILENCE_MESSAGES: AtomicU64 = AtomicU64::new(0);
|
||||
let count = SILENCE_MESSAGES.fetch_add(1, Ordering::Relaxed) + 1;
|
||||
if count <= 3 || count % 30 == 0 {
|
||||
if count <= 3 || count.is_multiple_of(30) {
|
||||
warn!(
|
||||
count,
|
||||
"🔇 downstream UAC speaker capture is digital silence; Lesavka audio path is open, but the RCT/host is not currently feeding audible audio into the USB speaker endpoint"
|
||||
|
||||
@ -121,7 +121,7 @@ impl OpusPacketDecoder {
|
||||
.iter()
|
||||
.position(|packet| packet.pts == pts_us)
|
||||
{
|
||||
return self.pending_packets.drain(..=index).last();
|
||||
return self.pending_packets.drain(..=index).next_back();
|
||||
}
|
||||
self.pending_packets.pop_front()
|
||||
}
|
||||
|
||||
@ -324,14 +324,11 @@ fn synthetic_rgb_frame(width: usize, height: usize, sequence: u64) -> Vec<u8> {
|
||||
for y in 0..height {
|
||||
for x in 0..width {
|
||||
let mut value = synthetic_luma(
|
||||
width,
|
||||
height,
|
||||
(width, height),
|
||||
x,
|
||||
y,
|
||||
sequence,
|
||||
moving_period,
|
||||
moving_width,
|
||||
moving_offset,
|
||||
(moving_period, moving_width, moving_offset),
|
||||
);
|
||||
if y >= height / 2 && (((x / 32) + (y / 24) + sequence as usize) & 1) == 0 {
|
||||
value /= 3;
|
||||
@ -347,15 +344,14 @@ fn synthetic_rgb_frame(width: usize, height: usize, sequence: u64) -> Vec<u8> {
|
||||
}
|
||||
|
||||
fn synthetic_luma(
|
||||
width: usize,
|
||||
height: usize,
|
||||
frame_size: (usize, usize),
|
||||
x: usize,
|
||||
y: usize,
|
||||
sequence: u64,
|
||||
moving_period: usize,
|
||||
moving_width: usize,
|
||||
moving_offset: usize,
|
||||
moving_bar: (usize, usize, usize),
|
||||
) -> u8 {
|
||||
let (width, height) = frame_size;
|
||||
let (moving_period, moving_width, moving_offset) = moving_bar;
|
||||
let mut value = ((x as u64 * 3 + y as u64 * 5 + sequence.saturating_mul(11)) & 0xff) as u8;
|
||||
let moving = (x + moving_offset) % moving_period;
|
||||
if moving < moving_width {
|
||||
|
||||
@ -488,14 +488,13 @@ impl UvcVideoStream {
|
||||
return;
|
||||
};
|
||||
let now = Instant::now();
|
||||
if let Some(deadline) = self.next_queue_at {
|
||||
if let Some(delay) = deadline.checked_duration_since(now) {
|
||||
if !delay.is_zero() {
|
||||
thread::sleep(delay);
|
||||
self.stats.paced_sleeps += 1;
|
||||
self.stats.paced_sleep_ms += delay.as_millis().min(u128::from(u64::MAX)) as u64;
|
||||
}
|
||||
}
|
||||
if let Some(deadline) = self.next_queue_at
|
||||
&& let Some(delay) = deadline.checked_duration_since(now)
|
||||
&& !delay.is_zero()
|
||||
{
|
||||
thread::sleep(delay);
|
||||
self.stats.paced_sleeps += 1;
|
||||
self.stats.paced_sleep_ms += delay.as_millis().min(u128::from(u64::MAX)) as u64;
|
||||
}
|
||||
self.next_queue_at = Some(Instant::now() + period);
|
||||
}
|
||||
|
||||
@ -44,12 +44,11 @@ impl EyeHub {
|
||||
}
|
||||
|
||||
fn shutdown(&self) {
|
||||
if self.running.swap(false, Ordering::AcqRel) {
|
||||
if let Ok(mut task) = self.task.try_lock()
|
||||
&& let Some(task) = task.take()
|
||||
{
|
||||
task.abort();
|
||||
}
|
||||
if self.running.swap(false, Ordering::AcqRel)
|
||||
&& let Ok(mut task) = self.task.try_lock()
|
||||
&& let Some(task) = task.take()
|
||||
{
|
||||
task.abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -359,14 +359,14 @@ impl Handler {
|
||||
outcome = if outcome == "aborted" { "closed" } else { outcome };
|
||||
drop(audio_handoff_tx);
|
||||
drop(video_handoff_tx);
|
||||
if let Some(audio_worker) = audio_worker {
|
||||
if let Err(err) = audio_worker.await {
|
||||
warn!(
|
||||
rpc_id,
|
||||
session_id = camera_lease.session_id,
|
||||
"📦 v2 audio handoff worker join failed: {err}"
|
||||
);
|
||||
}
|
||||
if let Some(audio_worker) = audio_worker
|
||||
&& let Err(err) = audio_worker.await
|
||||
{
|
||||
warn!(
|
||||
rpc_id,
|
||||
session_id = camera_lease.session_id,
|
||||
"📦 v2 audio handoff worker join failed: {err}"
|
||||
);
|
||||
}
|
||||
if let Err(err) = video_worker.await {
|
||||
warn!(
|
||||
|
||||
@ -135,7 +135,7 @@ fn uvc_bulk_transfer_enabled() -> bool {
|
||||
return false;
|
||||
}
|
||||
let base = Path::new(CONFIGFS_UVC_BASE);
|
||||
!(base.exists() && !base.join("streaming_bulk").exists())
|
||||
!base.exists() || base.join("streaming_bulk").exists()
|
||||
}
|
||||
|
||||
fn uvc_streaming_maxpacket(bulk: bool) -> u32 {
|
||||
|
||||
@ -127,8 +127,7 @@ fn looks_like_annex_b_hevc(data: &[u8]) -> bool {
|
||||
|
||||
fn uvc_hevc_freshness_queue_buffers() -> u32 {
|
||||
positive_u64_env("LESAVKA_UVC_HEVC_FRESHNESS_QUEUE_BUFFERS", 2)
|
||||
.min(4)
|
||||
.max(1) as u32
|
||||
.clamp(1, 4) as u32
|
||||
}
|
||||
|
||||
fn uvc_hevc_decode_miss_limit() -> u64 {
|
||||
@ -1078,7 +1077,7 @@ impl WebcamSink {
|
||||
.fetch_add(1, std::sync::atomic::Ordering::Relaxed)
|
||||
+ 1;
|
||||
let limit = u64::from(hevc_mjpeg_guard::direct_mjpeg_normalize_miss_limit());
|
||||
if misses == 1 || misses % 30 == 0 {
|
||||
if misses == 1 || misses.is_multiple_of(30) {
|
||||
warn!(
|
||||
target:"lesavka_server::video",
|
||||
misses,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user