ignore progress send errors without faking a drop
This commit is contained in:
@@ -393,7 +393,9 @@ fn two_pass_video(
|
|||||||
|
|
||||||
// Send 50% to signal pass 1 done, pass 2 starting.
|
// Send 50% to signal pass 1 done, pass 2 starting.
|
||||||
if let Some(ref t) = tx {
|
if let Some(ref t) = tx {
|
||||||
drop(t.send(EncodeProgress { pass: 1, total_passes: 2, percent: 100.0 }));
|
// The receiver is gone only if the UI navigated away; the encode is
|
||||||
|
// unaffected, so the send error is deliberately discarded.
|
||||||
|
let _ = t.send(EncodeProgress { pass: 1, total_passes: 2, percent: 100.0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut pass2 = Command::new(ffmpeg);
|
let mut pass2 = Command::new(ffmpeg);
|
||||||
@@ -1192,11 +1194,13 @@ fn run_impl(
|
|||||||
} else if key == "progress" {
|
} else if key == "progress" {
|
||||||
let percent = (last_out_time_us / encode_dur_us * 100.0).clamp(0.0, 100.0);
|
let percent = (last_out_time_us / encode_dur_us * 100.0).clamp(0.0, 100.0);
|
||||||
if let Some(ref sender) = tx {
|
if let Some(ref sender) = tx {
|
||||||
drop(sender.send(EncodeProgress {
|
// A dropped receiver means the frontend is gone;
|
||||||
|
// the encode keeps running either way.
|
||||||
|
let _ = sender.send(EncodeProgress {
|
||||||
pass,
|
pass,
|
||||||
total_passes,
|
total_passes,
|
||||||
percent,
|
percent,
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user