History log of /frameworks/base/media/jni/soundpool/SoundPool.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0474773aab24594f4f4d395bf058d6f5b16db958 30-Mar-2016 Andy Hung <hunga@google.com> Stop SoundPool decode if NdkMediaCodec returns null buffers

Also increase error checking.

Bug: 27346228
Change-Id: Ib94505f852344298f88a3fdcbd65ca8031084188
/frameworks/base/media/jni/soundpool/SoundPool.cpp
bd2c3d65d6b62b5a359268246e7ebe96904bd851 14-Dec-2015 Glenn Kasten <gkasten@google.com> Use FCC_2 and FCC_8 to highlight channel count assumptions

Bug: 21656069
Change-Id: I20a74575eddf6e28f1777d04eeab396f28bcc0cc
/frameworks/base/media/jni/soundpool/SoundPool.cpp
0275a982abecee683f16c827d405eafe51fb67ae 01-Dec-2015 Andy Hung <hunga@google.com> SoundPool: add lock for findSample access from SoundPoolThread

Sample decoding still occurs in SoundPoolThread
without holding the SoundPool lock.

Bug: 25781119
Change-Id: I11fde005aa9cf5438e0390a0d2dfe0ec1dd282e8
/frameworks/base/media/jni/soundpool/SoundPool.cpp
2f01c806e06632f8b9db8ea127d704e13811cb8e 15-Sep-2015 Marco Nelissen <marcone@google.com> Stop SoundPool on error instead of continuing

otherwise we might end up looping forever.

Change-Id: I86e33de5387e3acd148d9bba83d18224bb79fd95
/frameworks/base/media/jni/soundpool/SoundPool.cpp
14d226a2cd7b39e17a3f0bfdab79e645f7146f53 18-May-2015 Glenn Kasten <gkasten@google.com> Add comments to indicate code review was done for bugs

Bug: 20818955
Bug: 20890069
Change-Id: I243205b99b198eb1b5a1a027b27cbb7d5aaaa8db
/frameworks/base/media/jni/soundpool/SoundPool.cpp
a6238ef3891bbbdb1c42d3e7954c4cd55527cef6 16-May-2015 Andy Hung <hunga@google.com> Fix SoundPool.unload() return value

Bug: 21209627
Change-Id: Ifd5c5f349894744c192cad10c5c875882566ec53
/frameworks/base/media/jni/soundpool/SoundPool.cpp
6c307879b75f3eac2179b23ac309df0e4ce9cedd 14-May-2015 Jean-Michel Trivi <jmtrivi@google.com> AudioTrack in SoundPool uses audio_attributes_t parameter

Bug 20731155

Change-Id: I62ce9d5c5a88aaf534cfd1861378215f9253248d
/frameworks/base/media/jni/soundpool/SoundPool.cpp
26eca01c490f643fc2558be4c5477a1d433a8a07 29-Apr-2015 Andy Hung <hunga@google.com> Check for null codec from AMediaCodec_createDecoderByType

NULL codec can now occur if codec cannot be created.

Bug: 20566134
Change-Id: I08d54e733a01d0614313673dc49a6f5e702633ac
/frameworks/base/media/jni/soundpool/SoundPool.cpp
32ccb69fdeeeb236d9c5f2a4335b44d1d0c4b042 28-Mar-2015 Andy Hung <hunga@google.com> Fix SoundPool track recycling for fast tracks

Bug: 19970735
Change-Id: I075d04a688383139484f24ba4be2829c5220c57e
/frameworks/base/media/jni/soundpool/SoundPool.cpp
2bec0fe3a7287c65db14fbb6fad784e38179efc4 18-Mar-2015 Andy Hung <hunga@google.com> Merge "Revert "Revert "soundpool: update sample rate when reusing audiotrack"""
9bd868fe7ae712507211fff14b30981195dc96ce 18-Mar-2015 Andy Hung <hunga@google.com> Merge "Revert "Revert "soundpool: reuse channel for same sample if available"""
bc4537393b02b39433e07fed4ed57186d8e5959f 18-Mar-2015 Andy Hung <hunga@google.com> Revert "Revert "soundpool: update sample rate when reusing audiotrack""

This reverts commit b801f73343194cd081f675a5dc2b3e90959cf6d1.

Change-Id: I0f6ee7fc981d65040f32e7852a5f66fd391b329d
/frameworks/base/media/jni/soundpool/SoundPool.cpp
0c4b81bd3ef3fd5eb0f7d1b8e2c6168b95020134 18-Mar-2015 Andy Hung <hunga@google.com> Revert "Revert "soundpool: reuse channel for same sample if available""

This reverts commit 18c225d05480e7b80b312ef90d15789b34ce6bbc.

Change-Id: If91b4b0fb94df1d910cbaa0a7944001b2baa7be3
/frameworks/base/media/jni/soundpool/SoundPool.cpp
a080050e4209cab9c81ae2144eed9c7c67e87f17 10-Mar-2015 Glenn Kasten <gkasten@google.com> Merge "Revert "soundpool: reuse channel for same sample if available""
01771a9f7d9a76dd9bf8adb14717c9bea288ff97 10-Mar-2015 Glenn Kasten <gkasten@google.com> Merge "Revert "soundpool: update sample rate when reusing audiotrack""
18c225d05480e7b80b312ef90d15789b34ce6bbc 09-Mar-2015 Glenn Kasten <gkasten@google.com> Revert "soundpool: reuse channel for same sample if available"

This reverts commit 570576b51b8123ab05b36707ec752cf966292ca5.

Bug: 19635137
Change-Id: I8385ac4c151a375c19c3606698081c947b6216e3
/frameworks/base/media/jni/soundpool/SoundPool.cpp
b801f73343194cd081f675a5dc2b3e90959cf6d1 09-Mar-2015 Glenn Kasten <gkasten@google.com> Revert "soundpool: update sample rate when reusing audiotrack"

This reverts commit a7d57a6f0068b1e2a0f07ca427cfba198b12a9b9.

Bug: 19635137
Change-Id: I1f53a432936dd3d51459e7d8cd86421bde399150
/frameworks/base/media/jni/soundpool/SoundPool.cpp
a1c3516a243d00428ff2b470409d47cc9f5c9523 07-Mar-2015 Andy Hung <hunga@google.com> Fix SoundPool playback of multichannel files.

Bug: 17188507
Change-Id: Ia4e43c7f8889181b998673b75b1f3bbf8c43f429
/frameworks/base/media/jni/soundpool/SoundPool.cpp
a7d57a6f0068b1e2a0f07ca427cfba198b12a9b9 03-Mar-2015 Dhananjay Kumar <dhakumar@codeaurora.org> soundpool: update sample rate when reusing audiotrack

User might update playback rate while calling Play on a sample.
Update sample rate if reusing existing audio track.

Change-Id: I7007c335fa405baf663a322408b92b9df53efdb0
Signed-off-by: Glenn Kasten <gkasten@google.com>
/frameworks/base/media/jni/soundpool/SoundPool.cpp
570576b51b8123ab05b36707ec752cf966292ca5 30-Jan-2015 Haynes Mathew George <hgeorge@codeaurora.org> soundpool: reuse channel for same sample if available

Reuse channel for same sample if the channel completed
current playback and is not reallocated to another sample,
i.e. not stolen by other sample.

authored-by: Ashish Jain <ashishj@codeaurora.org>

Change-Id: Ibe7ee318c7dc11f3c4fd3a2f57d861318b10973b
Signed-off-by: Glenn Kasten <gkasten@google.com>
/frameworks/base/media/jni/soundpool/SoundPool.cpp
06524dccbc35cdeed92d0b5ec96b42d43518d7ed 11-Feb-2015 Marco Nelissen <marcone@google.com> Fix memory leak

Change-Id: Id691f9b32f9daeb23a01b17c5418b4d74a294cda
/frameworks/base/media/jni/soundpool/SoundPool.cpp
6cd6110773bf83638f21a76d388dc2b7037df0d8 27-Jan-2015 Marco Nelissen <marcone@google.com> Fix printf format

Change-Id: Ied2f10bb59fe0e13b23bf1f9913ab3b081348a28
/frameworks/base/media/jni/soundpool/SoundPool.cpp
372be8970c6ab68c295fb74dbb878ab1d443d90e 04-Dec-2014 Marco Nelissen <marcone@google.com> Make SoundPool use MediaCodec

Bug: 18239054
Change-Id: Ia144fc1bbb0d2787638ee972e2224339b4965310
/frameworks/base/media/jni/soundpool/SoundPool.cpp
f5e18125498b768d4528e4d1c19533c2b16f338b 26-Mar-2012 Eric Laurent <elaurent@google.com> reorganize SoundPool and JetPlayer code.

Reorganize SoundPool and JetPlayer code to be ready for the
creation of libmedia_native.

Split SoundPool between libsoundpool (JNI) and libmedia(sound pool implementation).
Remove dependencies on nativehelper/jni.h from JetPlayer.

Change-Id: I130c6014173b714329929dd82c5dfb70b757a610
/frameworks/base/media/jni/soundpool/SoundPool.cpp
28b269f3418c27275bbf635e524ed501bfac6518 07-Mar-2012 Glenn Kasten <gkasten@google.com> Use audio_policy_output_flags_t consistently

This affects:
- IAudioFlinger::openOutput
- AudioTrack::AudioTrack
- AudioTrack::set
- apps that call these

Change-Id: I26fb281bac6cb87593d17697bc9cb37a835af205
/frameworks/base/media/jni/soundpool/SoundPool.cpp
b3db213eb55acb661e4b9ea40bcc00af4b76fab9 19-Jan-2012 Glenn Kasten <gkasten@google.com> Update comments

We no longer put the filename at start of file.

Change-Id: Ic435b159a23105681e3d4a6cb1ac097bc853302e
/frameworks/base/media/jni/soundpool/SoundPool.cpp
1137be1a686fdfc9f02c3aca7c33f28006df4742 09-Feb-2012 Glenn Kasten <gkasten@google.com> Follow raw pointer and sp<> conventions

Unconditional delete for raw pointers.
Use "if (sp != 0)" not "if (sp.get() != 0)" or "if (sp != NULL)".
Use "if (raw != NULL)" not "if (raw)".

Change-Id: I531a8da7c37149261ed2f34b862ec4896a4b785b
/frameworks/base/media/jni/soundpool/SoundPool.cpp
bc1d77b6cbce23fbe25f7231651037ae195bc90e 13-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_stream_type_t consistently

At native level it was a mixture of audio_stream_type_t, int, uint32_t,
and uint8_t. Java is still int. Also fixed a couple of hard-coded -1
instead of AUDIO_STREAM_DEFAULT, and in startToneCommand a hard-coded 0
instead of AUDIO_STREAM_VOICE_CALL.

Change-Id: Ia33bfd70edca8c2daec9052984b369cd8eee2a83
/frameworks/base/media/jni/soundpool/SoundPool.cpp
1c66547ba25be6a1893df0ae26857f649474843a 12-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use audio_format_t consistently"
3762c311729fe9f3af085c14c5c1fb471d994c03 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
/frameworks/base/media/jni/soundpool/SoundPool.cpp
8564c8da817a845353d213acd8636b76f567b234 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
/frameworks/base/media/jni/soundpool/SoundPool.cpp
1c5a89d4af193e3ce9be9992ffee0ab0a4d8da5a 04-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_format_t consistently

Was int, uint32_t, uint16_t, and uint8_t with 2-bit bitfield.
Also replace 0 by AUDIO_FORMAT_DEFAULT and replace 1 by
AUDIO_FORMAT_PCM_16_BIT.

Change-Id: Ia8804f53f1725669e368857d5bb2044917e17975
/frameworks/base/media/jni/soundpool/SoundPool.cpp
71f2cf116aab893e224056c38ab146bd1538dd3e 20-Oct-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/143865

Bug: 5449033
Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
/frameworks/base/media/jni/soundpool/SoundPool.cpp
79cd8ba46b1ac15f75174beebc1411edea32c05b 15-Jun-2011 Glenn Kasten <gkasten@google.com> Remove unneeded #include <sys/resource.h>

Suggested in code review for previous change.

Change-Id: Ic3225b240367dc6c9bf56fb4498fb8a0f9f806ec
/frameworks/base/media/jni/soundpool/SoundPool.cpp
e46a86fcb6a0849fc05c4cade6cb94aad0325295 02-Jun-2011 Glenn Kasten <gkasten@google.com> Revert "Use AudioTrack::event_type not int in callback"

This reverts commit 2225e4b7049fa3fb9d39a068b8268b63c952d7c1
/frameworks/base/media/jni/soundpool/SoundPool.cpp
2225e4b7049fa3fb9d39a068b8268b63c952d7c1 05-May-2011 Glenn Kasten <gkasten@google.com> Use AudioTrack::event_type not int in callback

Change-Id: Ifefc708d46874e04fd0d01cb6e2d43b987ee796c
/frameworks/base/media/jni/soundpool/SoundPool.cpp
34bb419e5946ab28112e9e27a4d1b3928d31e0e2 11-May-2011 Dima Zavin <dima@android.com> update for new audio.h header location

Change-Id: Ic4c62c4037800802427eb7d3c7f5eb8b25d18876
Signed-off-by: Dima Zavin <dima@android.com>
/frameworks/base/media/jni/soundpool/SoundPool.cpp
24fc2fb1c541e954b83fd31ea9f786a5e9b45501 20-Apr-2011 Dima Zavin <dima@android.com> audio/media: convert to using the audio HAL and new audio defs

Change-Id: Ibc637918637329e4f2b62f4ac7781102fbc269f5
Signed-off-by: Dima Zavin <dima@android.com>
/frameworks/base/media/jni/soundpool/SoundPool.cpp
a60e212d0dda7d2a748180ce77405f2463c9cf53 29-Dec-2010 Eric Laurent <elaurent@google.com> Fix issue 3261656.

The problem can occur if a sample is started at the same time as the last AudioTrack callback
for a playing sample is called. At this time, allocateChannel() can be called concurrently with moveToFront()
which can cause an entry in mChannels being used by moveToFront() to be erased temporarily by allocateChannel().

The fix consists in making sure that the SoundPool mutex is held whenever play(), stop() or done() are called.

In addition, other potential weaknesses have been removed by making sure that the channel mutex is held while
starting, stopping and processing the AudioTrack call back.

To that purpose, a mechanism similar to the channel restart method is implemented to avoid stopping channels
from the AudioTrack call back but do it from the restart thread instead.

The sound effects SounPool management in AudioService has also been improved to make sure that the samples have
been loaded when a playback request is received and also to immediately release the SoundPool when the effects are
unloaded without waiting for the GC to occur.
The SoundPool.java class was modified to allow the use of a looper attached to the thread in which the sample
loaded listener is running and not to the thread in which the SoundPool is created.

The maximum number of samples that can be loaded in a SoundPool lifetime as been increased from 255 to 65535.

Change-Id: I368a3bdfda4239f807f857c3e97b70f6b31b0af3
/frameworks/base/media/jni/soundpool/SoundPool.cpp
09468dbbe9d91214a171a2b2f43bd37795f0b8c1 11-Mar-2010 Steve Howard <showard@google.com> Add a name to the previously-unnamed thread created by SoundPoolThread.

SoundPool itself also creates a thread, which was called "SoundPoolThread", unrelated to the SoundPoolThread class. The SoundPoolThread class then created an unnamed thread, which showed up as "android:unnamed_thread". That's confusing, so this change renames the SoundPool thread to "SoundPool" and then names the SoundPoolThread thread as "SoundPoolThread". Say that ten times fast :)

Change-Id: I67b7e644a30c94b6eda44bf970764a52a1c2958b
/frameworks/base/media/jni/soundpool/SoundPool.cpp
7bef5a58f1166c0e2509e27ace07c7af7c5d1d20 17-Feb-2010 Dave Sparks <davidsparks@android.com> Fix logging in SoundPool.
/frameworks/base/media/jni/soundpool/SoundPool.cpp
f992cbb9aae593c7787ac9c5f6b475e7bb0a92c5 09-Feb-2010 Dave Sparks <davidsparks@android.com> Add SoundPool API to pause and resume all active streams. Bug 2426531.
/frameworks/base/media/jni/soundpool/SoundPool.cpp
f6e43bf29084760b39257b2273e0f04c2815fdc5 08-Dec-2009 Dave Sparks <davidsparks@android.com> Add OnLoadCompleteListener to SoundPool.
/frameworks/base/media/jni/soundpool/SoundPool.cpp
c333133107fb492de481a96ed1277e71daf2dd8c 16-Dec-2009 Dave Sparks <davidsparks@android.com> am b5fc8ffc: am 91487425: Merge change I0448ef20 into eclair

Merge commit 'b5fc8ffcff6b8e1747af5c6ba1176a81986b55a8'

* commit 'b5fc8ffcff6b8e1747af5c6ba1176a81986b55a8':
Fix SoundPool buffer size rounding error. Bug 2327620.
66d28cedd92dcc1669ace23231da1b8c1374ff2f 15-Dec-2009 Dave Sparks <davidsparks@android.com> Fix SoundPool buffer size rounding error. Bug 2327620.

AudioTrack was modified earlier to calculate minimum buffer size
based on the hardware reported latency. Previously, it was a
hard-coded value. As a result of this change, the minimum buffer
size is now variable based on hardware latency. On Passion, this
brought out a subtle rounding error in the buffer size calculation
in SoundPool. This can cause AudioTrack creation to fail based on
the requested sample rate. This fix calculates the total buffer
size first, and then does rounding before dividing by the number
of buffers.
/frameworks/base/media/jni/soundpool/SoundPool.cpp
c0e3ddf8f2f30dc9593f0a1bfd46335823e25d65 07-Dec-2009 Dave Sparks <davidsparks@android.com> Remove unused Java object reference in native SoundPool code.
/frameworks/base/media/jni/soundpool/SoundPool.cpp
1b0efec3473134fb7de226f3e1fdade5b3529ad9 31-Jul-2009 Android (Google) Code Review <android-gerrit@google.com> am 17c195c8: Merge change 9340 into donut

Merge commit '17c195c8da3470b2e69880e206342f0c2d85f938'

* commit '17c195c8da3470b2e69880e206342f0c2d85f938':
Fix issue 2025872: Deadlock in SoundPool.stop
fd8c0e1ff8ef781ba169c0164458ec1ce95ee35c 31-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 2025872: Deadlock in SoundPool.stop

There were 2 problems in SoundPool:

1 If not using the shared memory buffer mode, there was a problem when a sound channel was stolen. The new channel could sometimes not be added to the restart
list if the AudioTrack callback thread was stopped before the underrun callback was called.

The SoundChannel::play() method is modified so that SoundPool::done() is called immediately after stopping the channel. There is a possibility that done() is called a second time by the callback; in this case it will be added 2 times to the restart list but the second start request will be ignored as the first one will have reset the next chennel ID when processed.

2 There was a deadlock on SoundPool::mLock if SoundPool::stop() was called while a channel restart was pending:
SoundPool::stop() lock mLock -> SoundChannel::stop() -> SoundPool::done() -> SoundPool::addToRestartList() -> try to lock mLock == deadlock

A second mutex mRestartLock is added to protect the restart list mRestart. mLock is still used to protect mChannels list but mRestart is now used to
protect access to mRestart by restart thread and client thread.
/frameworks/base/media/jni/soundpool/SoundPool.cpp
a553c25b33c99b345cf1c8688f8df0ed8df14e5a 17-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 1795088 Improve audio routing code

Initial commit for review.
Integrated comments after patch set 1 review.
Fixed lockup in AudioFlinger::ThreadBase::exit()
Fixed lockup when playing tone with AudioPlocyService startTone()
/frameworks/base/media/jni/soundpool/SoundPool.cpp
45fce58ca1f8d967bdca574e79837ae2fcfed741 22-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 1996218: Disable use of shared memory buffer by SoundPool.

Disabled USE_SHARED_MEM_BUFFER compilation switch in SoundPool.cpp.
/frameworks/base/media/jni/soundpool/SoundPool.cpp
3c8704b171c812dde6f48e5416ba0b336470dd4a 30-May-2009 Dave Sparks <davidsparks@android.com> Limit check on maxChannels for SoundPool.
Bug 1838724
/frameworks/base/media/jni/soundpool/SoundPool.cpp
9648e4b6774910afde095be94b8359ae80cd3dcb 07-May-2009 Eric Laurent <elaurent@google.com> fix issue 1641535: SoundPool should use AudioTrack with shared memory buffer

Enabled USE_SHARED_MEM_BUFFER switch in SoundPool.cpp
/frameworks/base/media/jni/soundpool/SoundPool.cpp
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/media/jni/soundpool/SoundPool.cpp
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/media/jni/soundpool/SoundPool.cpp
da996f390e17e16f2dfa60e972e7ebc4f868f37e 13-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@131421
/frameworks/base/media/jni/soundpool/SoundPool.cpp
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/media/jni/soundpool/SoundPool.cpp
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/media/jni/soundpool/SoundPool.cpp
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/media/jni/soundpool/SoundPool.cpp