MCPcopy Create free account
hub / github.com/Proryanator/encoder-benchmark / run_encode

Function run_encode

engine/src/engine.rs:21–91  ·  view source on GitHub ↗
(
    mut p: Permutation,
    ctrl_channel: &Result<Receiver<()>, Error>,
)

Source from the content-addressed store, hash-verified

19use crate::threads::was_ctrl_c_received;
20
21pub fn run_encode(
22 mut p: Permutation,
23 ctrl_channel: &Result<Receiver<()>, Error>,
24) -> PermutationResult {
25 let mut result = PermutationResult::new(
26 &p.get_metadata(),
27 p.bitrate,
28 &p.encoder_settings,
29 &p.encoder,
30 p.decode_run,
31 );
32
33 let metadata = p.get_metadata();
34
35 let mut ffmpeg_args = FfmpegArgs::build_ffmpeg_args(
36 p.video_file,
37 p.encoder,
38 &p.encoder_settings,
39 p.bitrate,
40 p.decode_run,
41 p.ten_bit,
42 );
43
44 let encode_start_time = SystemTime::now();
45
46 if p.is_decoding {
47 if p.decode_run {
48 // swap the input file for the output made from before
49 ffmpeg_args.setup_decode_input()
50 } else {
51 ffmpeg_args.setup_decode_output()
52 }
53 }
54
55 // not sure what to do about these results here
56 let mut trial_result = run_overload_benchmark(
57 &metadata,
58 &ffmpeg_args,
59 p.verbose,
60 p.detect_overload,
61 &ctrl_channel,
62 );
63
64 // this should be a hard-stop for the program here
65 // perhaps abstract this method out
66 if trial_result.ffmpeg_error {
67 error_with_ack(true);
68 }
69
70 result.was_overloaded = trial_result.was_overloaded;
71 result.encode_time = encode_start_time.elapsed().unwrap().as_secs();
72
73 // calculate the fps statistics and store this in the result
74 calculate_fps_statistics(&mut result, &mut trial_result);
75
76 // log the calculated fps statistics; two spaces match the progress bar
77 println!(" Average FPS:\t{:.0}", result.fps_stats.avg);
78 println!(" 1%'ile:\t{}", result.fps_stats.one_perc_low);

Callers 2

runMethod · 0.85
runMethod · 0.85

Calls 6

run_overload_benchmarkFunction · 0.85
error_with_ackFunction · 0.85
calculate_fps_statisticsFunction · 0.85
get_metadataMethod · 0.80
setup_decode_inputMethod · 0.80
setup_decode_outputMethod · 0.80

Tested by

no test coverage detected