45 Commits

Author SHA1 Message Date
James Dong
ba4d043331 frameworks base Android.mk file changes
Change-Id: I7459b9e959a60751b8fa6e0d893cb2c820c064ce
2012-03-28 11:03:25 -07:00
Eric Laurent
f5e1812549 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
2012-03-26 10:54:41 -07:00
Glenn Kasten
ae75f994cc Add libmedia_native
Change-Id: Ib8cff8abd73723b793f08da99ad59549f219e0e7
2012-03-16 11:51:30 -07:00
Glenn Kasten
28b269f341 Use audio_policy_output_flags_t consistently
This affects:
 - IAudioFlinger::openOutput
 - AudioTrack::AudioTrack
 - AudioTrack::set
 - apps that call these

Change-Id: I26fb281bac6cb87593d17697bc9cb37a835af205
2012-03-09 15:32:22 -08:00
Glenn Kasten
b3db213eb5 Update comments
We no longer put the filename at start of file.

Change-Id: Ic435b159a23105681e3d4a6cb1ac097bc853302e
2012-02-14 09:17:59 -08:00
Glenn Kasten
1137be1a68 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
2012-02-10 13:48:44 -08:00
Glenn Kasten
bc1d77b6cb 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
2012-01-13 10:20:14 -08:00
Glenn Kasten
1c66547ba2 Merge "Use audio_format_t consistently" 2012-01-12 10:30:28 -08:00
Steve Block
3762c31172 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
2012-01-08 13:19:13 +00:00
Steve Block
8564c8da81 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
2012-01-06 10:07:54 +00:00
Glenn Kasten
1c5a89d4af 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
2012-01-05 13:34:54 -08:00
Steve Block
71f2cf116a 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
2011-10-26 09:57:54 +01:00
Glenn Kasten
79cd8ba46b Remove unneeded #include <sys/resource.h>
Suggested in code review for previous change.

Change-Id: Ic3225b240367dc6c9bf56fb4498fb8a0f9f806ec
2011-06-15 07:30:19 -07:00
Glenn Kasten
e46a86fcb6 Revert "Use AudioTrack::event_type not int in callback"
This reverts commit 2225e4b7049fa3fb9d39a068b8268b63c952d7c1
2011-06-01 15:20:35 -07:00
Glenn Kasten
2225e4b704 Use AudioTrack::event_type not int in callback
Change-Id: Ifefc708d46874e04fd0d01cb6e2d43b987ee796c
2011-06-01 13:50:23 -07:00
Dima Zavin
34bb419e59 update for new audio.h header location
Change-Id: Ic4c62c4037800802427eb7d3c7f5eb8b25d18876
Signed-off-by: Dima Zavin <dima@android.com>
2011-05-12 14:09:57 -07:00
Dima Zavin
24fc2fb1c5 audio/media: convert to using the audio HAL and new audio defs
Change-Id: Ibc637918637329e4f2b62f4ac7781102fbc269f5
Signed-off-by: Dima Zavin <dima@android.com>
2011-04-27 13:10:10 -07:00
Elliott Hughes
a3804cf77f You don't need to poke around inside FileDescriptor manually.
We can help you with that.

Note also that getParcelFileDescriptorFD did no such thing. All its callers
were passing in a regular java.io.FileDescriptor and expecting the int. No
ParcelFileDescriptors involved.

Change-Id: Idc233626f20c092e719f152562601f406cc1b64a
2011-04-11 17:04:01 -07:00
Eric Laurent
a60e212d0d 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
2011-01-07 17:17:10 -08:00
Eric Laurent
f3d6dd0782 Fix issue 3157123.
Use a Mutex wherever atomic operations were used in AudioTrack,
AudioRecord, AudioFlinger and AudioEffect classes.

Change-Id: I6f55b2cabdcd93d64ef19446735b8f33720f8dbc
2010-11-19 15:49:42 -08:00
Steve Howard
09468dbbe9 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
2010-03-11 13:59:54 -08:00
Dave Sparks
7bef5a58f1 Fix logging in SoundPool. 2010-02-17 09:09:24 -08:00
Dave Sparks
f992cbb9aa Add SoundPool API to pause and resume all active streams. Bug 2426531. 2010-02-16 16:19:32 -08:00
Dave Sparks
3c56221af7 Fix SoundPool restart problem CheckJNI issue. 2009-12-23 17:22:57 -08:00
Dave Sparks
f6e43bf290 Add OnLoadCompleteListener to SoundPool. 2009-12-23 09:11:29 -08:00
Dave Sparks
c333133107 am b5fc8ffc: am 91487425: Merge change I0448ef20 into eclair
Merge commit 'b5fc8ffcff6b8e1747af5c6ba1176a81986b55a8'

* commit 'b5fc8ffcff6b8e1747af5c6ba1176a81986b55a8':
  Fix SoundPool buffer size rounding error. Bug 2327620.
2009-12-15 15:05:37 -08:00
Dave Sparks
66d28cedd9 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.
2009-12-14 21:48:17 -08:00
Dave Sparks
3c256cf321 More SoundPool cleanup. Remove mSoundPoolRef and unused notify callback. 2009-12-07 13:01:01 -08:00
Dave Sparks
c0e3ddf8f2 Remove unused Java object reference in native SoundPool code. 2009-12-07 12:36:20 -08:00
Android (Google) Code Review
1b0efec347 am 17c195c8: Merge change 9340 into donut
Merge commit '17c195c8da3470b2e69880e206342f0c2d85f938'

* commit '17c195c8da3470b2e69880e206342f0c2d85f938':
  Fix issue 2025872: Deadlock in SoundPool.stop
2009-07-31 08:55:51 -07:00
Eric Laurent
fd8c0e1ff8 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.
2009-07-31 06:29:13 -07:00
Eric Laurent
a553c25b33 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()
2009-07-23 06:03:39 -07:00
Android (Google) Code Review
c7bebd1537 am 5f2b05ea: Merge change 8220 into donut
Merge commit '5f2b05ea3dfdaf63088ea3776af43b79c5698f09'

* commit '5f2b05ea3dfdaf63088ea3776af43b79c5698f09':
  Fix issue 1996218: Disable use of shared memory buffer by SoundPool.
2009-07-22 13:20:05 -07:00
Eric Laurent
45fce58ca1 Fix issue 1996218: Disable use of shared memory buffer by SoundPool.
Disabled USE_SHARED_MEM_BUFFER compilation switch in SoundPool.cpp.
2009-07-22 11:12:31 -07:00
Android (Google) Code Review
4599184a1c am 450ad31b: Merge change 2774 into donut
Merge commit '450ad31b62af468aa0fb308a5c983b8f8334ae4e'

* commit '450ad31b62af468aa0fb308a5c983b8f8334ae4e':
  Limit check on maxChannels for SoundPool.
2009-06-01 09:58:43 -07:00
Dave Sparks
3c8704b171 Limit check on maxChannels for SoundPool.
Bug 1838724
2009-06-01 08:16:19 -07:00
Mathias Agopian
25ba5b6564 checkpoint: split libutils into libutils + libbinder 2009-05-20 12:55:02 -07:00
Eric Laurent
9648e4b677 fix issue 1641535: SoundPool should use AudioTrack with shared memory buffer
Enabled USE_SHARED_MEM_BUFFER switch in SoundPool.cpp
2009-05-07 03:14:31 -07:00
Dianne Hackborn
08905cc336 Automated import from //branches/donutburger/...@140818,140818 2009-03-24 18:36:53 -07:00
The Android Open Source Project
9066cfe988 auto import from //depot/cupcake/@135843 2009-03-03 19:31:44 -08:00
The Android Open Source Project
d83a98f4ce auto import from //depot/cupcake/@135843 2009-03-03 18:28:45 -08:00
The Android Open Source Project
da996f390e auto import from //branches/cupcake/...@131421 2009-02-13 12:57:50 -08:00
The Android Open Source Project
d24b8183b9 auto import from //branches/cupcake/...@130745 2009-02-10 15:44:00 -08:00
The Android Open Source Project
f013e1afd1 Code drop from //branches/cupcake/...@124589 2008-12-17 18:05:43 -08:00
The Android Open Source Project
54b6cfa9a9 Initial Contribution 2008-10-21 07:00:00 -07:00