Merge phase5/media-codec-test: peer_config_follows_codecs on a machine without an H.264 encoder
CI / Linux checks (push) Failing after 25m38s
CI / Linux checks (push) Failing after 25m38s
The first CI run that could fetch the private dependency failed on this test under the runner image. It now states preferred_codec's contract on any machine. Reproduced and shown green inside docker.gitea.com/runner-images:ubuntu-24.04. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
commit
c91a3b719d
1 file changed
+25
-5
@@ -3410,7 +3410,14 @@ mod tests {
|
|||||||
assert!(all.is_hardware(backend), "{codec} offered in software");
|
assert!(all.is_hardware(backend), "{codec} offered in software");
|
||||||
}
|
}
|
||||||
if all.encoder_codecs().contains(&Codec::H264) && !offer.contains(&Codec::H264) {
|
if all.encoder_codecs().contains(&Codec::H264) && !offer.contains(&Codec::H264) {
|
||||||
assert_eq!(offer_codecs(&all, Codec::H264)[..2], [Codec::H264, Codec::Vp8]);
|
// H.264 in software only (so not in `offer`): it leads the same
|
||||||
|
// codecs as with VP8 as the stream codec, whichever hardware
|
||||||
|
// encoders this machine has (a hardware AV1 or VP9 encoder ranks
|
||||||
|
// before VP8, so VP8 is not always second).
|
||||||
|
let h264 = offer_codecs(&all, Codec::H264);
|
||||||
|
assert_eq!(h264[0], Codec::H264, "{h264:?}");
|
||||||
|
assert_eq!(h264.len(), offer.len() + 1, "{h264:?} against {offer:?}");
|
||||||
|
assert!(offer.iter().all(|c| h264.contains(c)), "{h264:?} against {offer:?}");
|
||||||
}
|
}
|
||||||
// Whatever this machine has: codecs every TeamSpeak client decodes
|
// Whatever this machine has: codecs every TeamSpeak client decodes
|
||||||
// come before H.264, HEVC last, and the automatic stream codec is
|
// come before H.264, HEVC last, and the automatic stream codec is
|
||||||
@@ -3423,10 +3430,23 @@ mod tests {
|
|||||||
let ranks: Vec<_> = offer[1..].iter().map(rank).collect();
|
let ranks: Vec<_> = offer[1..].iter().map(rank).collect();
|
||||||
assert!(ranks.is_sorted(), "{offer:?}");
|
assert!(ranks.is_sorted(), "{offer:?}");
|
||||||
assert!(preferred_codec(&all, None).is_some_and(decoded_everywhere), "{all:?}");
|
assert!(preferred_codec(&all, None).is_some_and(decoded_everywhere), "{all:?}");
|
||||||
assert_eq!(
|
// A configured codec is the stream codec when this machine can encode
|
||||||
preferred_codec(&all, Some(Codec::H264)).is_some(),
|
// it; otherwise the result is the automatic choice,
|
||||||
all.encoder_codecs().contains(&Codec::H264)
|
// `preferred_codec(&all, None)` (some codec on any machine that
|
||||||
);
|
// encodes anything). Whether H.264 is encodable depends on the
|
||||||
|
// machine (a desktop with FFmpeg or a GPU has an encoder, a CI
|
||||||
|
// runner has none), so the expectation follows `all.encoder_codecs()`.
|
||||||
|
let h264 = preferred_codec(&all, Some(Codec::H264));
|
||||||
|
if all.encoder_codecs().contains(&Codec::H264) {
|
||||||
|
assert_eq!(h264, Some(Codec::H264), "{all:?}");
|
||||||
|
} else {
|
||||||
|
assert_eq!(h264, preferred_codec(&all, None), "{all:?}");
|
||||||
|
}
|
||||||
|
// The built-in codecs are the same everywhere (no OpenH264 loaded):
|
||||||
|
// VP9 is encodable and wins, H.264 is not and falls back to VP8.
|
||||||
|
assert_eq!(preferred_codec(&codecs, Some(Codec::Vp9)), Some(Codec::Vp9));
|
||||||
|
assert_eq!(preferred_codec(&codecs, Some(Codec::H264)), preferred_codec(&codecs, None));
|
||||||
|
assert_eq!(preferred_codec(&codecs, None), Some(Codec::Vp8));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A sink whose viewers chose `codecs`; keeps every video frame with its
|
/// A sink whose viewers chose `codecs`; keeps every video frame with its
|
||||||
|
|||||||
Reference in new issue
Block a user