Skip to main content

StreamProcessorAddBufferRequest

Struct StreamProcessorAddBufferRequest 

Source
pub struct StreamProcessorAddBufferRequest {
    pub port: Option<Port>,
    pub buffer_constraints_version_ordinal: Option<u64>,
    pub buffer_lifetime_ordinal: Option<u64>,
    pub buffer_index: Option<u32>,
    pub buffer: Option<Vmo>,
    /* private fields */
}

Fields§

§port: Option<Port>

Must be set. Which port (input or output) the buffer is for.

§buffer_constraints_version_ordinal: Option<u64>

Typically this is the latest buffer_constraints_version_ordinal known to the client based on OnInputConstraints/OnOutputConstraints. Older values are not harmful to correctness.

The server will ignore this message if the server has already created a later buffer_constraints_version_ordinal value that has action_required true. If the server ignores this message, a later RemoveBuffer for this buffer will complete quickly and without creating an error.

A client is not required to ensure that every call to AddBuffer with the same buffer_lifetime_ordinal uses the same buffer_constraints_version_ordinal, but the client must ensure that all buffer_constraints_version_ordinal values which share the same buffer_lifetime_ordinal are within the same action_required true interval. Each such interval starts with a value that has action_required true, and lasts until but not including the next value with action_required true, or until the current value if there is not yet a next value with action_required true. If this would create a problem for a server, that server should set action_required true instead of false.

§buffer_lifetime_ordinal: Option<u64>

These values are scoped to input/output separately.

The first message from the client with a new (higher) buffer_lifetime_ordinal value begins removing all buffers on the same port with lower buffer_lifetime_ordinal. However, until removal is complete, the older buffers can still be used by the codec.

The AddBuffer message adds the buffer to this buffer_lifetime_ordinal.

§buffer_index: Option<u32>

The buffer_index values under a buffer_lifetime_ordinal must be unique among all added but not yet fully removed buffers. This value is initially allocated/specified by the client using this field, and then both the client and the server will then refer to a this added buffer uniquely using input vs output, buffer_lifetime_ordinal, and the buffer_index (all three parts are needed to unambiguously specify this buffer).

See RemoveBuffer doc comments for how to safely remove a buffer and potentially re-use a buffer_index value.

In contrast to using SetInputBufferPartialSettings/SetOutputBufferPartialSettings, when using AddBuffer and RemoveBuffer, the StreamProcessor buffer_index value has no relation to the sysmem buffer_index (under the sysmem buffer_collection_id). Instead, the StreamProcessor buffer_index is specified by this field, not by using sysmem’s buffer_index. This way, two buffers from two sysmem collections having the same sysmem buffer_index (under separate buffer_collection_id(s)) can be specified unambiguously in StreamProcessor messages.

§buffer: Option<Vmo>

This is a VMO handle that the server can use to access the sysmem buffer.

This VMO is required to have been provided by sysmem, and required to be compatible with the server’s sysmem constraints.

The buffer_constraints_version_ordinal check occurs first, and failure of that check just silently ignores the remainder of this message without checking the buffer field (buffer is just dropped).

If the buffer_constraints_version_ordinal check passes, but buffer isn’t a sysmem-provided VMO or isn’t consistent with the server’s sysmem constraints, the server will close the StreamProcessor server_end. The client can avoid triggering this failure case by allocating the buffers per the following.

For video decoder input buffers, the client can allocate the buffer using sysmem, with participation of this or another instance of the same codec implementation, using ParticipateInBufferAllocation with Port.INPUT. The same StreamProcessor instance isn’t required in this case, only the same codec implementation. If using a different StreamProcessor instance (but still from the same codec implementation), the client should take care to create the two StreamProcessor instances with the same requirements specified to CodecFactory (for example with secure_input_mode and secure_output_mode set the same way). Video decoder server implementations with supports_dynamic_buffers true are required to support allocating input buffers using one StreamProcessor instance then using them with a different StreamProcessor instance (in contrast, for output buffers, this is not required).

For video decoder output buffers, this can be achieved by allocating the buffer using sysmem, with participation of the same StreamProcessor instance, using ParticipateInBufferAllocation with Port.OUTPUT.

Servers should verify that this VMO is (a) provided by sysmem, and (b) meets the server’s current sysmem constraints. The server can verify both (a) and (b) by checking the result of sysmem’s CheckVmoConstraints before using this VMO. If that check fails, the server can close the StreamProcessor server_end.

Trait Implementations§

Source§

impl Debug for StreamProcessorAddBufferRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Decode<StreamProcessorAddBufferRequest, DefaultFuchsiaResourceDialect> for StreamProcessorAddBufferRequest

Source§

fn new_empty() -> Self

Creates a valid instance of Self. The specific value does not matter, since it will be overwritten by decode.
Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, DefaultFuchsiaResourceDialect>, offset: usize, depth: Depth, ) -> Result<()>

Decodes an object of type T from the decoder’s buffers into self. Read more
Source§

impl Default for StreamProcessorAddBufferRequest

Source§

fn default() -> StreamProcessorAddBufferRequest

Returns the “default value” for a type. Read more
Source§

impl Encode<StreamProcessorAddBufferRequest, DefaultFuchsiaResourceDialect> for &mut StreamProcessorAddBufferRequest

Source§

unsafe fn encode( self, encoder: &mut Encoder<'_, DefaultFuchsiaResourceDialect>, offset: usize, depth: Depth, ) -> Result<()>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl PartialEq for StreamProcessorAddBufferRequest

Source§

fn eq(&self, other: &StreamProcessorAddBufferRequest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ResourceTypeMarker for StreamProcessorAddBufferRequest

Source§

type Borrowed<'a> = &'a mut StreamProcessorAddBufferRequest

The Rust type to use for encoding. This is a particular Encode<Self> type cheaply obtainable from &mut Self::Owned. There are three cases: Read more
Source§

fn take_or_borrow<'a>( value: &'a mut <Self as TypeMarker>::Owned, ) -> Self::Borrowed<'a>

Cheaply converts from &mut Self::Owned to Self::Borrowed. For HandleBased types this is “take” (it returns an owned handle and replaces value with Handle::invalid), and for all other types it is “borrow” (just converts from one reference to another).
Source§

impl TypeMarker for StreamProcessorAddBufferRequest

Source§

type Owned = StreamProcessorAddBufferRequest

The owned Rust type which this FIDL type decodes into.
Source§

fn inline_align(_context: Context) -> usize

Returns the minimum required alignment of the inline portion of the encoded object. It must be a (nonzero) power of two.
Source§

fn inline_size(_context: Context) -> usize

Returns the size of the inline portion of the encoded object, including padding for alignment. Must be a multiple of inline_align.
Source§

fn encode_is_copy() -> bool

Returns true if the memory layout of Self::Owned matches the FIDL wire format and encoding requires no validation. When true, we can optimize encoding arrays and vectors of Self::Owned to a single memcpy. Read more
Source§

fn decode_is_copy() -> bool

Returns true if the memory layout of Self::Owned matches the FIDL wire format and decoding requires no validation. When true, we can optimize decoding arrays and vectors of Self::Owned to a single memcpy.
Source§

impl Standalone<DefaultFuchsiaResourceDialect> for StreamProcessorAddBufferRequest

Source§

impl StructuralPartialEq for StreamProcessorAddBufferRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.