class WritableStream
Defined at line 361 of file ../../src/media/audio/audio_core/stream.h
A write-only stream of audio data.
Public Methods
void WritableStream (std::string name, Format format)
Defined at line 399 of file ../../src/media/audio/audio_core/stream.h
std::optional<Buffer> WriteLock (int64_t start_frame, int64_t frame_count)
WritableStream is implemented by audio sinks. WriteLock acquires a write lock on the
stream. The parameters `start_frame` and `frame_count` represent a range of frames on the
stream's frame timeline.
If data cannot be written to that frame range, WriteLock returns std::nullopt.
Otherwise, WriteLock returns a buffer representing all or part of the requested range.
If `start()` on the returned buffer is greater than `start_frame`, then frames before
`start()` must not be written. Conversely, if `end()` on the returned buffer is less than
`start_frame + frame_count`, this does not indicate those frames can be omitted. Instead
it indicates the full frame range is not available on a single contiguous buffer. Clients
should call `WriteLock` again and provide the `end()` of the previous buffer as `start_frame`
to query if the stream has more frames.
The returned buffer must not refer to frames outside of the range
[start_frame, start_frame + frame_count).
Callers can write directly to the payload. The buffer will remain locked until it is
destructed. It is illegal to call WriteLock again until the lock has been released.