✅ Check that CoreMedia takes an HEVC prefix SEI

A paravirtual HEVC session hands the arm every array of the guest's hvcC
record, prefix SEI units among them where a file carries them, and the Mac
host's VideoToolbox arm passes them all to
CMVideoFormatDescriptionCreateFromHEVCParameterSets. Whether CoreMedia takes
an SEI there was not checked: a refusal would fail such a file's session at
its make.

The test makes the format description of the probe's VPS, SPS and PPS of a
64x64 Main stream, alone and with a prefix SEI of one user_data_unregistered
message, and a VideoToolbox session of the latter, and holds that each is
made.
This commit is contained in:
Anees Iqbal committed 2026-12-03 06:16:31 -08:00
1 parent e1f579aa27
commit 3a4adacb52
1 file changed
+37
@@ -441,6 +441,43 @@ mod tests {
md5.hex()
}
/// CoreMedia makes the format description of an HEVC stream whose parameter sets carry a
/// prefix SEI unit beside its VPS, SPS and PPS, as an hvcC's arrays may (`paravirt` hands a
/// guest's record's arrays to the arm whole), and VideoToolbox a session of it: the probe's
/// sets of a 64x64 Main stream, and an SEI of one `user_data_unregistered` message.
#[test]
fn a_format_description_takes_a_prefix_sei_beside_the_parameter_sets() {
let main = super::super::Offer {
codec: Codec::Hevc,
profile_idc: 1,
chroma_format_idc: 1,
bit_depth: 8,
};
let sets = super::super::probe::parameter_sets(&main).expect("the probe's sets");
// A prefix SEI (type 39, layer 0, temporal ID 0) of a `user_data_unregistered` message
// (payloadType 5) of 20 bytes, a UUID and four more, none zero, then the stop bit.
let mut sei = vec![0x4e, 0x01, 0x05, 0x14];
sei.extend((1..=20u8).map(|b| b.wrapping_mul(13) | 1));
sei.push(0x80);
let mut units: Vec<&[u8]> = sets.iter().map(Vec::as_slice).collect();
let without = format_description(Codec::Hevc, &units).map(|_| ());
units.push(&sei);
let with = format_description(Codec::Hevc, &units).map(|_| ());
eprintln!("format description: VPS, SPS and PPS {without:?}; with the SEI {with:?}");
assert_eq!(without, Ok(()), "the VPS, SPS and PPS alone");
assert_eq!(with, Ok(()), "CoreMedia took no prefix SEI beside them");
let destination = Destination {
pixel_format: FourCc::new(*b"420v"),
width: 0,
height: 0,
bytes_per_row_alignment: 64,
plane_alignment: 256,
};
let session = Decoder::new(Codec::Hevc, &units, &destination, false).map(|_| ());
eprintln!("a session of them: {session:?}");
assert_eq!(session, Ok(()), "VideoToolbox made no session of them");
}
/// The stream `RVG_VT_STREAM` names (Annex B: H.264 for a name ending `.264`, else HEVC),
/// decoded on the hardware decoder into `RVG_VT_FORMAT` (`420v`, or `x420` for a 10-bit
/// stream), each picture hashed against the lines of `RVG_VT_MD5`: ffmpeg's `framemd5` of