#[test]
fn test_get_buffer() {
let encoder = AVCodec::find_encoder(ffi::AV_CODEC_ID_AAC).unwrap();
println!("aac sample_fmts:{:#?}", encoder.sample_fmts());
let mut frame = AVFrame::new();
frame.set_format(encoder.sample_fmts().unwrap()[0]);
frame.set_nb_samples(1024);
frame.set_sample_rate(48000);
frame.set_ch_layout(AVChannelLayout::from_nb_channels(2).into_inner());
assert!(frame.alloc_buffer().is_ok());
}
this test running result:
macOS ffmpeg 7.1, ok
macOS ffmpeg 8.0, ok
Linux ffmpeg 6.1, ok
Linux ffmpeg 7.1, error
Error: Failed to allocate buffer for AVFrame
Caused by:
AVFrame buffer allocating with incorrect parameters. (-22)
this test running result:
macOS ffmpeg 7.1, ok
macOS ffmpeg 8.0, ok
Linux ffmpeg 6.1, ok
Linux ffmpeg 7.1, error