making WEB

Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-11 00:45:17 +03:00
1 parent d146f11f02
commit 5c036d91fb
72 files changed
+5875 -1243

No files matched your search

+23
View File
@@ -67,9 +67,26 @@ namespace Echoion::Core
// Check if decode is finished
[[nodiscard]] bool isFinished() const { return eof_.load(); }
// Decoded audio waiting in the queue, in interleaved S16 samples.
// The crossfade readiness gate uses this: a fade only starts once
// the incoming decoder has buffered enough audio to survive it.
[[nodiscard]] std::size_t queuedSamples() const;
// True when the decode queue is at capacity (the decode thread is
// backpressured) — waiting longer cannot buffer any more.
[[nodiscard]] bool queueSaturated() const;
private:
void decodeThread();
// One read→decode→flush pass over the source; returns on EOF or
// shutdown. decodeThread() parks between sessions awaiting a
// seek request, so a post-EOF seek resumes decoding.
void decodeSession();
// Perform a pending seek request on the decode thread (the only
// thread allowed to touch the FFmpeg contexts while decoding).
// Returns true if a request was consumed.
bool consumePendingSeek();
// Borrow a chunk buffer of `samples` length from the recycle
// free-list (reusing pooled storage), or allocate one if the
// free-list is empty.
@@ -100,6 +117,9 @@ namespace Echoion::Core
// S16 audio queue (like reference) - avoids float conversion
std::deque<std::vector<int16_t>> int16Queue_;
static constexpr size_t MAX_INT16_QUEUE_SIZE = 100;
// Max samples per swr_convert() output call; outputBuffer_ is
// sized for this.
static constexpr int MAX_OUT_SAMPLES = 4096;
// Free-list of recycled chunk buffers. getNextChunk() swaps the
// caller's previous buffer in here and decodeThread() reuses that
@@ -116,6 +136,9 @@ namespace Echoion::Core
// Decode position in ms; written by the decode thread per frame,
// read cross-thread by getPosition() (prefetch decisions).
std::atomic<int64_t> currentPositionMs_{0};
// Pending seek target in ms, -1 = none. Written by seek() under
// mutex_ (coordinated with eof_), consumed by the decode thread.
std::atomic<int64_t> seekRequestMs_{-1};
std::string currentUrl_;
std::atomic<uint32_t> streamSampleRate_{48000};