class InStreamBuffer

Defined at line 17 of file ../../src/media/codec/examples/use_media_decoder/in_stream_buffer.h

This wrapper of an InStream buffers the entire InStream on first read through

and supports ResetToStart() even if the wrapped InStream doesn't.

As with InStream, this class has blocking methods, and completion of those

methods relies on the FIDL thread being a separate thread.

Protected Members

unique_ptr in_stream_
const uint64_t max_buffer_size_
uint64_t valid_bytes_
vector data_

Public Methods

void InStreamBuffer (async::Loop * fidl_loop, thrd_t fidl_thread, sys::ComponentContext * component_context, std::unique_ptr<InStream> in_stream_to_wrap, uint64_t max_buffer_size)

in_stream_to_wrap - the underlying source of data, typically not capable

of ResetToStart(), to wrap such that ResetToStart() is possible and

fast.

This InStreamBuffer takes ownership of in_stream_to_wrap and does not

provide any direct access to in_stream_to_wrap, since the ResetToStart()

performed by this instance would only confuse any direct use of

in_stream_to_wrap.

The in_stream_to_wrap is only called during ReadBytes(), using the same

thread as those calls are made on.

The first three parameters to this constructor are for consistency in

threading across all InStream types. We want the InStream base class to

be able to assert that methods are being called on the correct thread, etc.

Defined at line 11 of file ../../src/media/codec/examples/use_media_decoder/in_stream_buffer.cc

void ~InStreamBuffer ()

Defined at line 25 of file ../../src/media/codec/examples/use_media_decoder/in_stream_buffer.cc

Protected Methods

zx_status_t ReadBytesInternal (uint32_t max_bytes_to_read, uint32_t * bytes_read_out, uint8_t * buffer_out, zx::time just_fail_deadline)

Defined at line 30 of file ../../src/media/codec/examples/use_media_decoder/in_stream_buffer.cc

zx_status_t ResetToStartInternal (zx::time just_fail_deadline)

Defined at line 55 of file ../../src/media/codec/examples/use_media_decoder/in_stream_buffer.cc

zx_status_t ReadMoreIfPossible (uint32_t bytes_to_read_if_possible, zx::time just_fail_deadline)

Defined at line 64 of file ../../src/media/codec/examples/use_media_decoder/in_stream_buffer.cc

void PropagateEosKnown ()

Defined at line 109 of file ../../src/media/codec/examples/use_media_decoder/in_stream_buffer.cc