output/osx: postpone start until the end of Play()
Wait until there is data in the ring buffer.
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann