History log of /frameworks/base/core/jni/android_media_AudioTrack.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
532bc1cb7da9fdbf34893fa48b2ae11f54cf6a8e 20-Apr-2012 Eric Laurent <elaurent@google.com> Fix threading issues in AudioRecord JNI

Made native AudioRecord ref based to allow use
of strong pointers in JNI and solve concurrency issues
between read() and release() in particular.

Applied the same fixes to AudioTrack JNI.

Issue 6254582.

Change-Id: I381a66cb00b6639f87f4fcd19a2e202d1a4e6704
/frameworks/base/core/jni/android_media_AudioTrack.cpp
10536b657d306416dfec738c6538a1afcb7e078e 18-Apr-2012 Eric Laurent <elaurent@google.com> rename audio policy flags

Change-Id: Id273d1366ed2dc9ae9f38497414a68523bceae66
/frameworks/base/core/jni/android_media_AudioTrack.cpp
6940484150b9ef96c93ddfb4b2dfedcaa373cb34 14-Mar-2012 Glenn Kasten <gkasten@google.com> Merge "Use correct syntax for #include <> """
c81d31c3f801ba3d559a22c27b926ace38a7ab49 13-Mar-2012 Glenn Kasten <gkasten@google.com> Use correct syntax for #include <> ""

Change-Id: I943137108668ae66f8eba18dafe069a7951bcd8f
/frameworks/base/core/jni/android_media_AudioTrack.cpp
18db49a46259020387c40fff36d92edc1087a366 13-Mar-2012 Glenn Kasten <gkasten@google.com> Whitespace and indentation

Fix indentation to be multiple of 4.
Make it easier to search:
sp< not sp < to
"switch (...)" instead of "switch(...)" (also "if" and "while")
Remove redundant blank line at start or EOF.
Remove whitespace at end of line.
Remove extra blank lines where they don't add value.

Use git diff -b or -w to verify.

Change-Id: I966b7ba852faa5474be6907fb212f5e267c2874e
/frameworks/base/core/jni/android_media_AudioTrack.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/core/jni/android_media_AudioTrack.cpp
00db1f52b1c12d3670a0419305aa7548f7932aa0 16-Jan-2012 Glenn Kasten <gkasten@google.com> Rename JNI implementation to match Java method

android_media_AudioTrack_native_write renamed to
android_media_AudioTrack_native_write_byte, since the Java method name
is called native_write_byte.

Change-Id: I85ef092cf3f5a01d275fc4ef127b4b6d190139e8
/frameworks/base/core/jni/android_media_AudioTrack.cpp
29a0909c5f777230b9f34ef0703fed3cd4633833 16-Jan-2012 Glenn Kasten <gkasten@google.com> Replace run-time stream types by compile-time

Use the AUDIO_STREAM_* constants defined in <system/audio.h> instead of
dynamically looking up stream types from AudioManager.

Replace a series of "if" statements by a switch.

Change-Id: I6d015bc151c9ab97a02492e84c63298b1f6f31ac
/frameworks/base/core/jni/android_media_AudioTrack.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/core/jni/android_media_AudioTrack.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/core/jni/android_media_AudioTrack.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/core/jni/android_media_AudioTrack.cpp
fb2ab9efc3805c81521afb9ff91a58ff5097a36e 12-Dec-2011 Glenn Kasten <gkasten@google.com> Fix indentation and whitespace

Use git diff -w to verify.

Change-Id: Ib65be0a1ecf65d6cad516110604e3855bf68a638
/frameworks/base/core/jni/android_media_AudioTrack.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/core/jni/android_media_AudioTrack.cpp
d9ae1c573e37e245c7f4f0480a8fa925e57bd49d 25-Jul-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 4319552 Java to native channel mask translation

When creating a new AudioTrack instance, translate from a Java
channel mask as defined in android.media.AudioFormat to one
as defined in audio.h which matches industry-standard
channel mask definitions.

Change-Id: I7eeece8ec2a437977c31f6e82590f9591158144b
/frameworks/base/core/jni/android_media_AudioTrack.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/core/jni/android_media_AudioTrack.cpp
2225e4b7049fa3fb9d39a068b8268b63c952d7c1 05-May-2011 Glenn Kasten <gkasten@google.com> Use AudioTrack::event_type not int in callback

Change-Id: Ifefc708d46874e04fd0d01cb6e2d43b987ee796c
/frameworks/base/core/jni/android_media_AudioTrack.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/core/jni/android_media_AudioTrack.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/core/jni/android_media_AudioTrack.cpp
46e18c11d46a2bc1a46174f963d0ed1224d94cd2 06-Apr-2011 Brian Carlstrom <bdc@google.com> Don't use local ref for cached jclass reference in JNI code

Change-Id: Id45b2acb358a819f2fd332e99f3a095f6fc7299b
related-to-bug: 4241138
/frameworks/base/core/jni/android_media_AudioTrack.cpp
421ddc014b31478ba0ef115e098d8780a35af331 07-Mar-2011 Eric Laurent <elaurent@google.com> Fix issue 3439872: video chat and bluetooth SCO

This change fixes the stability problems experienced when using
a bluetooth headset supporting both A2DP and SCO. Problems occur
when starting the video chat at which time the A2DP output is being
stopped to start SCO. At that time, active AudioTracks are invalidated
by AudioFlinger so that a new AudioTrack binder interface can be
recreated by the client process on the new mixer thread with correct parameters.
The problem was that the process to restore the binder interface was not
protected against concurrent requests which caused 2 binder interfaces
to be created sometimes. This could lead to permanent client deadlock
if one of the client threads was waiting for a condition of the first
created binder interface while the second one was created (as the AudioFlinger
would only signal conditions on the last one created).
This concurrent request situation is more likely to happen when a client
uses the JAVA AudioTrack as the JNI implementation uses simultaneously the
native AudioTrack callback and write push mechanisms. By doing so, the code
that checks if the binder interface should be restored (in obtainBuffer()) is
much more likely to be called concurrently from two different threads.

The fix consists in protecting the critical binder interface restore phase
with a flag in the AudioTrack control block. The first thread acting upon the binder
interface restore request will raise the flag and the second thread will just wait for
a condition to be signaled when the restore process is complete.

Also protected all accesses to the AudioTrack control block by a mutex to prevent
access while the track is being destroyed and restored. If a mutex cannot be held
(e.g because we call a callback function), acquire a strong reference on the IAudioTrack
to prevent its destruction while the cblk is being accessed.

Modified AudioTrack JNI to use GetByteArrayElements() instead of
GetPrimitiveArrayCritical() when writing audio buffers. Entering a critical section would
cause the JNI to abort if a mediaserver crash occurs during a write due to the AudioSystem
callback being called during the critical section when media server process restarts.
Anyway with current JNI implementation, either versions do not copy data most of the times
and the criticial version does not guaranty no data copy.

The same modifications have been made to AudioRecord.

Change-Id: Idc5aa711a04c3eee180cdd03f44fe17f3c4dcb52
/frameworks/base/core/jni/android_media_AudioTrack.cpp
2fb43ef8c0b922c1bd0d7cb6867e30d702d4bdb8 24-Sep-2010 Eric Laurent <elaurent@google.com> fix problem in AudioEffect JNI setup.

There is a problem in AudioEffect and Visualizer native_setup() methods
that causes a crash in the application after the mediaserver process
has crashed and restarted.
The problem is that the native AudioEffect/Visualizer constructor is
called while the JNI is in critical state after calling
GetPrimitiveArrayCritical(). As the mediaserver process just restarted, the
first call to AudioSystem will cause the binder IAudioflinger interface to
be reteived and a callback send to AudioSystem JNI to clear the mediaserver
error state. This will call env->FindClass() and crash due to the JNI being
in critical state.

Also fixed a similar problem in AudioTrack JNI

Change-Id: I4a9026a3e26c7f78d9b4b4bec1aac90fbee2ab62
/frameworks/base/core/jni/android_media_AudioTrack.cpp
c3308074cd6f06bbb35c1999b5260f938742a9e7 19-Aug-2010 Chia-chi Yeh <chiachi@android.com> Use getMinFrameCount() instead of querying AudioSystem directly.

Change-Id: I6c4d2f1778703c1fd1ba5610c46e77c857418bff
/frameworks/base/core/jni/android_media_AudioTrack.cpp
7070b36549d511d6627538c73dfbab23fbae5b43 16-Jul-2010 Eric Laurent <elaurent@google.com> Added support for auxiliary audio effects to AudioTrack and MediaPlayer.

Added methods to AudioTrack and MediaPlayer java classes to enable use of
auxiliary audio effects. The effect can be attached and detached by specifying its
ID and the send level controlled.

Change-Id: Ie74ff54a453096a742688476f612ce355543b6f3
/frameworks/base/core/jni/android_media_AudioTrack.cpp
619346f902241736d933657a4fe10f10c50a1ba8 21-Jun-2010 Eric Laurent <elaurent@google.com> Added support for audio sessions in MediaPlayer and AudioTrack.

Audio sessions are used to associate audio effects to particular instances (or groups) of MediaPlayers or AudioTracks.

Change-Id: Ib94eec43241cfcb416590f435ddce7ab39a07640
/frameworks/base/core/jni/android_media_AudioTrack.cpp
83b368505052f59616d29558e65e2250d01fd848 28-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 2015322 mediaframeworktest.MediaAudioTrackTest fails.
/frameworks/base/core/jni/android_media_AudioTrack.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/core/jni/android_media_AudioTrack.cpp
dbee03136fab65227bbe56b2cf03361a1bdbdf1c 17-Jul-2009 Android (Google) Code Review <android-gerrit@google.com> am 733cbb00: Merge change 7492 into donut

Merge commit '733cbb0009d3e16eac2383a694833bdbc0c7269e'

* commit '733cbb0009d3e16eac2383a694833bdbc0c7269e':
Delete leaked global ref in AudioTrack constructor.
8a1496855cb81a6f2e9e8d51dd6b6ed595047a2a 16-Jul-2009 Jean-Michel Trivi <jmtrivi@google.com> Delete leaked global ref in AudioTrack constructor.
/frameworks/base/core/jni/android_media_AudioTrack.cpp
fcc5be99e0497f25a12e77622c27b4de30e45b3d 07-Jul-2009 Eric Laurent <elaurent@google.com> am 88e209dc: Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate to twice of the ouputSR

Merge commit '88e209dcf8c2ebddda5c272f46d1bd5478bc639c'

* commit '88e209dcf8c2ebddda5c272f46d1bd5478bc639c':
Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate to twice of the ouputSR
88e209dcf8c2ebddda5c272f46d1bd5478bc639c 07-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate to twice of the ouputSR

Store sample rate on 32 bits instead of 16 bits in audio_track_cblk_t.
Removed sampleRate() methods from AudioTrack and AudioRecord: replaced by getSampleRate().
AudioTrack::setSampleRate() no returns a status.
/frameworks/base/core/jni/android_media_AudioTrack.cpp
0795272aa226f4e965968a03daddc53ce30b7cda 20-May-2009 Mathias Agopian <mathias@google.com> move libbinder's header files under includes/binder
/frameworks/base/core/jni/android_media_AudioTrack.cpp
21dc037e7e7c51e33b5808320f47339ee3a2b103 09-May-2009 Jean-Michel Trivi <jmtrivi@google.com> Check the size of the data to write for STATIC AudioTrack objects.
Extracted actual writing from write jni function so it can be reused in an upcoming change.
/frameworks/base/core/jni/android_media_AudioTrack.cpp
a5cb7b7e82bfee87c1ef40f8d5b5d81c8ca13a23 25-Mar-2009 Jean-Michel Trivi <> Automated import from //branches/donutburger/...@142372,142372
/frameworks/base/core/jni/android_media_AudioTrack.cpp
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/jni/android_media_AudioTrack.cpp
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/jni/android_media_AudioTrack.cpp
076357b8567458d4b6dfdcf839ef751634cd2bfb 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@132589
/frameworks/base/core/jni/android_media_AudioTrack.cpp
3dec7d563a2f3e1eb967ce2054a00b6620e3558c 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@137055
/frameworks/base/core/jni/android_media_AudioTrack.cpp
3001a035439d8134a7d70d796376d1dfbff3cdcd 19-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@132276
/frameworks/base/core/jni/android_media_AudioTrack.cpp
da996f390e17e16f2dfa60e972e7ebc4f868f37e 13-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@131421
/frameworks/base/core/jni/android_media_AudioTrack.cpp
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/core/jni/android_media_AudioTrack.cpp
b798689749c64baba81f02e10cf2157c747d6b46 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
/frameworks/base/core/jni/android_media_AudioTrack.cpp
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/core/jni/android_media_AudioTrack.cpp