output/pipewire: move code to CheckThrowError()
This commit is contained in:
parent
6015960871
commit
cfaf2ed03c
@ -78,6 +78,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void CheckThrowError() {
|
||||||
|
if (disconnected)
|
||||||
|
throw std::runtime_error("Disconnected from PipeWire");
|
||||||
|
}
|
||||||
|
|
||||||
void StateChanged(enum pw_stream_state state,
|
void StateChanged(enum pw_stream_state state,
|
||||||
[[maybe_unused]] const char *error) noexcept {
|
[[maybe_unused]] const char *error) noexcept {
|
||||||
const bool was_disconnected = disconnected;
|
const bool was_disconnected = disconnected;
|
||||||
@ -298,8 +303,7 @@ PipeWireOutput::Play(const void *chunk, size_t size)
|
|||||||
const PipeWire::ThreadLoopLock lock(thread_loop);
|
const PipeWire::ThreadLoopLock lock(thread_loop);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (disconnected)
|
CheckThrowError();
|
||||||
throw std::runtime_error("Disconnected from PipeWire");
|
|
||||||
|
|
||||||
std::size_t bytes_written =
|
std::size_t bytes_written =
|
||||||
ring_buffer->push((const std::byte *)chunk, size);
|
ring_buffer->push((const std::byte *)chunk, size);
|
||||||
|
Loading…
Reference in New Issue
Block a user