mirror of
https://github.com/freemkv/libfreemkv.git
synced 2026-10-07 18:13:10 +00:00
mux(resolve): surface the reopen error instead of swallowing it
The TrueHD channel-correction probe's reopen closure returned Option<S> via .ok(), collapsing a real io::Error into an indistinguishable None. Make reopen return io::Result<S> and log the actual error on the failure arm so a failed re-open is diagnosable, not silent.
This commit is contained in:
+11
-6
@@ -376,7 +376,10 @@ pub fn input(url: &str, opts: &InputOptions) -> io::Result<Box<dyn crate::pes::S
|
|||||||
let stream = image_input(
|
let stream = image_input(
|
||||||
reader,
|
reader,
|
||||||
opts,
|
opts,
|
||||||
move || crate::io::file_sector_source::FileSectorSource::open(&probe_path).ok(),
|
move || {
|
||||||
|
crate::io::file_sector_source::FileSectorSource::open(&probe_path)
|
||||||
|
.map_err(|e| -> io::Error { e.into() })
|
||||||
|
},
|
||||||
false,
|
false,
|
||||||
)?;
|
)?;
|
||||||
Ok(Box::new(stream))
|
Ok(Box::new(stream))
|
||||||
@@ -391,7 +394,7 @@ pub fn input(url: &str, opts: &InputOptions) -> io::Result<Box<dyn crate::pes::S
|
|||||||
let stream = image_input(
|
let stream = image_input(
|
||||||
reader,
|
reader,
|
||||||
opts,
|
opts,
|
||||||
move || crate::dirimage::DirImage::open(&probe_path).ok(),
|
move || crate::dirimage::DirImage::open(&probe_path).map_err(|e| -> io::Error { e.into() }),
|
||||||
true,
|
true,
|
||||||
)?;
|
)?;
|
||||||
Ok(Box::new(stream))
|
Ok(Box::new(stream))
|
||||||
@@ -445,7 +448,7 @@ fn image_input<S, F>(
|
|||||||
) -> io::Result<PipelinedPesStream>
|
) -> io::Result<PipelinedPesStream>
|
||||||
where
|
where
|
||||||
S: SectorSource + Send + 'static,
|
S: SectorSource + Send + 'static,
|
||||||
F: FnOnce() -> Option<S>,
|
F: FnOnce() -> io::Result<S>,
|
||||||
{
|
{
|
||||||
let capacity = reader.capacity_sectors();
|
let capacity = reader.capacity_sectors();
|
||||||
let mut disc =
|
let mut disc =
|
||||||
@@ -510,7 +513,7 @@ where
|
|||||||
// probing decrypted units via a fresh reader; skipped in --raw (no point).
|
// probing decrypted units via a fresh reader; skipped in --raw (no point).
|
||||||
if !opts.raw {
|
if !opts.raw {
|
||||||
match reopen() {
|
match reopen() {
|
||||||
Some(mut probe) => {
|
Ok(mut probe) => {
|
||||||
// The probe decrypts the title head, so it needs the same
|
// The probe decrypts the title head, so it needs the same
|
||||||
// key map the mux read installs below, or an AACS source
|
// key map the mux read installs below, or an AACS source
|
||||||
// fails loud on the first unit. `.ok()`: non-fatal.
|
// fails loud on the first unit. `.ok()`: non-fatal.
|
||||||
@@ -536,11 +539,13 @@ where
|
|||||||
}
|
}
|
||||||
crate::disc::correct_truehd_channels(&mut dec, &mut disc.titles[idx]);
|
crate::disc::correct_truehd_channels(&mut dec, &mut disc.titles[idx]);
|
||||||
}
|
}
|
||||||
None => {
|
Err(e) => {
|
||||||
// Non-fatal: a failed re-open leaves MPLS 7.1/Atmos counts
|
// Non-fatal: a failed re-open leaves MPLS 7.1/Atmos counts
|
||||||
// uncorrected (as 5.1). Log so it's diagnosable, not silent.
|
// uncorrected (as 5.1). Log the actual error so it's
|
||||||
|
// diagnosable, not swallowed by a bare `.ok()` -> None.
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
target: "mux",
|
target: "mux",
|
||||||
|
error = %e,
|
||||||
"TrueHD channel-correction probe re-open failed"
|
"TrueHD channel-correction probe re-open failed"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user