Commit Graph

102 Commits

Author SHA1 Message Date
Hajime Hoshi
97fa948e5e audio/internal/readerdriver: Bug fix: createBuffer failed when the buffer size is 0
When the decoded audio size is exactly multiples of an internal
buffer size, the buffer's size becomes exactly zero when being
appended. In this case, createBuffer fails and the application
crashes.

This change fixes this issue by skipping to append a buffer in such
cases.

Closes #1635
2021-05-07 02:37:30 +09:00
Hajime Hoshi
273f2fb8f4 audio/internal/readdriver: Bug fix: Implement Suspend/Resume for browsers
Closes #1630
2021-05-04 18:51:25 +09:00
Hajime Hoshi
08c3025560 audio/internal/readerdriver: Refactoring 2021-04-20 03:20:29 +09:00
Hajime Hoshi
24dc20e80e audio/internal/readerdriver: Bug fix: Need to align the buffer size 2021-04-20 02:39:33 +09:00
Hajime Hoshi
e650e71d8c audio/internal/readerdriver: Bug fix: ReadFull could get stuck
If the source io.Reader's implementation is not good (e.g., Read
returns 0 if the buffer size is not multiples of 4), io.ReadFull
gets stuck forever. Instead, use reguler Read with a decent amount
of bytes buffer.

Closes #1599
2021-04-20 01:29:15 +09:00
Hajime Hoshi
146678596b audio/internal/readerdriver: Bug fix: Invoke onReady for go2cpp
Updates #1599
2021-04-19 23:59:31 +09:00
Hajime Hoshi
ea9d64f5b8 audio: Bug fix: Need to call setReady from the reader player side
Updates #1599
2021-04-19 23:56:08 +09:00
Hajime Hoshi
83dc3966e7 audio/internal/go2cpp: Bug fix: Set the volume whenever the player state is 2021-03-31 21:08:32 +09:00
Hajime Hoshi
f0d7e16eb2 audio/internal/readerdriver: Refactoring 2021-03-28 23:27:47 +09:00
Hajime Hoshi
f4efdd6355 audio/internal/go2cpp: Protect the functions by the lock correctly 2021-03-28 22:40:36 +09:00
Hajime Hoshi
f4b770eff6 audio/internal/readerdriver: Add Player.Err 2021-03-28 22:21:07 +09:00
Hajime Hoshi
b46cb324ed audio: Add audio/internal/readerdriver package 2021-03-28 18:34:16 +09:00
Hajime Hoshi
1083233d5f audio/internal/go2cpp: Replace isWritable with unplayedBufferSize instead
This is the more accurate way not to overflow the underlying buffer.
2021-03-23 23:46:57 +09:00
Hajime Hoshi
9e73b0d287 audio: Rename UnwrittenBufferSize -> UnplayedBufferSize 2021-03-01 01:27:42 +09:00
Hajime Hoshi
dbdfce5fed audio: Add readerDriverPlayer.UnwrittenBufferSize to get the exact position 2021-02-28 01:42:48 +09:00
Hajime Hoshi
29099cf660 audio: Bug fix: Continue to play the audio after seeking on go2cpp 2021-02-21 23:54:43 +09:00
Hajime Hoshi
68411e9591 audio/internal/go2cpp: Avoid unnecessary allocations 2021-01-25 03:09:13 +09:00
Hajime Hoshi
c8ba51d26e audio/internal/convert: Avoid unnecessary allocations 2021-01-25 03:04:53 +09:00
Hajime Hoshi
2432530b51 Revert "audio/internal/go2cpp: Fix C++ side and remove the preparation"
This reverts commit 65f974588c.

Reason: Didn't improve the performance on some devices
2021-01-17 04:48:11 +09:00
Hajime Hoshi
65f974588c audio/internal/go2cpp: Fix C++ side and remove the preparation 2021-01-17 03:47:45 +09:00
Hajime Hoshi
ed7d7e8976 audio/internal/go2cpp: Prepare the first buffer data to make the audio smoother 2021-01-16 03:28:47 +09:00
Hajime Hoshi
c742ae60bd audio: Bug fix: Implement renaderPlayer.IsPlayer correctly 2021-01-16 01:02:07 +09:00
Hajime Hoshi
ad218eae2d audio/internal/convert: Reduce allocations of float32 slices 2021-01-15 00:37:21 +09:00
Hajime Hoshi
612676cb19 audio/internal/go2cpp: Remove the buffer size argument 2021-01-13 22:30:52 +09:00
Hajime Hoshi
aeaa443bf2 audio/internal/go2cpp: Bug fix: Writing data must be concurrent-safe 2021-01-13 10:26:30 +09:00
Hajime Hoshi
2f8172f819 audio/internal/go2cpp: Recreate the underlying audio player when resetting 2021-01-12 20:42:45 +09:00
Hajime Hoshi
a66097df19 audio/internal/go2cpp: Remove unnecessary set 2021-01-12 11:38:30 +09:00
Hajime Hoshi
2dc37d30de audio/internal/go2cpp: Add a comment 2021-01-12 01:07:36 +09:00
Hajime Hoshi
a7dd00596a audio/internal/go2cpp: Add signaling at Pause 2021-01-12 00:43:16 +09:00
Hajime Hoshi
c009070840 audio/internal/go2cpp: Add readerDriverPlayer.Reset 2021-01-11 23:54:43 +09:00
Hajime Hoshi
3abb7a3604 audio/internal/go2cpp: Increase the temporary buffer size 2021-01-11 21:56:47 +09:00
Hajime Hoshi
8e6c3a570e audio/internal/go2cpp: Bug fix: Pass the correct size 2021-01-11 18:07:25 +09:00
Hajime Hoshi
9cc5bd80f9 audio/internal/go2cpp: Better waiting condition 2021-01-11 15:37:40 +09:00
Hajime Hoshi
dc8217dfeb audio/internal/go2cpp: Bug fix: Wrong state 2021-01-11 15:25:53 +09:00
Hajime Hoshi
52942751f0 audio: Move go2cpp -> internal/go2cpp 2021-01-09 18:21:32 +09:00
Hajime Hoshi
3fb304e5a8 audio/internal/convert: Refactoring 2021-01-04 21:42:00 +09:00
Hajime Hoshi
f1f7b350de audio, audio/mp3, audio/vorbis, audio/wav: Remove Close functions
Fixes #859
2020-10-07 23:39:58 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
cba109ebee audio/mp3: Bug fix: Accept non-io.Closer at Resampling 2019-04-01 00:04:57 +09:00
Hajime Hoshi
f16f6cf4b9 audio/internal/convert: Add Float32Reader and NewReaderFromFloat32Reader 2019-01-15 11:46:31 +09:00
Hajime Hoshi
5c55df87d7 audio: Deprecate Size() and add Length() (#466) 2018-01-09 01:25:38 +09:00
Hajime Hoshi
ef282f7f4f audio/internal/convert: Remove unused functions 2018-01-09 00:26:54 +09:00
Hajime Hoshi
e83810fc57 audio/internal/convert: Add resampling_test.go
Fixes #369
2018-01-08 23:44:44 +09:00
Hajime Hoshi
11a1e6ec39 audio/internal/convert: Adjust window size again (confirmed this worked well on iPhone 6) 2018-01-06 01:49:55 +09:00
Hajime Hoshi
5b2dbf6036 audio/internal/convert: Adjust resamplingBufferSize again 2018-01-06 01:46:54 +09:00
Hajime Hoshi
ab70f6fc58 audio/internal/convert: Much faster sine/cosine functions 2018-01-06 00:15:07 +09:00
Hajime Hoshi
005d18ceff audio/internal/convert: Use int64 (now it is fast enough on browsers?) 2018-01-05 20:03:17 +09:00
Hajime Hoshi
c020101afc audio/internal/convert: Use cosine table 2018-01-05 19:40:12 +09:00
Hajime Hoshi
2884fb7070 audio/internal/convert: Fix algorithm 2018-01-05 18:21:14 +09:00
Hajime Hoshi
de1a22d9f3 audio/internal/convert: Bug fix: remove unneeded import 2017-12-31 00:15:36 +09:00