summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-07-02 15:22:16 +0200
committerMax Kellermann <max@musicpd.org>2020-07-02 15:26:38 +0200
commitdaefc61aa4f603418a28994343bf21e335b2e94e (patch)
tree04d794d1d8e6b20fd51a3a7b4b2b456b6d501213 /src/output
parent6fed6e50e4ab0844133ae20ad834b5d65ecd89e4 (diff)
output/osx: postpone start until the end of Play()
Wait until there is data in the ring buffer.
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/OSXOutputPlugin.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/output/plugins/OSXOutputPlugin.cxx b/src/output/plugins/OSXOutputPlugin.cxx
index a041fcbcd..0a51af7a5 100644
--- a/src/output/plugins/OSXOutputPlugin.cxx
+++ b/src/output/plugins/OSXOutputPlugin.cxx
@@ -769,14 +769,6 @@ OSXOutput::Play(const void *chunk, size_t size)
pause = false;
- if (!started) {
- OSStatus status = AudioOutputUnitStart(au);
- if (status != noErr)
- throw std::runtime_error("Unable to restart audio output after pause");
-
- started = true;
- }
-
ConstBuffer<uint8_t> input((const uint8_t *)chunk, size);
#ifdef ENABLE_DSD
@@ -795,6 +787,14 @@ OSXOutput::Play(const void *chunk, size_t size)
size_t bytes_written = ring_buffer->push(input.data, input.size);
+ if (!started) {
+ OSStatus status = AudioOutputUnitStart(au);
+ if (status != noErr)
+ throw std::runtime_error("Unable to restart audio output after pause");
+
+ started = true;
+ }
+
#ifdef ENABLE_DSD
if (dop_enabled)
bytes_written = pcm_export->CalcSourceSize(bytes_written);