mod fixtures;
use fixtures::*;
use ff_decode::{DecodeError, VideoDecoder};
use ff_format::NetworkOptions;
#[test]
fn file_video_decoder_should_not_be_live_udp_regression() {
let decoder = VideoDecoder::open(test_video_path())
.build()
.expect("Failed to open test video");
assert!(
!decoder.is_live(),
"File-backed VideoDecoder must report is_live=false (UDP regression guard)"
);
}
#[test]
fn udp_url_open_should_not_return_file_not_found() {
let result = VideoDecoder::open("udp://127.0.0.1:65535")
.network(NetworkOptions::default())
.build();
if let Err(DecodeError::FileNotFound { path }) = result {
panic!("udp:// URL must not produce FileNotFound; path={path:?}");
}
}
#[test]
fn udp_multicast_url_open_should_not_return_file_not_found() {
let result = VideoDecoder::open("udp://224.0.0.1:1234")
.network(NetworkOptions::default())
.build();
if let Err(DecodeError::FileNotFound { path }) = result {
panic!("udp:// multicast URL must not produce FileNotFound; path={path:?}");
}
}
#[test]
fn http_url_open_should_not_return_file_not_found() {
let result = VideoDecoder::open("http://127.0.0.1:65535/stream.ts")
.network(NetworkOptions::default())
.build();
if let Err(DecodeError::FileNotFound { path }) = result {
panic!("http:// URL must not produce FileNotFound; path={path:?}");
}
}
#[test]
fn udp_live_decoder_should_report_is_live() {
let decoder = match VideoDecoder::open("udp://224.0.0.1:1234")
.network(NetworkOptions::default())
.build()
{
Ok(d) => d,
Err(e) => {
println!("Skipping: no UDP multicast source available ({e})");
return;
}
};
assert!(
decoder.is_live(),
"UDP/MPEG-TS source must report is_live=true"
);
}