Fix read speed: detect kernel max transfer size, fix phantom streams
Root cause: READ_10 requested 510 sectors (1MB) but kernel sg driver limits to max_hw_sectors_kb=120 (60 sectors). All bulk reads errored, error handler fell to 3-sector reads → 4.8 MB/s instead of 12+ MB/s. - detect_max_batch_sectors() now resolves sg→block device via sysfs and uses 80% of kernel limit for safety margin - Default fallback reduced from 510 to 48 sectors - ContentReader uses per-device detected max, not hardcoded constant - Filter out coding_type 0x00 (empty/padding) stream entries - Add MPLS stream_type 5/6/7 attribute parsing (secondary audio/video) Tested on BU40N: 4.8 → 12.5 MB/s sustained, 23.7 MB/s peak.
This commit is contained in:
+21
@@ -263,6 +263,27 @@ fn parse_stream_entry(item: &[u8], pos: usize, stream_type: u8) -> Option<(Strea
|
||||
language = String::from_utf8_lossy(&sa[1..4]).to_string();
|
||||
}
|
||||
}
|
||||
5 => {
|
||||
// Secondary audio: same as primary audio
|
||||
if sa.len() >= 2 {
|
||||
audio_format = (sa[1] >> 4) & 0x0F;
|
||||
audio_rate = sa[1] & 0x0F;
|
||||
}
|
||||
if sa.len() >= 5 {
|
||||
language = String::from_utf8_lossy(&sa[2..5]).to_string();
|
||||
}
|
||||
}
|
||||
6 | 7 => {
|
||||
// Secondary video: same as primary video
|
||||
if sa.len() >= 2 {
|
||||
video_format = (sa[1] >> 4) & 0x0F;
|
||||
video_rate = sa[1] & 0x0F;
|
||||
}
|
||||
if coding_type == 0x24 && sa.len() > 2 {
|
||||
dynamic_range = (sa[2] >> 4) & 0x0F;
|
||||
color_space_val = sa[2] & 0x0F;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user