(
metadata: &MetaData,
ffmpeg_args: &FfmpegArgs,
verbose: bool,
detect_overload: bool,
ctrl_channel: &Result<Receiver<()>, Error>,
)
| 181 | } |
| 182 | |
| 183 | fn run_overload_benchmark( |
| 184 | metadata: &MetaData, |
| 185 | ffmpeg_args: &FfmpegArgs, |
| 186 | verbose: bool, |
| 187 | detect_overload: bool, |
| 188 | ctrl_channel: &Result<Receiver<()>, Error>, |
| 189 | ) -> TrialResult { |
| 190 | let mut child = spawn_ffmpeg_child(ffmpeg_args, verbose, None); |
| 191 | if verbose { |
| 192 | println!("V: Successfully spawned encoding child"); |
| 193 | } |
| 194 | |
| 195 | let trial_result = progressbar::watch_encode_progress( |
| 196 | metadata.frames, |
| 197 | detect_overload, |
| 198 | metadata.fps, |
| 199 | verbose, |
| 200 | ffmpeg_args.stats_period, |
| 201 | ctrl_channel, |
| 202 | ); |
| 203 | |
| 204 | if trial_result.ffmpeg_error && !was_ctrl_c_received(&ctrl_channel) { |
| 205 | let _ = child.kill(); |
| 206 | eprintln!("Ffmpeg encountered an error when attempting to run, double-check that your environment is setup correctly. If so, open an issue in github!"); |
| 207 | eprintln!("See below re-creation of the ffmpeg error..."); |
| 208 | // spawn the ffmpeg command, with output logged so we can troubleshoot better |
| 209 | // modifying the command just a little bit so that it fails immediately |
| 210 | let mut child = spawn_ffmpeg_child(&ffmpeg_args, verbose, Option::from(true)); |
| 211 | sleep(Duration::from_secs(20)); |
| 212 | child |
| 213 | .kill() |
| 214 | .expect("Not able to kill the error ffmpeg thread"); |
| 215 | } else if trial_result.was_overloaded && !was_ctrl_c_received(&ctrl_channel) { |
| 216 | let _ = child.kill(); |
| 217 | println!( |
| 218 | "Encoder was overloaded and could not encode the video file in realtime, stopping..." |
| 219 | ); |
| 220 | } |
| 221 | |
| 222 | return trial_result; |
| 223 | } |
| 224 | |
| 225 | fn calculate_fps_statistics( |
| 226 | permutation_result: &mut PermutationResult, |
no test coverage detected