fix: made threads and niceness also optional.
This commit is contained in:
parent
e4f14f9531
commit
92833c21ce
3 changed files with 9 additions and 9 deletions
|
@ -14,8 +14,8 @@ impl ConfigFFmpeg {
|
|||
audio_codec: self.output.audio.codec.clone(),
|
||||
audio_bitrate: if self.output.audio.bitrate > 0 { Some(self.output.audio.bitrate) } else { None },
|
||||
|
||||
threads: if self.process.threads > 0 { Some(self.process.threads) } else { None },
|
||||
niceness: if self.process.niceness > 0 { Some(self.process.niceness) } else { None },
|
||||
threads: if self.process.threads.unwrap_or(0) > 0 { Some(self.process.threads.unwrap_or(0)) } else { None },
|
||||
niceness: if self.process.niceness.unwrap_or(0) > 0 { Some(self.process.niceness.unwrap_or(0)) } else { None },
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,8 +44,8 @@ pub struct ConfigFiles {
|
|||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ConfigFFmpegProcess {
|
||||
pub threads: u8,
|
||||
pub niceness: u8,
|
||||
pub threads: Option<u8>,
|
||||
pub niceness: Option<u8>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
@ -106,8 +106,8 @@ impl Config {
|
|||
ffmpeg: ConfigFFmpeg {
|
||||
path: String::from("/usr/bin/ffmpeg"),
|
||||
process: ConfigFFmpegProcess {
|
||||
threads: 0,
|
||||
niceness: 0,
|
||||
threads: Some(0),
|
||||
niceness: Some(0),
|
||||
},
|
||||
output: ConfigFFmpegOutput {
|
||||
format: String::from("webm"),
|
||||
|
|
|
@ -44,8 +44,8 @@ fn main() {
|
|||
|
||||
info!("Processing file {}.", job.input);
|
||||
let mut child = job.run(&config.ffmpeg).unwrap();
|
||||
if (config.ffmpeg.process.niceness > 0) {
|
||||
renice(child.id(), config.ffmpeg.process.niceness)
|
||||
if (config.ffmpeg.process.niceness.unwrap_or(0)) > 0 {
|
||||
renice(child.id(), config.ffmpeg.process.niceness.unwrap_or(0))
|
||||
.expect("Failed to renice process.");
|
||||
}
|
||||
child.wait().expect("Failed to wait for process.");
|
||||
|
|
Loading…
Reference in a new issue