mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-02 11:46:34 +02:00
Call read from executor
This commit is contained in:
parent
051ba91cfc
commit
6b24ec6a3d
2 changed files with 7 additions and 4 deletions
|
@ -24,6 +24,9 @@
|
||||||
#include "common/snap_exception.hpp"
|
#include "common/snap_exception.hpp"
|
||||||
#include "common/str_compat.hpp"
|
#include "common/str_compat.hpp"
|
||||||
|
|
||||||
|
// 3rd party headers
|
||||||
|
#include <boost/asio/post.hpp>
|
||||||
|
|
||||||
// standard headers
|
// standard headers
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -104,7 +107,7 @@ void AlsaStream::start()
|
||||||
tvEncodedChunk_ = std::chrono::steady_clock::now();
|
tvEncodedChunk_ = std::chrono::steady_clock::now();
|
||||||
PcmStream::start();
|
PcmStream::start();
|
||||||
// wait(read_timer_, std::chrono::milliseconds(chunk_ms_), [this] { do_read(); });
|
// wait(read_timer_, std::chrono::milliseconds(chunk_ms_), [this] { do_read(); });
|
||||||
do_read();
|
boost::asio::post(strand_, [this] { do_read(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -377,14 +380,14 @@ void AlsaStream::do_read()
|
||||||
{
|
{
|
||||||
LOG(INFO, LOG_TAG) << "next read < 0 (" << getName() << "): " << std::chrono::duration_cast<std::chrono::microseconds>(next_read).count() / 1000.
|
LOG(INFO, LOG_TAG) << "next read < 0 (" << getName() << "): " << std::chrono::duration_cast<std::chrono::microseconds>(next_read).count() / 1000.
|
||||||
<< " ms\n ";
|
<< " ms\n ";
|
||||||
do_read();
|
boost::asio::post(strand_, [this] { do_read(); });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// reading chunk_ms_ took longer than chunk_ms_
|
// reading chunk_ms_ took longer than chunk_ms_
|
||||||
resync(-next_read);
|
resync(-next_read);
|
||||||
first_ = true;
|
first_ = true;
|
||||||
do_read();
|
boost::asio::post(strand_, [this] { do_read(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
lastException_ = "";
|
lastException_ = "";
|
||||||
|
|
|
@ -150,7 +150,7 @@ void PosixStream::do_read()
|
||||||
{
|
{
|
||||||
LOG(INFO, LOG_TAG) << "next read < 0 (" << getName() << "): " << std::chrono::duration_cast<std::chrono::microseconds>(next_read).count() / 1000.
|
LOG(INFO, LOG_TAG) << "next read < 0 (" << getName() << "): " << std::chrono::duration_cast<std::chrono::microseconds>(next_read).count() / 1000.
|
||||||
<< " ms\n";
|
<< " ms\n";
|
||||||
do_read();
|
boost::asio::post(strand_, [this] { do_read(); });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue