Commit Graph

30 Commits

Author SHA1 Message Date
Hajime Hoshi
95c494f47e audio/internal/readerdriver: Share one goroutine to read the source to the buffers (iOS/macOS)
This fix improves the latency of the audio.

Closes #1662
2021-06-09 01:52:21 +09:00
Hajime Hoshi
72d8d77173 audio/internal/readerdriver: Bug fix: AudioQueuePause/Reset might take long time
This issue has existed since ae14caee93.
This change fixes the issue by skipping the C function calls when
possible.

Updates #1650
2021-05-28 02:51:14 +09:00
Hajime Hoshi
91d3d6b4e7 audio/internal/readerdriver: Bug fix: Avoid busy loop when EOF is reached
This is a part of reverting 81015a3c19.

On Drawin, the loop became busy when the source reached EOF. This
change fixes this issue by making the loop wait when the EOF is
reached and until the state is reset.

Updates #1650
2021-05-26 03:37:50 +09:00
Hajime Hoshi
e43dcc2265 audio/internal/readerdriver: Bug fix: An error was overwritten 2021-05-18 21:08:26 +09:00
Hajime Hoshi
ae14caee93 audio/internal/readerdriver: Refactoring (darwin) 2021-05-17 23:18:55 +09:00
Hajime Hoshi
58f6eb0dea audio/internal/readerdriver: Refactoring 2021-05-17 04:04:04 +09:00
Hajime Hoshi
66999989e1 audio/internal/readerdriver: Bug fix: Need to lock the callback logic 2021-05-17 04:03:04 +09:00
Hajime Hoshi
089883aba0 audio/internal/readerdriver: Refactoring 2021-05-17 03:51:24 +09:00
Hajime Hoshi
cf6edae5b3 audio/internal/readerdriver: Bug fix: Protect playImpl by the mutex on Darwin 2021-05-16 20:07:51 +09:00
Hajime Hoshi
49172a235b audio/internal/readerdriver: Bug fix: AudioQueueFlush was not needed
Rather, AudioQueueFlush after AudioQueueReset might cause an error.

Closes #1644
2021-05-15 22:47:09 +09:00
Hajime Hoshi
81015a3c19 audio/internal/readerdriver: Refactoring: EOF doesn't matter to determine when to stop the waiting 2021-05-15 22:39:54 +09:00
Hajime Hoshi
52c609459c audio/internal/readerdriver: Change the returning type of UnplayedBufferSize int64 -> int 2021-05-10 03:22:19 +09:00
Hajime Hoshi
737ccf18fb audio/internal/readerdriver: Make Play async internally on macOS and iOS
Updates #1638
2021-05-09 22:03:48 +09:00
Hajime Hoshi
a285a84df0 audio/internal/readerdriver: Use AudioQueuePrime 2021-05-09 21:31:55 +09:00
Hajime Hoshi
6644e43025 audio/internal/readerdriver: Bug fix: AudioQueueStop might invoke the callback and then caused deadlock 2021-05-09 21:07:39 +09:00
Hajime Hoshi
015475ad2c audio/interal/readerdriver: Misspelling 2021-05-09 19:55:12 +09:00
Hajime Hoshi
d9972822e2 audio/internal/readerdriver: unqueuedBufs should be reset when the player is reused later 2021-05-09 19:54:34 +09:00
Hajime Hoshi
f04230da08 audio/internal/readerdriver: Bug fix: The player became closed unexpectedly 2021-05-09 19:35:36 +09:00
Hajime Hoshi
87956560f3 audio/internal/readerdriver: Implement for iOS
Updates #1549
2021-05-09 19:04:59 +09:00
Hajime Hoshi
c85ef4e40b audio/internal/readerdriver: Bug fix: Deadlock at resuming 2021-05-09 18:30:46 +09:00
Hajime Hoshi
fa13b81d38 audio/internal/readerdriver: Prepare AudioQueues first
Updates #1638
2021-05-09 17:24:00 +09:00
Hajime Hoshi
ac2753f411 audio/internal/readerdriver: Reuse AudioQueue whenever possible
AudioQueueStart is expensive when the AudioQueue was newly created.
To mitigate the cost, cache and reuse AudioQueue instances.

Closes #1638
2021-05-09 16:30:24 +09:00
Hajime Hoshi
9caead5a38 audio/internal/readerdriver: Refactoring: Remove player.id 2021-05-09 15:53:33 +09:00
Hajime Hoshi
383bceddd5 audio/internal/readerdriver: Refactoring 2021-05-09 14:41:23 +09:00
Hajime Hoshi
f9b8238cd6 audio/internal/readerdriver: Disable operations when an error is recorded 2021-05-09 05:58:55 +09:00
Hajime Hoshi
7eeaef7ff8 audio/internal/readerdriver: Refactoring 2021-05-09 05:46:55 +09:00
Hajime Hoshi
22567d20b6 audio/internal/readerdriver: Implement {,Set}Volume for macOS 2021-05-09 05:36:03 +09:00
Hajime Hoshi
9df1092507 audio/internal/readerdriver: Bug fix: AudioQueue{Pause,Reset,Flush} cannot be called before AudioQueueStart 2021-05-09 05:28:42 +09:00
Hajime Hoshi
bc22ab53b2 audio/internal/readerdriver: Add comments 2021-05-09 05:01:51 +09:00
Hajime Hoshi
eb3301d30c audio/internal/readerdriver: Implement a reader-style driver for macOS
Updates #1549
2021-05-09 04:56:31 +09:00