mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-28 00:16:17 +02:00
configurable pipe read buffer
This commit is contained in:
parent
2756ec4897
commit
239e93de43
8 changed files with 39 additions and 16 deletions
|
@ -37,7 +37,7 @@ class PipeReader;
|
|||
class PipeListener
|
||||
{
|
||||
public:
|
||||
virtual void onChunkRead(const PipeReader* pipeReader, const msg::PcmChunk* chunk) = 0;
|
||||
virtual void onChunkRead(const PipeReader* pipeReader, const msg::PcmChunk* chunk, double duration) = 0;
|
||||
virtual void onResync(const PipeReader* pipeReader, double ms) = 0;
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ class PipeReader : public EncoderListener
|
|||
{
|
||||
public:
|
||||
/// ctor. Encoded PCM data is passed to the PipeListener
|
||||
PipeReader(PipeListener* pipeListener, const msg::SampleFormat& sampleFormat, const std::string& codec, const std::string& fifoName);
|
||||
PipeReader(PipeListener* pipeListener, const msg::SampleFormat& sampleFormat, const std::string& codec, const std::string& fifoName, size_t pcmReadMs = 20);
|
||||
virtual ~PipeReader();
|
||||
|
||||
void start();
|
||||
|
@ -66,12 +66,12 @@ public:
|
|||
protected:
|
||||
void worker();
|
||||
int fd_;
|
||||
size_t pcmReadMs_;
|
||||
timeval tvEncodedChunk_;
|
||||
std::atomic<bool> active_;
|
||||
std::thread readerThread_;
|
||||
PipeListener* pipeListener_;
|
||||
msg::SampleFormat sampleFormat_;
|
||||
size_t pcmReadMs_;
|
||||
std::unique_ptr<Encoder> encoder_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue