pub struct TrustedPayload { /* private fields */ }Expand description
Payload for PacketBufferError::TrustedPayload and
crate::boundary::PacketBuildError::TrustedPayload.
A packet carrying AV_PKT_FLAG_TRUSTED, refused on both legs.
§Why a flag makes a payload uncarriable
AV_PKT_FLAG_TRUSTED is FFmpeg’s marker for a packet whose bytes
came from a source the decoder may treat as its own — and the
wrapped-AVFrame producers use it for exactly that: the payload is
not media, it is a structure containing pointers to other live
objects (an AVFrame and its buffers), passed by address between
components inside one FFmpeg pipeline.
This crate copies bytes. A pointer copied by value is not owned by the copy — and that is not a gap this crate can close, because there is no bound on what a payload’s pointers might reach. So the amputation has a corollary:
A payload that carries addresses instead of bytes cannot be carried. Copying it produces a message that looks owned, is
Send + Sync + 'staticby every type-level test, and dangles the moment its source is dropped — a use-after-free reachable through entirely safe API.
Refusing is not conservatism, it is the only correct answer: the contract this crate exists to keep says every byte leaving FFmpeg is copied once into memory Rust owns, and a pointer cannot be.
Refused at both legs, because either one alone leaves the loop
open: copy-out ([payload_of]) is where such a packet would enter
the graph, and the reverse builders are where a flag that survived
some other route would be handed back to a decoder that trusts it.
Implementations§
Trait Implementations§
Source§impl Clone for TrustedPayload
impl Clone for TrustedPayload
Source§fn clone(&self) -> TrustedPayload
fn clone(&self) -> TrustedPayload
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TrustedPayload
Source§impl Debug for TrustedPayload
impl Debug for TrustedPayload
Source§impl Display for TrustedPayload
impl Display for TrustedPayload
impl Eq for TrustedPayload
Source§impl Error for TrustedPayload
impl Error for TrustedPayload
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()