summaryrefslogtreecommitdiffstats
path: root/core/jni/android_media_AudioRecord.cpp
Commit message (Collapse)AuthorAgeFilesLines
* update for new audio.h header locationDima Zavin2011-05-121-1/+1
| | | | | Change-Id: Ic4c62c4037800802427eb7d3c7f5eb8b25d18876 Signed-off-by: Dima Zavin <dima@android.com>
* audio/media: convert to using the audio HAL and new audio defsDima Zavin2011-04-271-5/+8
| | | | | Change-Id: Ibc637918637329e4f2b62f4ac7781102fbc269f5 Signed-off-by: Dima Zavin <dima@android.com>
* Don't use local ref for cached jclass reference in JNI codeBrian Carlstrom2011-04-061-8/+5
| | | | | Change-Id: Id45b2acb358a819f2fd332e99f3a095f6fc7299b related-to-bug: 4241138
* Fix issue 3439872: video chat and bluetooth SCOEric Laurent2011-03-081-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use getMinFrameCount() instead of querying AudioSystem directly.Chia-chi Yeh2010-08-191-22/+15
| | | | Change-Id: I6c4d2f1778703c1fd1ba5610c46e77c857418bff
* Add locking around AudioRecord release() function in JNI. Bug 2481952.Dave Sparks2010-03-151-14/+16
| | | | | | | | | | | 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
* Fix issue 2304669: VoiceIME: starting and canceling voice IME yields ↵Eric Laurent2009-12-071-4/+4
| | | | | | | | | | | | | | 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.
* Fix issue 1795088 Improve audio routing codeEric Laurent2009-07-231-15/+11
| | | | | | | 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()
* Fix global ref leak in android.media.AudioRecord. Delete global refsJean-Michel Trivi2009-07-171-1/+5
| | | | | | 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.
* Fix issue 1846343 - part 1Eric Laurent2009-05-261-25/+9
| | | | | | | | 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.
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+601
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-601/+0
|
* auto import from //branches/cupcake/...@131421The Android Open Source Project2009-02-131-1/+36
|
* auto import from //branches/cupcake/...@130745The Android Open Source Project2009-02-101-5/+5
|
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-171-0/+566