Commit Graph

77 Commits

Author SHA1 Message Date
Eric Laurent
11c04c984a Workaround for issue 2046783.
Apparently the problem is caused by the fact that A2dpAudioStreamOut::standby() calls a2dp_stop() after the headset has been powered down.
The workaround consists in indicating to A2DP audio hardware that a close request is pending and that stanby() must be bypassed.
2009-08-12 05:49:58 -07:00
Eric Laurent
f5aba82cb7 Fix issue 2046140: master: media_server crash when powering down A2DP headset while a ringtone is playing.
This is because the AudioFlinger duplicating thread is closed while the output tracks are still active. This cause the output tracks objects to be destroyed at a time where they can be in use by the destination output mixer.

The fix consists in adding the OutputTrack to the track list (mTracks) of its destination thread so that a strong reference is help during the mixer processed and the track is detroyed only when safe by destination thread.

Also added detection of problems when creating the output track (e.g. no more tracks in mixer). In this case the output track is not added to output track list of duplicating thread.
2009-08-11 09:43:09 -07:00
Eric Laurent
9e7b81943b Fix issue 2043314: Recorded audio is choppy.
Fixed cut/paste error causing constant reset of current frame index in input buffer.
2009-08-11 09:07:44 -07:00
Eric Laurent
878c0e1d68 Limit AudioFlinger mixer track sampling rate.
When changing the audio output stream sampling rate with setParameters() make sure that all tracks have a sampling rate less or equal to 2 times the new output sampling rate.
2009-08-10 08:15:12 -07:00
Eric Laurent
f9df24932f AudioService now differentiates BT headsets and car kits.
The BT headset detection now makes the difference between car kits and headsets, which can be used by audio policy manager.
The headset connection is also detected earlier, that is when the headset is connected and not when the SCO socket is connected as it was the case before. This allows the audio policy manager to suspend A2DP output while ringing if a SCO headset is connected.
2009-08-07 10:31:53 -07:00
Eric Laurent
dae20d9b7f Fix problem in AudioFlinger closeOutput and closeInput.
There was no garanty that the corresponding thread destructor had been already called when exiting the closeOutput() or closeInput() functions.
This contructor could be called by the thread after the exit condition is signalled. By way of consequence, closeOutputStream() could be called after
we exited closeOutput() function.

To solve the problem, the call to closeOutputStream() or closeInputStream() is moved to closeOutput() or closeInput().
2009-08-07 10:19:09 -07:00
Eric Laurent
29b9eff418 Improved unit test code for Audioflinger. 2009-08-07 09:32:06 -07:00
Eric Laurent
3464c015ad Fix lockup in audio flinger threadbase setParameters.
The function checkForNewParameters_l() is called with the ThreadBase mutex mLock locked. In the case where the parameter change implies
an audio parameter modification (e.g. sampling rate) the function sendConfigEvent() is called which tries to lock mLock creating a deadlock.

The fix consists in creating a function equivalent to sendConfigEvent() that must be called with mLock locked and does not lock mLock.

Also added the possibility to have more than one set parameter request pending.
2009-08-07 09:28:40 -07:00
Android (Google) Code Review
cf6b2bf469 Merge change 9660
* changes:
  Fix problem in A2DP interface closeOutputStream().
2009-08-07 09:09:10 -07:00
Android (Google) Code Review
dfbea2f397 Merge change 9653
* changes:
  Fix getParameters() default implementation.
2009-08-07 09:08:36 -07:00
Eric Laurent
e0e9ecc0ce Fix issue 2001214: AudioFlinger and AudioPolicyService interfaces should not use pointers as handles to inputs and outputs.
Use integers instead of void* as input/output handles at IAudioFlinger and IAudioPolicyService interfaces.
AudioFlinger maintains an always increasing count of opened inputs or outputs as unique ID.
2009-08-07 00:27:19 -07:00
Eric Laurent
8851d1e053 Fix problem in A2DP interface closeOutputStream().
If the output stream handler passed was not the A2DP output stream, the request was ignored instead of being forwarded downstream to hardware interface.
2009-08-04 07:43:10 -07:00
Eric Laurent
764db963fa Fix getParameters() default implementation.
Do not return empty string but key value pairs with empty values.
2009-08-04 06:17:43 -07:00
Android (Google) Code Review
c47c45f02d Merge change 8987
* changes:
  Fix firestone build
2009-07-29 09:50:29 -07:00
Marco Nelissen
f4531691b2 Fix firestone build 2009-07-29 09:47:23 -07:00
Eric Laurent
d55d179e95 Fix issue 2004229: DTMF tones play through earpiece (G1). 2009-07-28 06:11:55 -07:00
Eric Laurent
b734bce2ac Fix the build for BOARD_USES_GENERIC_AUDIO option 2009-07-25 01:41:52 -07:00
Eric Laurent
a2e32699f4 Fix issue 2001204: libaudiopolicy.so and libaudiopolicygeneric.so libraries must be pre-linked. 2009-07-24 06:58:44 -07:00
Eric Laurent
fd558a97ed Fix issue 1999585: audioflinger crash.
We were looping on the number of playback threads when dumping record threads.
2009-07-23 13:53:19 -07:00
Eric Laurent
9395d9be9c Fix the sim build. 2009-07-23 13:17:39 -07:00
Eric Laurent
9d91ad5d99 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
Nick Pelly
07c8a20f39 Standby A2DP audio hardware interface when disabling A2DP.
Patch supplied on advice of partner. This causes us to send suspend_sink to
Bluez via socket interface, so we enter suspend on the A2DP link faster.
This is especially important when switching to SCO so that we come closer to
whitepaper recommendations to suspend A2DP before setting up SCO.

We have another patch set to add DBUS A2DP suspend and resume calls to Bluez
that will do a better job of following whitepaper recommendations for
A2DP -> SCO -> A2DP, but this small patch is still an improvement.
2009-07-15 12:22:55 -07:00
Mathias Agopian
2d939020a4 another attempt to fix the sim 2009-07-14 02:08:27 -07:00
Android (Google) Code Review
17500c2031 am 3893da46: Merge change 6614 into donut
Merge commit '3893da46f0a97d59a7687ae2bd71ba855eb5ffe3'

* commit '3893da46f0a97d59a7687ae2bd71ba855eb5ffe3':
  Fix issue 1970108: crash in AudioFlinger::isMusicActive()
2009-07-09 12:49:43 -07:00
Eric Laurent
b025ca0c83 Fix issue 1970108: crash in AudioFlinger::isMusicActive()
Protected calls to MixerThread::isMusicActive() by AudioFlinger::mLock
2009-07-09 03:20:57 -07:00
Android (Google) Code Review
4f9039002a am a5188a09: Merge change 6367 into donut
Merge commit 'a5188a09bd20c376b4f0645b0df4c52f8e114e21'

* commit 'a5188a09bd20c376b4f0645b0df4c52f8e114e21':
  Add virtual destructor.
2009-07-07 12:14:01 -07:00
Android (Google) Code Review
ed65428df2 Merge change 6367 into donut
* changes:
  Add virtual destructor.
2009-07-07 12:12:12 -07:00
Marco Nelissen
1c0f5382ed Add virtual destructor. 2009-07-07 11:03:13 -07:00
Eric Laurent
8434c78862 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
2009-07-07 09:36:14 -07:00
Eric Laurent
0bac53801b 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.
2009-07-07 07:10:45 -07:00
Android (Google) Code Review
7887aa766e am 2bbb80e1: Merge change 5994 into donut
Merge commit '2bbb80e183c6492689f8b10b2d0f5dfe9872a6ac'

* commit '2bbb80e183c6492689f8b10b2d0f5dfe9872a6ac':
  Less logging in some places.  More in others.
2009-07-03 08:18:22 -07:00
Joe Onorato
00dae0a084 Less logging in some places. More in others. 2009-07-01 21:04:03 -04:00
Jaikumar Ganesh
e3408b8e02 Framework changes for bluez4.
Changes in the Bluetooth JNI calls and framework functions
for Bluez4.
2009-06-09 17:21:08 -07:00
Android (Google) Code Review
e5eb06d98b am d9cc7659: Merge change 2706 into donut
Merge commit 'd9cc7659fa9b8544e2a3ca7b7040fbd79afdf7ea'

* commit 'd9cc7659fa9b8544e2a3ca7b7040fbd79afdf7ea':
  Fix issue 1883666: Audio coming from the music player stopped suddenly
2009-05-29 09:42:26 -07:00
Eric Laurent
01c4ba3563 Fix issue 1883666: Audio coming from the music player stopped suddenly
The problem comes from the code handling the automatic change of audio routing to speaker when notifications are played. The music is also muted while the sound is forced to speaker.
To avoid truncating the end of the notification, a delay is inserted between the end of the notification and the restoration of the audio routing.  If a new notification starts during this delay, the current music mute state read and saved before muting music corresponds to the forced mute due to previous notification. When the new notification ends, the mute state restored is muted and music stream stays muted for ever.

The fix consists in reading and saving music mute state only if the audio routing has been restored (check that mForcedRoute is back to 0).
2009-05-29 02:03:21 -07:00
Android (Google) Code Review
a26299d276 am de8268d6: Merge change 2331 into donut
Merge commit 'de8268d6d1cd168510c490b17e93154d2eab767c'

* commit 'de8268d6d1cd168510c490b17e93154d2eab767c':
  Fix issue 1846343 - part 1
2009-05-26 10:11:44 -07:00
Eric Laurent
570dd0b4da 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.
2009-05-26 07:44:28 -07:00
Mathias Agopian
c5b2c0bf80 move libbinder's header files under includes/binder 2009-05-20 12:55:03 -07:00
Mathias Agopian
208059f67e checkpoint: split libutils into libutils + libbinder 2009-05-20 12:55:02 -07:00
Android (Google) Code Review
8c28eab6e2 am eb2c314b: Merge change 2042 into donut
Merge commit 'eb2c314b4d31c44af8a27ef51120b33290e65837'

* commit 'eb2c314b4d31c44af8a27ef51120b33290e65837':
  Remove deprecated openInputStream factory method
2009-05-20 08:54:45 -07:00
Android (Google) Code Review
1e26a818e5 am a59aba8c: Merge changes 2023,2036 into donut
Merge commit 'a59aba8cd88b8f98fa4de2a903899bc6ac9f73e8'

* commit 'a59aba8cd88b8f98fa4de2a903899bc6ac9f73e8':
  Update more references to openInputStream in support classes.
  Modify AudioFlinger to use updated openInputStream factory method.
2009-05-20 08:54:45 -07:00
Android (Google) Code Review
d0945865cc am f6382011: Merge change 1998 into donut
Merge commit 'f638201182818f9e4041c6a862a297c6723240c0'

* commit 'f638201182818f9e4041c6a862a297c6723240c0':
  Add inputSource to openInputStream
2009-05-20 08:54:44 -07:00
Dave Sparks
6c41033c47 Remove deprecated openInputStream factory method 2009-05-19 18:56:13 -07:00
Dave Sparks
6554773d62 Update more references to openInputStream in support classes.
Continuation of bug 1846343
2009-05-19 18:28:20 -07:00
Dave Sparks
0e06d21a22 Modify AudioFlinger to use updated openInputStream factory method.
Continuation of bug 1846343
2009-05-19 16:41:29 -07:00
Dave Sparks
a5a11d47e9 Add inputSource to openInputStream
Continuation of bug 1846343
2009-05-19 14:38:46 -07:00
Jean-Baptiste Queru
2bcce3696e Merge donut into master 2009-04-22 17:12:34 -07:00
Eric Laurent
4dd495b72c Fix issue 1745312: Various cleanups in media framework
AudioTrack, AudioRecord:
  - remove useless mAudioFlinger member of AudioTrack and AudioRecord.
  - signal cblk.cv condition in stop() method to speed up stop completion.
  - extend wait condition timeout in obtainBuffer() when waitCount is -1 to avoid waking up callback thread unnecessarily

AudioFlinger:
  - remove some warnings in AudioFlinger.cpp.
  - remove function AudioFlinger::MixerThread::removetrack_l()  as its content is never executed.
  - remove useless call to setMasterVolume in AudioFlinger::handleForcedSpeakerRoute().
  - Offset VOICE_CALL stream volume to reflect actual volume that is never 0 in hardware (this fix has been made in the open source): 0.01 + v * 0.99.

AudioSystem.java:
  - correct typo in comment

IAudioflinger, IAudioFlingerClient:
  - make AudioFlinger binder interfaces used for callbacks ONEWAY.

AudioHardwareInterface:
  - correct routeStrings[] table in AudioHardwareInteface.cpp
2009-04-21 07:56:33 -07:00
Nick Pelly
40b304e574 Merge branch 'readonly-p4-master' 2009-04-02 10:31:50 -07:00
Nick Pelly
42781c76fc AI 144205: am: CL 144151 am: CL 144150 Fix heap corruption.
Take mutex in close(), and skip write path after turning bluetooth off.
  Original author: npelly
  Merged from: //branches/cupcake/...
  Original author: android-build
  Merged from: //branches/donutburger/...

Automated import of CL 144205
2009-04-02 10:30:39 -07:00