History log of /frameworks/base/core/jni/android_media_AudioRecord.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
219de73da2a986ddcbfbc593c4e4e01c858ce245 23-May-2016 Eric Laurent <elaurent@google.com> Fix AudioTrack and AudioRecord documentation

Improve documentation for error codes returned by
AudioTrack.write() and AudioRecord.read() methods.
Fix native to JAVA error code conversion in JNI.

Bug: 28906466

Change-Id: I4d48b1d428834b7a39a14e2d81b6c164696817a8
/frameworks/base/core/jni/android_media_AudioRecord.cpp
33b840444f5a481dd31e129079d3c0cf3acdf80e 08-Mar-2016 Glenn Kasten <gkasten@google.com> Use audio_session_t consistently

Also prefer AudioManager.AUDIO_SESSION_ID_GENERATE over
AudioSystem.AUDIO_SESSION_ALLOCATE, because
AudioSystem.AUDIO_SESSION_ALLOCATE is @hide.

Bug: 27562099
Change-Id: I5924554feb919db7f2390f5b062faedd515421af
/frameworks/base/core/jni/android_media_AudioRecord.cpp
9b09e533ac67d3d25465e3312b4957bc90b0c84f 26-Jan-2016 Paul McLean <pmclean@google.com> JNI plumbing for native audio routing API

Bug: 23899814
Change-Id: I3a831bb661fbdfe1981ae3482fcc8773c7df22b6
/frameworks/base/core/jni/android_media_AudioRecord.cpp
1cbf9b3741ec486c3ffce08f145501eb1ca73640 02-Feb-2016 Glenn Kasten <gkasten@google.com> Allow sample rate UNSPECIFIED to mean a route-dependent value

Bug: 25641253
Bug: 21019153
Change-Id: I3b8e01b6ea09f42c813ab1a0f3f625dc3803cc0b
/frameworks/base/core/jni/android_media_AudioRecord.cpp
f4d81bd865d341c6d71fcd4c40294a2570770879 29-Jan-2016 Andy Hung <hunga@google.com> Add AudioRecord timestamps

Bug: 13569372
Bug: 22886739
Change-Id: Icdd0e6f3871a43a26faa39e5535740f72a58dcae
/frameworks/base/core/jni/android_media_AudioRecord.cpp
0ad99c059735d6d4a9f9fb5379c8b1b35ce01f38 16-Jan-2016 Andy Hung <hunga@google.com> Add AudioRecord timestamps

API change

Bug: 13569372
Bug: 22886739
Change-Id: Ic250fd0c39901f4e99c58281e371f27c241b6bed
/frameworks/base/core/jni/android_media_AudioRecord.cpp
b57dd722f1dc0663417da37d3a82f8283ad3c982 24-Sep-2015 Elliott Hughes <enh@google.com> resolved conflicts for a884d81e to stage-aosp-master

Change-Id: Ice485967fa96f13786024b6939b826638e906ff0
76f6a86de25e1bf74717e047e55fd44b089673f3 19-Sep-2015 Daniel Micay <danielmicay@gmail.com> constify JNINativeMethod function pointer tables

Change-Id: I4036c924958221cbc644724f8eb01c5de3cd7954
/frameworks/base/core/jni/android_media_AudioRecord.cpp
16144ac3789f6dbe36a7011cf23305f072a7bfcb 28-May-2015 Glenn Kasten <gkasten@google.com> Merge "Add comments to indicate code review was done for bugs" into mnc-dev
d6c3404f597b4ea12c56554ab509e227f9722a77 21-May-2015 Paul McLean <pmclean@google.com> Merge "Test for non-null AudioTrack() object in android_media_AudioTrack_setOutputDevice()." into mnc-dev
cef696e8b464e6479ed352b3b490e41ee677bd91 21-May-2015 Paul McLean <pmclean@google.com> Test for non-null AudioTrack() object in android_media_AudioTrack_setOutputDevice().

Change-Id: Ibf77bb0757720aa25eaaf6e603ab446257430453
/frameworks/base/core/jni/android_media_AudioRecord.cpp
e90a0a88f4eabdc27c3ef033f38c91ea23362a1e 20-May-2015 Andy Hung <hunga@google.com> Fix AudioTrack, AudioRecord, AudioFormat API

Rename getNativeFrameCount to getBufferSizeInFrames
Remove throw declaration on IllegalArgumentException and
IllegalStateException

Bug: 20887665
Bug: 21304902
Change-Id: Ia85d8010be46524b9a8b93105b16b7b9480f6bd9
/frameworks/base/core/jni/android_media_AudioRecord.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/core/jni/android_media_AudioRecord.cpp
b65cd17b0508a5a7afdd92e69437825071a1631b 06-May-2015 Eric Laurent <elaurent@google.com> Merge "Implement audio routing callbacks" into mnc-dev
4bcdba848449b33d7022de527c526943aff1f5fd 01-May-2015 Eric Laurent <elaurent@google.com> Implement audio routing callbacks

Implement JNI for AudioTrack and AudioRecord routing
callbacks:
- Added files core/jni/android_media_DeviceCallback.cpp/.h
for JNI callback implementation used by both AudioTrack
and AudioRecord.
- Made AudioManager AudioPort and AudioPatch methods static
in order to call them without context.

Also added IO handle information to AudioMixPort.

Change-Id: Icee182aa68310d4b12fd1469f48e78110889acf1
/frameworks/base/core/jni/android_media_AudioRecord.cpp
60e1dc2e3e7552854302c624f4bee86ae3e82b1b 02-May-2015 Jean-Michel Trivi <jmtrivi@google.com> AudioRecord JNI: use default UID / PID

Bug 20832981

Change-Id: I887e38a4e95c9f4b9360f831b3dfc0073d151706
/frameworks/base/core/jni/android_media_AudioRecord.cpp
fa5ecdc4ac6d7a8db2bb9e4a6a60a3189025df30 28-Apr-2015 Svet Ganov <svetoslavganov@google.com> Respect the record audio app op - framework

Change-Id: I5696d2ef22738ccffaf8bd7a0ee68cbc3dea3bf1
/frameworks/base/core/jni/android_media_AudioRecord.cpp
6bd27e1a0c030e0c47d21dd4c99c3133c85685a9 24-Apr-2015 Paul McLean <pmclean@google.com> AudioRecord device select continued

Change-Id: I3b6ace370b878351d98dbdcba2db718b30de2f27
/frameworks/base/core/jni/android_media_AudioRecord.cpp
ec4097b0caf426cf48779762848456786587f443 24-Apr-2015 Paul McLean <pmclean@google.com> Merge "Explicit routing in AudioRecord"
2d6de4c38c899707e0596b7fa4dad9bbb3eb6b60 17-Apr-2015 Paul McLean <pmclean@google.com> Explicit routing in AudioRecord

Change-Id: Ib3af1041d9f7bbccefd6b86cd3c35baf742be861
/frameworks/base/core/jni/android_media_AudioRecord.cpp
98d4ca62290a45ea2a66826a1a99e9a664016808 20-Apr-2015 Andy Hung <hunga@google.com> Add channel index mask to AudioRecord

Change-Id: I5d2504d3a7af6611d3ffa9a4c2d3665a2cf97fef
/frameworks/base/core/jni/android_media_AudioRecord.cpp
0e9e2f3724b43f86bb7e41a40e665587730ce6ae 14-Apr-2015 Andy Hung <hunga@google.com> Add non-blocking reads to AudioRecord

Change-Id: I63d5345129f197f96f9a13696996071c96551efe
/frameworks/base/core/jni/android_media_AudioRecord.cpp
864ae678521cc26801a1611b3d4eabe90c0a17f7 14-Apr-2015 Andy Hung <hunga@google.com> Default to minimum buffer size for AudioRecord.Builder

Add AudioRecord.getNativeFrameCount to allow apps to
retrieve the size of the buffer created.

Change-Id: I4c539677726f89afd36fe7b1d24c8b29ada91402
/frameworks/base/core/jni/android_media_AudioRecord.cpp
58b0f3f3324ad04d53b31a75c9ad617957dfbba6 28-Mar-2015 Andy Hung <hunga@google.com> Add floating point AudioRecord read

Change-Id: Ibbdbfdefb84b515c231723fb621662bc4920ff86
/frameworks/base/core/jni/android_media_AudioRecord.cpp
7a60ae86ec5c8950d5baf1a8ba33207ddaa72a7d 14-Mar-2015 Andy Hung <hunga@google.com> Fix AudioRecord read to be blocking

Does not limit returned data based on internal buffer size.

Change-Id: I0c1893db3e5e197ea6376d5aa52449b01ac3905b
/frameworks/base/core/jni/android_media_AudioRecord.cpp
41b2381db7225f7ff11c523662de6cfb47fc7c85 27-Nov-2014 Eric Laurent <elaurent@google.com> am 981951e4: am 563e61f5: Merge "AudioRecord JNI: pass attributes to native AudioRecord." into lmp-mr1-dev

* commit '981951e4f9bae85dcf6f717023596c08dc245ee7':
AudioRecord JNI: pass attributes to native AudioRecord.
4c3fc59b4d0c849016b17ce8e73540bdce847702 26-Nov-2014 Eric Laurent <elaurent@google.com> AudioRecord JNI: pass attributes to native AudioRecord.

Bug: 16006090.
Change-Id: Ic6448dda0de65dada3a195cfc2ec73698b04b7b2
/frameworks/base/core/jni/android_media_AudioRecord.cpp
7d13d9db1ef90063cb542ccd6554042a6a3263b7 21-Nov-2014 Andreas Gampe <agampe@google.com> resolved conflicts for merge of 3fc5e3ca to lmp-mr1-dev-plus-aosp

Change-Id: Id8286e5a4381315a6060251a8055b0f1d1a96019
ed6b9dff563c5e22f040ff37e12c0d771e0478ae 21-Nov-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Consistency in core/jni

Make consistent use of core_jni_helpers for registration.

Translate some #ifdefs into const bools.

Change-Id: I37639aa053dd50f003a552cbd8550dddecc811c5
/frameworks/base/core/jni/android_media_AudioRecord.cpp
283a9d9e15e095493a7d9800667e49169143e7e3 13-Nov-2014 Jon Eklund <jeklund@motorola.com> AudioRecorder read buffer overflow

Since function was changed from byte-native to short-native,
it's no longer necessary to multiply offset by sizeof(short).

Bug 18367580

Change-Id: I669d860334ba40e46c04e534d7008b9e2401d8cd
/frameworks/base/core/jni/android_media_AudioRecord.cpp
bdad1afa92a6e7cd688061d5432f25a3dd15b64e 20-Sep-2014 Eric Laurent <elaurent@google.com> AudioRecord: add HW hotword capture flag

Bug: 17575019.
Change-Id: Ifa8b8342dffa12e1943b8f9105f6ab1fa4a2b1a6
/frameworks/base/core/jni/android_media_AudioRecord.cpp
701d6ff12f36bf5e9de0dafdaced06744fd411eb 16-Jul-2014 Jean-Michel Trivi <jmtrivi@google.com> AudioAttributes and AudioRecord.

Add audio recording source in AudioAttributes.
New AudioRecord constructor with AudioAttributes and
AudioFormat.
Legacy AudioRecord constructor is calling into the new
constructor.

Bug 16009464

Change-Id: I69d81f9e71bdf946c4cfbda6d3d8552ffac6b5c2
/frameworks/base/core/jni/android_media_AudioRecord.cpp
dbf55665c5c4802cbfc56463198805be48ec75af 02-Jul-2014 Eric Laurent <elaurent@google.com> audio: fixed channel count determination from channel mask

Do not use popcount() to derive channel count from channel mask.

Bug: 15000850.
Change-Id: Id52fc517bedaf1c42b9cd59857e3d19c251b97bf
/frameworks/base/core/jni/android_media_AudioRecord.cpp
bc11a696f6856624de532a6830d5db9dbbe2384c 16-May-2014 Eric Laurent <elaurent@google.com> AudioSystem: native to JAVA status translation

Regroup status code translation from native to JAVA in AudioSystem.
The same codes will be used by AudioTrack, AudioRecord, AudioManager
and defined in a single place in AudioSystem.

Change-Id: I7d3f39f30e3bb8e53f33f4408bcb0672df8af42b
/frameworks/base/core/jni/android_media_AudioRecord.cpp
3d4c64191a181aac0922abbd56f4046d6b7ec31c 30-Apr-2014 Eric Laurent <elaurent@google.com> fix AudioTrack and AudioRecord JNI

AudioTrack and AudioRecord JNI should not cast
jshortArray to jbyteArray. This appeared to work with Dalvik
but causes data corruption with ART.

Change-Id: Ib30b71e0d4007c4b574bc409963ddc5975ad4f78
/frameworks/base/core/jni/android_media_AudioRecord.cpp
b9b07b8c48dca71c0aa6adf77baabcea0285215e 01-Apr-2014 Glenn Kasten <gkasten@google.com> Merge "AudioTrack and AudioRecord JNI cleanup"
1dd51abaae27af8e12ee06b9651fd6e4334963a5 31-Mar-2014 Glenn Kasten <gkasten@google.com> Merge "Use set() return value instead of separate call to initCheck()"
c5d142428ad68dd8aa4ffb80719667b13ad5049f 29-Mar-2014 Glenn Kasten <gkasten@google.com> Use set() return value instead of separate call to initCheck()

Change-Id: I6874ca00512d30824ecec10b8dc289993b985c7b
/frameworks/base/core/jni/android_media_AudioRecord.cpp
5b8fd44365f03601aaba41879ac18e70ce814a0f 14-Nov-2013 Glenn Kasten <gkasten@google.com> AudioTrack and AudioRecord JNI cleanup

Rename nbChannels to our conventional channelCount,
which should make code searches easier.

Change-Id: I3c2791db302558a15bc8be198b6f3d482e0e0055
/frameworks/base/core/jni/android_media_AudioRecord.cpp
2fbf25b50f8534c78f3b9063d35a0b5970ff8f1e 28-Mar-2014 Glenn Kasten <gkasten@google.com> Fix warnings

Change-Id: Ie00f6c58a944e2db0539f1119d2983a483b6f10c
/frameworks/base/core/jni/android_media_AudioRecord.cpp
e0d10cd92369d56e593e8592084024d1cd1655db 28-Feb-2014 Narayan Kamath <narayan@google.com> am d8ccf8b7: am be094d89: am 8fb22ae7: am eee2c72f: Merge "Various format string fixes for 64bit"

* commit 'd8ccf8b789461e1706d10df44d109849fa974fc5':
Various format string fixes for 64bit
95ece35c2f8b86203e88b49d67cef8e80e107a2b 13-Feb-2014 Kévin PETIT <kevin.petit@arm.com> Various format string fixes for 64bit

Change-Id: I74532a4e0400033f5ee3e3f6827ac42f77d16f53
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
/frameworks/base/core/jni/android_media_AudioRecord.cpp
6bb5cb24b458a11bd02e9bff37c03f6381e06b7c 16-Jan-2014 Narayan Kamath <narayan@google.com> Resolved conflicts for merge of 28c6ec02 to master

Change-Id: Idf1cabf2694dfa13d928df944d346f5e051b6948
075e9a19ce645752f8282bc19c91b25978a7dc52 06-Jan-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Use long for pointers in media classes

For storing pointers, long is used in media classes,
as native pointers can be 64-bit.

In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use
of jint instead of int in JNI function prototypes)

Change-Id: Idc4ca0124d03df7f9cef412488abafd020e5e774
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
/frameworks/base/core/jni/android_media_AudioRecord.cpp
fe834d30f4f3f51b754d55fecb36f11279733948 08-Jan-2014 Glenn Kasten <gkasten@google.com> Prepare for additional formats beyond 8-bit and 16-bit PCM

This CL does the same thing for AudioTrack,
that an earlier CL did for AudioRecord:
> Change-Id: Ic3525f049e939bdf125d9f87ed39abd2690dcf9f

Pull out the common parts of that earlier CL and move them to new header
file android_media_AudioFormat.h.

Use the new function audioFormatToNative() to convert from Java
ENCODING_PCM_* to native AUDIO_FORMAT_*.

Use audio_bytes_per_sample() instead of hard-coding the size of various formats.

Use size_t for memory sizes.

Change-Id: I7992dd6a2c9500126a6d7ae5fc1ed9f3312962d6
/frameworks/base/core/jni/android_media_AudioRecord.cpp
a5a42384367230b8e16cf441d5dcf4225332f9d7 19-Dec-2013 Glenn Kasten <gkasten@google.com> Prepare for additional formats beyond 8-bit and 16-bit PCM

Factor out code that converts from Java ENCODING_PCM_* to native
AUDIO_FORMAT_* into a new function audioFormatToNative().

Also use audio_bytes_per_sample() from <system/audio.h>
instead of hard-coding the size of various formats.

Use size_t for memory sizes.

Change-Id: Ic3525f049e939bdf125d9f87ed39abd2690dcf9f
/frameworks/base/core/jni/android_media_AudioRecord.cpp
a9838afbe3ef58b63e5d52060d5ff2776c1c603a 22-Nov-2013 Glenn Kasten <gkasten@google.com> Include more information in AudioRecord error logs

Change-Id: I15ec85760d3523120925608ebe3560f901cdffd7
/frameworks/base/core/jni/android_media_AudioRecord.cpp
f69cd6787d39188ea7bc41fe7d54314fb18eb214 20-Sep-2013 Glenn Kasten <gkasten@google.com> Revert "Workaround for slow AudioRecord destructor"

This reverts commit 8d87d7ba113ad90685f1d2669e65251a9b422a5a.

Change-Id: I78cbe73959d29fc0ff3153268503ae685cd0995c
/frameworks/base/core/jni/android_media_AudioRecord.cpp
8d87d7ba113ad90685f1d2669e65251a9b422a5a 20-Sep-2013 Glenn Kasten <gkasten@google.com> Workaround for slow AudioRecord destructor

Bug: 10816117
Change-Id: If59028bc7dc7abb84e1e3642c721c2629653631f
/frameworks/base/core/jni/android_media_AudioRecord.cpp
357263da0ec2bc2be9d48c1becc3d94288c2f3ed 09-Sep-2013 Eric Laurent <elaurent@google.com> Add HOTWORD as an AudioSource

- This is a low-priority source that can be preempted by others
- This is required for scenarios where someone wants an alway-on
graceful microphone

Bug: 10640877.

Change-Id: Idb3577541103717cb713a7a93d3762ad2c2f4710
/frameworks/base/core/jni/android_media_AudioRecord.cpp
86fad47e68e344b19fabeab1156c5e6742d8dfad 22-Jun-2012 Glenn Kasten <gkasten@google.com> Update audio comments

Change-Id: If470efd77ed886da8d83a1b427c132bad77e668b
/frameworks/base/core/jni/android_media_AudioRecord.cpp
f7d280396c3ae4d76915cadeb29df556d6cd8d38 05-Aug-2013 Glenn Kasten <gkasten@google.com> Merge "Replace run-time PCM encodings by compile-time constants"
a667ff30e4fb6f741c2a930e7c31ef7e962d3b40 22-Jul-2013 Glenn Kasten <gkasten@google.com> Explicitly compare raw pointers to NULL

Change-Id: If76a15509d4121e391e28f26ca273cc00552efa8
/frameworks/base/core/jni/android_media_AudioRecord.cpp
9afc78d7ceb90c449e5dcee727cdbcb4f3ec7adc 01-Aug-2013 Glenn Kasten <gkasten@google.com> Replace run-time PCM encodings by compile-time constants

Change-Id: I2ab9103f3666d88eb1c7292307cc0a90a6482af6
/frameworks/base/core/jni/android_media_AudioRecord.cpp
33c437df39029b70d4ffafac2ca31bd71eafd0c6 19-Jul-2013 Glenn Kasten <gkasten@google.com> Rename mChannels to mChannelMask to avoid ambiguity

This clarifies that it's a channel mask, as opposed to a count.

Also no need to initialize the field in the declaration,
as it's initialized in the constructor.

Include channel mask in error logs.

Change-Id: Ifc02668cf922dc8826a9fb042b3ca52fad377ba6
/frameworks/base/core/jni/android_media_AudioRecord.cpp
922a8c0aa8b9ea278c6d5dc21498930dab47ea75 23-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Use switch in callback handler for events, and no EVENT_MORE_DATA"
6824a143c90a2cd05c5f4f05830fa53527e856b8 23-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Remove unused includes"
82c2d54b53d4b0f568a0ca8bf3d77ef6c2be0c12 22-Jun-2012 Glenn Kasten <gkasten@google.com> Remove unused includes

Change-Id: Id9842fe092aba2761c0641c76ad06749b2e1d9b3
/frameworks/base/core/jni/android_media_AudioRecord.cpp
5b1576ccbd9ab43d5e3238589cf5b43a4834447d 19-Jul-2013 Glenn Kasten <gkasten@google.com> Use switch in callback handler for events, and no EVENT_MORE_DATA

EVENT_MORE_DATA is no longer possible for the transfer mode used by Java.

Change-Id: Iffd98bca8adea7e066d5d069e82aa841e5c02330
/frameworks/base/core/jni/android_media_AudioRecord.cpp
3f0af8be9e11112b03fc487bc2cc393286b923b5 19-Jul-2013 Glenn Kasten <gkasten@google.com> Return correct status for android.media.AudioRecord.read(short[]...)

This is similar to Change-Id: If43c63a4ceeb8fef98708f0d42496d2fb90a21fd

Bug: 9776374
Change-Id: I8d9e03b70ad55b4e1b3acfe26e31de8b374e2b43
/frameworks/base/core/jni/android_media_AudioRecord.cpp
b1d90c8f60f71422196c337f1d078b68867f5710 07-Mar-2013 Mathias Agopian <mathias@google.com> fix JNI use of incStrong/decStrong

Change-Id: Ia11b404dea483dc19bbc30f4d7bcff516655e180
/frameworks/base/core/jni/android_media_AudioRecord.cpp
1adb715bc6d088ed31f211bfdceded7c205a7d98 29-Nov-2012 Glenn Kasten <gkasten@google.com> new can't fail on Android

Change-Id: I0e048d3d8ba1ec34d13684b9fd898035d3381db8
/frameworks/base/core/jni/android_media_AudioRecord.cpp
fd1e3dfde2a70906c50144a7b1b53593ec1f7891 14-Nov-2012 Glenn Kasten <gkasten@google.com> Use size_t for frame count

Change-Id: Idd364443715a920ece2cc54acc95b395b6ed2c6c
/frameworks/base/core/jni/android_media_AudioRecord.cpp
845b4712f0e4d7ca802f21fba1adae0b1d0712e7 02-Jul-2012 Glenn Kasten <gkasten@google.com> Use audio_channel_mask_t more consistently

In AudioRecord::getMinFrameCount() and AudioSystem::getInputBufferSize(),
input parameter is channel mask instead of channel count.

Change-Id: I22a1c492113f3e689173c5ab97b2567cff3abe2b
/frameworks/base/core/jni/android_media_AudioRecord.cpp
10a9831b661f40cae1832e96f6e26a587c7eb6c3 22-Jun-2012 Glenn Kasten <gkasten@google.com> Remove AudioRecord record_flags

Change-Id: I8a3d62ea64415582c87f43e94b17aa884d7d572d
/frameworks/base/core/jni/android_media_AudioRecord.cpp
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_AudioRecord.cpp
505e5c8859f596ed58489be565d6e029314b2ac8 30-Mar-2012 Eric Laurent <elaurent@google.com> implemented synchronous audio capture

Added the infrastructure to support the synchronization of playback and
capture actions on specific events.
The first requirement for this feature is to synchronize the audio capture
start with the full rendering of a given audio content.
The applications can further be extended to other use cases
(synchronized playback start...) by adding new synchronization events and
new synchronous control methods on player or recorders.

Also added a method to query the audio session from a ToneGenerator.

Change-Id: I4e47f5108c7cbbd3bd334a7fad9b3b6c5ba55d88
/frameworks/base/core/jni/android_media_AudioRecord.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_AudioRecord.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_AudioRecord.cpp
f60a5d7162e22b565e5977b5f4032b9334618269 07-Mar-2012 Glenn Kasten <gkasten@google.com> Use AudioRecord::record_flags consistently

Change-Id: I6f369a2b99eb515603bc7d5629a07db2b96783fe
/frameworks/base/core/jni/android_media_AudioRecord.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/core/jni/android_media_AudioRecord.cpp
0f0fbd9441f40c6f99470b89774e397f99bf61eb 23-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_source_t consistently

Was a mix of audio_source_t, uint8_t, and int.

Related fixes:
- fix comments in MediaRecorder.java
- AudioPolicyService server side was not checking source parameter at
all, so if the client wrapper was bypassed, invalid values could be
passed into audio HAL
- JNI android_media_AudioRecord_setup was checking source for positive
values, but not negative values. This test is redundant, since already
checked at Java and now checked by AudioPolicyService also, but might
as well make it correct.

Change-Id: Ie5e25d646dcd59a86d7985aa46cfcb4a1ba64a4a
/frameworks/base/core/jni/android_media_AudioRecord.cpp
0a204ed0f58a9baaac5630864cd75495486c6cbe 12-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_format_t consistently, continued

Was int or uint32_t.

When AudioFlinger::format can't determine the correct format,
return INVALID rather than DEFAULT.

Init mFormat to INVALID rather than DEFAULT in the constructor.
Subclass constructors will set mFormat to the correct value.

Change-Id: I9b62640aa107d24d2d27925f5563d0d7407d1b73
/frameworks/base/core/jni/android_media_AudioRecord.cpp
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_AudioRecord.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_AudioRecord.cpp
44ff4cd8be50768d5bd471bc6c034acefa0b59ca 18-Jun-2011 Eric Laurent <elaurent@google.com> AudioRecord JAVA: expose audio session Id

Added getAudioSessionId() method to AudioRecord class so that applications can
retrieve the AudioRecord's session ID and attach audio pre processes.

Change-Id: I1914770f0e54d97c9aef6a9eb36fff69b6d31552
/frameworks/base/core/jni/android_media_AudioRecord.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_AudioRecord.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_AudioRecord.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_AudioRecord.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_AudioRecord.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_AudioRecord.cpp
e6335c904aafa17795b059a5d83b8b7db6c761c8 14-Mar-2010 Dave Sparks <davidsparks@android.com> Add locking around AudioRecord release() function in JNI. Bug 2481952.

There is a potential threading issue where an app could call release()
on two threads. This hack adds a static lock object that serializes
access to the Java fields that contain the pointer to the native
AudioRecord object and weak reference to the Java object. Also
modifies finalize() to call release() so that both use the locking
scheme.

Change-Id: I09dcb19b7f501dc582e40e8718142b493eba2518
/frameworks/base/core/jni/android_media_AudioRecord.cpp
9cc489a2196e449dbe090ad9bdbc5cedd0b8334f 05-Dec-2009 Eric Laurent <elaurent@google.com> Fix issue 2304669: VoiceIME: starting and canceling voice IME yields persistent "error 8" state on future attempts and breaks voice search.

Fixed AudioFlinger::openInput() broken in change ddb78e7753be03937ad57ce7c3c842c52bdad65e
so that an invalid IO handle (0) is returned in case of failure.
Applied the same correction to openOutput().
Modified RecordThread start procedure so that a failure occuring during the first read from audio input stream is detected and causes
the record start to fail.
Modified RecordThread stop procedure to make sure that audio input stream fd is closed before we exit the stop function.

Fixed AudioRecord JAVA and JNI implementation to take status of native AudioRecord::start() into account
and not change mRecordingState to RECORDSTATE_RECORDING if start fails.
/frameworks/base/core/jni/android_media_AudioRecord.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_AudioRecord.cpp
4bac5a3928d57ac193141eb6d45f3b39200d27de 17-Jul-2009 Jean-Michel Trivi <jmtrivi@google.com> Fix global ref leak in android.media.AudioRecord. Delete global refs
to the native AudioRecord pointer and the callback cookie (for native
to Java calls) in the finalize() function and when an error occurs
during the allocation of the native resources.
/frameworks/base/core/jni/android_media_AudioRecord.cpp
4bc035a65cac177be9294e69f110497e3b6e34e6 22-May-2009 Eric Laurent <elaurent@google.com> Fix issue 1846343 - part 1

This change is the first part of a fix for issue 1846343, :
- Added new enum values for input sources in AudioRecord and MediaRecorder for voice uplink, downlink and uplink+downlink sources.
- renamed streamType to inputSource in all native functions handling audio record.

A second change is required in opencore author driver and android audio input to completely fix the issue.
/frameworks/base/core/jni/android_media_AudioRecord.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_AudioRecord.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_AudioRecord.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_AudioRecord.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_AudioRecord.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_AudioRecord.cpp