Skip to main content

check_video_decoder_contract

Function check_video_decoder_contract 

Source
pub fn check_video_decoder_contract<D, F>(
    make: F,
    config: &CodecConfig,
    packets: &[Packet],
) -> Conformance
where D: VideoDecoder + Send + 'static, F: FnMut() -> D,
Expand description

Verify a VideoDecoder against the session contract.

make builds a fresh decoder; config configures it; packets is a valid stream for it. Checked:

  • Receiving lazily (only when the decoder says ReceivePending, then draining) and eagerly (after every packet) yields the same frames: timestamps, presentation flags and pixels.
  • ReceivePending leaves the packet untaken and is followed by a Ready.
  • end_input is idempotent, EndOfStream is stable, and send after end_input is ProtocolViolation::SendAfterEnd.
  • A packet from another configuration epoch is ProtocolViolation::EpochMismatch.
  • A frame and a mapping of it stay valid while the decoder decodes more, resets and is dropped; after reset the same packets decode to the same frames.
  • Behind erase_video_decoder, a tripped stop is Cancelled, every call after it Finished, until reset.