Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Sources/CSFBAudioEngine/Player/AudioPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,39 @@ class AudioPlayer final {
/// - note: This is the thread entry point for the decoding thread
void processDecoders(std::stop_token stoken) noexcept;

/// Processes decoder cancellations and returns the first active decoder state
DecoderState *_Nullable processDecoderCancellations(bool &formatMismatch, bool &ringBufferStale) noexcept;

/// Processes the pending seek for `decoderState`
bool processPendingSeek(DecoderState *_Nonnull decoderState, bool &formatMismatch, bool &ringBufferStale) noexcept;

/// Returns the first decoder state in `activeDecoders_` that has started decoding and has not been canceled
DecoderState *_Nullable firstIncompleteDecoderState() const noexcept;
Comment thread
sbooth marked this conversation as resolved.
Outdated

/// Rewinds ensuing decoders following a seek in `decoderState` if needed
void rewindEnsuingDecoders(DecoderState *_Nonnull decoderState) noexcept;

/// Dequeues and returns the next decoder or nullptr if none
DecoderState *_Nullable dequeueNextDecoder() noexcept;

/// Prepares `decoderState` for decoding
bool prepareDequeuedDecoder(DecoderState *_Nonnull decoderState) noexcept;

/// Allocates the buffer that is the intermediary between the decoder state and the ring buffer if needed
bool allocateDecodeBufferIfNeeded(AVAudioPCMBuffer *_Nullable __strong &buffer,
AVAudioFormat *_Nonnull renderFormat,
DecoderState *_Nonnull decoderState) noexcept;

/// Configures the processing graph for `decoderState` if able
bool configureForDecoder(DecoderState *_Nonnull &decoderState, AVAudioPCMBuffer *_Nullable __strong &buffer,
bool &formatMismatch) noexcept;
Comment thread
Copilot marked this conversation as resolved.

/// Decodes audio from `decoderState` into the ring buffer
bool decodeIntoRingBuffer(DecoderState *decoderState, AVAudioPCMBuffer *buffer) noexcept;

/// Returns the appropriate decoding semaphore timeout
int64_t decodingTimeout(DecoderState *_Nullable decoderState, bool formatMismatch) const noexcept;

// MARK: - Rendering

/// Render block implementation
Expand Down
Loading