1542 lines
64 KiB
C
Raw Normal View History

/* //device/include/server/AudioFlinger/AudioFlinger.h
**
** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#ifndef ANDROID_AUDIO_FLINGER_H
#define ANDROID_AUDIO_FLINGER_H
#include <stdint.h>
#include <sys/types.h>
#include <limits.h>
#include <common_time/cc_helper.h>
#include <media/IAudioFlinger.h>
#include <media/IAudioFlingerClient.h>
#include <media/IAudioTrack.h>
#include <media/IAudioRecord.h>
#include <media/AudioTrack.h>
#include <utils/Atomic.h>
#include <utils/Errors.h>
#include <utils/threads.h>
#include <utils/SortedVector.h>
#include <utils/TypeHelpers.h>
#include <utils/Vector.h>
#include <binder/BinderService.h>
#include <binder/MemoryDealer.h>
#include <system/audio.h>
#include <hardware/audio.h>
#include "AudioBufferProvider.h"
#include <powermanager/IPowerManager.h>
namespace android {
class audio_track_cblk_t;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
class effect_param_cblk_t;
class AudioMixer;
class AudioBuffer;
class AudioResampler;
// ----------------------------------------------------------------------------
#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true ))
#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false ))
// ----------------------------------------------------------------------------
static const nsecs_t kDefaultStandbyTimeInNsecs = seconds(3);
class AudioFlinger :
public BinderService<AudioFlinger>,
public BnAudioFlinger
{
friend class BinderService<AudioFlinger>;
public:
static char const* getServiceName() { return "media.audio_flinger"; }
virtual status_t dump(int fd, const Vector<String16>& args);
// IAudioFlinger interface
virtual sp<IAudioTrack> createTrack(
pid_t pid,
int streamType,
uint32_t sampleRate,
uint32_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
const sp<IMemory>& sharedBuffer,
int output,
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
bool isTimed,
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
int *sessionId,
status_t *status);
virtual uint32_t sampleRate(int output) const;
virtual int channelCount(int output) const;
virtual uint32_t format(int output) const;
virtual size_t frameCount(int output) const;
virtual uint32_t latency(int output) const;
virtual status_t setMasterVolume(float value);
virtual status_t setMasterMute(bool muted);
virtual float masterVolume() const;
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
virtual float masterVolumeSW() const;
virtual bool masterMute() const;
virtual status_t setStreamVolume(int stream, float value, int output);
virtual status_t setStreamMute(int stream, bool muted);
virtual float streamVolume(int stream, int output) const;
virtual bool streamMute(int stream) const;
virtual status_t setMode(int mode);
virtual status_t setMicMute(bool state);
virtual bool getMicMute() const;
virtual status_t setParameters(int ioHandle, const String8& keyValuePairs);
virtual String8 getParameters(int ioHandle, const String8& keys);
virtual void registerClient(const sp<IAudioFlingerClient>& client);
virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount);
virtual unsigned int getInputFramesLost(int ioHandle);
virtual int openOutput(uint32_t *pDevices,
uint32_t *pSamplingRate,
uint32_t *pFormat,
uint32_t *pChannels,
uint32_t *pLatencyMs,
uint32_t flags);
virtual int openDuplicateOutput(int output1, int output2);
virtual status_t closeOutput(int output);
virtual status_t suspendOutput(int output);
virtual status_t restoreOutput(int output);
virtual int openInput(uint32_t *pDevices,
uint32_t *pSamplingRate,
uint32_t *pFormat,
uint32_t *pChannels,
uint32_t acoustics);
virtual status_t closeInput(int input);
virtual status_t setStreamOutput(uint32_t stream, int output);
virtual status_t setVoiceVolume(float volume);
virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
virtual int newAudioSessionId();
virtual void acquireAudioSessionId(int audioSession);
virtual void releaseAudioSessionId(int audioSession);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
virtual status_t queryNumberEffects(uint32_t *numEffects);
Various fixes and improvements in audio effects implementation Effect API: - Use different definitions for audio device, channels, formats... in AudioSystem and EffectApi: Removed media/AudioCommon.h file created for initial version of EffectApi - Indicate audio session and output ID to effect library when calling EffectCreate(). Session ID can be useful to optimize the implementation of effect chains in the same audio session. Output ID can be used for effects implemented in audio hardware. - Renamed EffectQueryNext() function to EffectQueryEffect() and changed operating mode: now an index is passed for the queried effect instead of implicitly querying the next one. - Added CPU load and memory usage indication in effects descriptor - Added flags and commands to indicate changes in audio mode (ring tone, in call...) to effect engine - Added flag to indicate hardware accelerated effect implementation. - Renamed EffectFactoryApi.h to EffectsFactoryApi.h for consistency with EffectsFactory.c/h Effect libraries: - Reflected changes in Effect API - Several fixes in reverb implementation - Added build option TEST_EFFECT_LIBRARIES in makefile to prepare integration of actual effect library. - Replaced pointer by integer identifier for library handle returned by effects factory Audio effect framework: - Added support for audio session -1 in preparation of output stage effects configuration. - Reflected changes in Effect API - Removed volume ramp up/down when effect is inserted/removed: this has to be taken care of by effect engines. - Added some overflow verification on indexes used for deferred parameter updates via shared memory - Added hardcoded CPU and memory limit check when creating a new effect instance Change-Id: I43fee5182ee201384ea3479af6d0acb95092901d
2010-06-23 17:38:20 -07:00
virtual status_t queryEffect(uint32_t index, effect_descriptor_t *descriptor);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
virtual status_t getEffectDescriptor(effect_uuid_t *pUuid, effect_descriptor_t *descriptor);
virtual sp<IEffect> createEffect(pid_t pid,
effect_descriptor_t *pDesc,
const sp<IEffectClient>& effectClient,
int32_t priority,
int io,
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
int sessionId,
status_t *status,
int *id,
int *enabled);
virtual status_t moveEffects(int sessionId, int srcOutput, int dstOutput);
Various fixes and improvements in audio effects implementation Effect API: - Use different definitions for audio device, channels, formats... in AudioSystem and EffectApi: Removed media/AudioCommon.h file created for initial version of EffectApi - Indicate audio session and output ID to effect library when calling EffectCreate(). Session ID can be useful to optimize the implementation of effect chains in the same audio session. Output ID can be used for effects implemented in audio hardware. - Renamed EffectQueryNext() function to EffectQueryEffect() and changed operating mode: now an index is passed for the queried effect instead of implicitly querying the next one. - Added CPU load and memory usage indication in effects descriptor - Added flags and commands to indicate changes in audio mode (ring tone, in call...) to effect engine - Added flag to indicate hardware accelerated effect implementation. - Renamed EffectFactoryApi.h to EffectsFactoryApi.h for consistency with EffectsFactory.c/h Effect libraries: - Reflected changes in Effect API - Several fixes in reverb implementation - Added build option TEST_EFFECT_LIBRARIES in makefile to prepare integration of actual effect library. - Replaced pointer by integer identifier for library handle returned by effects factory Audio effect framework: - Added support for audio session -1 in preparation of output stage effects configuration. - Reflected changes in Effect API - Removed volume ramp up/down when effect is inserted/removed: this has to be taken care of by effect engines. - Added some overflow verification on indexes used for deferred parameter updates via shared memory - Added hardcoded CPU and memory limit check when creating a new effect instance Change-Id: I43fee5182ee201384ea3479af6d0acb95092901d
2010-06-23 17:38:20 -07:00
enum hardware_call_state {
AUDIO_HW_IDLE = 0,
AUDIO_HW_INIT,
AUDIO_HW_OUTPUT_OPEN,
AUDIO_HW_OUTPUT_CLOSE,
AUDIO_HW_INPUT_OPEN,
AUDIO_HW_INPUT_CLOSE,
AUDIO_HW_STANDBY,
AUDIO_HW_SET_MASTER_VOLUME,
AUDIO_HW_GET_ROUTING,
AUDIO_HW_SET_ROUTING,
AUDIO_HW_GET_MODE,
AUDIO_HW_SET_MODE,
AUDIO_HW_GET_MIC_MUTE,
AUDIO_HW_SET_MIC_MUTE,
AUDIO_SET_VOICE_VOLUME,
AUDIO_SET_PARAMETER,
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
AUDIO_HW_GET_MASTER_VOLUME,
};
// record interface
virtual sp<IAudioRecord> openRecord(
pid_t pid,
int input,
uint32_t sampleRate,
uint32_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
int *sessionId,
status_t *status);
virtual status_t onTransact(
uint32_t code,
const Parcel& data,
Parcel* reply,
uint32_t flags);
Various fixes and improvements in audio effects implementation Effect API: - Use different definitions for audio device, channels, formats... in AudioSystem and EffectApi: Removed media/AudioCommon.h file created for initial version of EffectApi - Indicate audio session and output ID to effect library when calling EffectCreate(). Session ID can be useful to optimize the implementation of effect chains in the same audio session. Output ID can be used for effects implemented in audio hardware. - Renamed EffectQueryNext() function to EffectQueryEffect() and changed operating mode: now an index is passed for the queried effect instead of implicitly querying the next one. - Added CPU load and memory usage indication in effects descriptor - Added flags and commands to indicate changes in audio mode (ring tone, in call...) to effect engine - Added flag to indicate hardware accelerated effect implementation. - Renamed EffectFactoryApi.h to EffectsFactoryApi.h for consistency with EffectsFactory.c/h Effect libraries: - Reflected changes in Effect API - Several fixes in reverb implementation - Added build option TEST_EFFECT_LIBRARIES in makefile to prepare integration of actual effect library. - Replaced pointer by integer identifier for library handle returned by effects factory Audio effect framework: - Added support for audio session -1 in preparation of output stage effects configuration. - Reflected changes in Effect API - Removed volume ramp up/down when effect is inserted/removed: this has to be taken care of by effect engines. - Added some overflow verification on indexes used for deferred parameter updates via shared memory - Added hardcoded CPU and memory limit check when creating a new effect instance Change-Id: I43fee5182ee201384ea3479af6d0acb95092901d
2010-06-23 17:38:20 -07:00
uint32_t getMode() { return mMode; }
bool btNrecIsOff() { return mBtNrecIsOff; }
private:
AudioFlinger();
virtual ~AudioFlinger();
status_t initCheck() const;
virtual void onFirstRef();
audio_hw_device_t* findSuitableHwDev_l(uint32_t devices);
void purgeStaleEffects_l();
static Mutex mStaticInitLock;
static bool mStaticInitDone;
static bool doStaticInit();
static nsecs_t mStandbyTimeInNsecs;
// Internal dump utilites.
status_t dumpPermissionDenial(int fd, const Vector<String16>& args);
status_t dumpClients(int fd, const Vector<String16>& args);
status_t dumpInternals(int fd, const Vector<String16>& args);
// --- Client ---
class Client : public RefBase {
public:
Client(const sp<AudioFlinger>& audioFlinger, pid_t pid);
virtual ~Client();
const sp<MemoryDealer>& heap() const;
pid_t pid() const { return mPid; }
sp<AudioFlinger> audioFlinger() { return mAudioFlinger; }
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
bool reserveTimedTrack();
void releaseTimedTrack();
private:
Client(const Client&);
Client& operator = (const Client&);
sp<AudioFlinger> mAudioFlinger;
sp<MemoryDealer> mMemoryDealer;
pid_t mPid;
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
Mutex mTimedTrackLock;
int mTimedTrackCount;
};
// --- Notification Client ---
class NotificationClient : public IBinder::DeathRecipient {
public:
NotificationClient(const sp<AudioFlinger>& audioFlinger,
const sp<IAudioFlingerClient>& client,
pid_t pid);
virtual ~NotificationClient();
sp<IAudioFlingerClient> client() { return mClient; }
// IBinder::DeathRecipient
virtual void binderDied(const wp<IBinder>& who);
private:
NotificationClient(const NotificationClient&);
NotificationClient& operator = (const NotificationClient&);
sp<AudioFlinger> mAudioFlinger;
pid_t mPid;
sp<IAudioFlingerClient> mClient;
};
class TrackHandle;
class RecordHandle;
class RecordThread;
class PlaybackThread;
class MixerThread;
class DirectOutputThread;
class DuplicatingThread;
class Track;
class RecordTrack;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
class EffectModule;
class EffectHandle;
class EffectChain;
struct AudioStreamOut;
struct AudioStreamIn;
class ThreadBase : public Thread {
public:
ThreadBase (const sp<AudioFlinger>& audioFlinger, int id, uint32_t device);
virtual ~ThreadBase();
enum type {
MIXER, // Thread class is MixerThread
DIRECT, // Thread class is DirectOutputThread
DUPLICATING, // Thread class is DuplicatingThread
RECORD // Thread class is RecordThread
};
status_t dumpBase(int fd, const Vector<String16>& args);
status_t dumpEffectChains(int fd, const Vector<String16>& args);
void clearPowerManager();
// base for record and playback
class TrackBase : public AudioBufferProvider, public RefBase {
public:
enum track_state {
IDLE,
TERMINATED,
STOPPED,
RESUMING,
ACTIVE,
PAUSING,
PAUSED
};
enum track_flags {
STEPSERVER_FAILED = 0x01, // StepServer could not acquire cblk->lock mutex
SYSTEM_FLAGS_MASK = 0x0000ffffUL,
// The upper 16 bits are used for track-specific flags.
};
TrackBase(const wp<ThreadBase>& thread,
const sp<Client>& client,
uint32_t sampleRate,
uint32_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
const sp<IMemory>& sharedBuffer,
int sessionId);
~TrackBase();
virtual status_t start() = 0;
virtual void stop() = 0;
sp<IMemory> getCblk() const;
audio_track_cblk_t* cblk() const { return mCblk; }
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
int sessionId() { return mSessionId; }
protected:
friend class ThreadBase;
friend class RecordHandle;
2009-07-23 13:17:39 -07:00
friend class PlaybackThread;
friend class RecordThread;
friend class MixerThread;
friend class DirectOutputThread;
TrackBase(const TrackBase&);
TrackBase& operator = (const TrackBase&);
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
virtual status_t getNextBuffer(
AudioBufferProvider::Buffer* buffer,
int64_t pts) = 0;
virtual void releaseBuffer(AudioBufferProvider::Buffer* buffer);
uint32_t format() const {
return mFormat;
}
int channelCount() const ;
uint32_t channelMask() const;
int sampleRate() const;
void* getBuffer(uint32_t offset, uint32_t frames) const;
bool isStopped() const {
return mState == STOPPED;
}
bool isTerminated() const {
return mState == TERMINATED;
}
bool step();
void reset();
wp<ThreadBase> mThread;
sp<Client> mClient;
sp<IMemory> mCblkMemory;
audio_track_cblk_t* mCblk;
void* mBuffer;
void* mBufferEnd;
uint32_t mFrameCount;
// we don't really need a lock for these
int mState;
int mClientTid;
uint32_t mFormat;
uint32_t mFlags;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
int mSessionId;
uint8_t mChannelCount;
uint32_t mChannelMask;
};
class ConfigEvent {
public:
ConfigEvent() : mEvent(0), mParam(0) {}
int mEvent;
int mParam;
};
class PMDeathRecipient : public IBinder::DeathRecipient {
public:
PMDeathRecipient(const wp<ThreadBase>& thread) : mThread(thread) {}
virtual ~PMDeathRecipient() {}
// IBinder::DeathRecipient
virtual void binderDied(const wp<IBinder>& who);
private:
PMDeathRecipient(const PMDeathRecipient&);
PMDeathRecipient& operator = (const PMDeathRecipient&);
wp<ThreadBase> mThread;
};
virtual status_t initCheck() const = 0;
int type() const { return mType; }
uint32_t sampleRate() const;
int channelCount() const;
uint32_t format() const;
size_t frameCount() const;
void wakeUp() { mWaitWorkCV.broadcast(); }
void exit();
virtual bool checkForNewParameters_l() = 0;
virtual status_t setParameters(const String8& keyValuePairs);
virtual String8 getParameters(const String8& keys) = 0;
Fix issue 2553359: Pandora does not work well with Passion deskdock / Cardock. The problem is due to a too big difference between the buffer size used at the hardware interface and at the A2DP interface. When no resampling occurs we don't notice problems but the timing is very tight. As soon as resampling is activated, the AudioTrack underruns. This is because the AudioTrack buffers are not resized when moving the AudioTrack from hardware to A2DP output. The AudioTrack buffers are calculated based on a hardware output buffer size of 3072 bytes. Which is much less than the A2DP output buffer size (10240). The solution consists in creating new tracks with new buffers in AudioFlinger when the A2DP output is opened instead of just transfering active tracks from hardware output mixer thread to the new A2DP output mixer thread. To avoid synchronization issues between mixer threads and client processes, this is done by invalidating tracks by setting a flag in their control block and having AudioTrack release the handle on this track (IAudioTrack) and create a new IAudioTrack when this flag is detected next time obtainBuffer() or start() is executed. AudioFlinger modifications: - invalidate the tracks when setStreamOutput() is called - make sure that notifications of output opening/closing and change of stream type to output mapping are sent synchronously to client process. This is necessary so that AudioSystem has the new stream to output mapping when the AudioTrack detects the invalidate flag in the client process. Previously their were sent when the corresponding thread loop was executed. AudioTrack modifications: - move frame count calculation and verification from set() to createTrack() so that is is updated every time a new IAudioTrack is created. - detect track invalidate flag in obtainBuffer() and start() and create a new IAudioTrack. AudioTrackShared modifications - group all flags (out, flowControlFlag, forceReady...) into a single bit filed to save space. Change-Id: I9ac26b6192230627d35084e1449640caaf7d56ee
2010-05-14 03:26:45 -07:00
virtual void audioConfigChanged_l(int event, int param = 0) = 0;
void sendConfigEvent(int event, int param = 0);
void sendConfigEvent_l(int event, int param = 0);
void processConfigEvents();
int id() const { return mId;}
bool standby() { return mStandby; }
uint32_t device() { return mDevice; }
virtual audio_stream_t* stream() = 0;
sp<EffectHandle> createEffect_l(
const sp<AudioFlinger::Client>& client,
const sp<IEffectClient>& effectClient,
int32_t priority,
int sessionId,
effect_descriptor_t *desc,
int *enabled,
status_t *status);
void disconnectEffect(const sp< EffectModule>& effect,
const wp<EffectHandle>& handle,
bool unpiniflast);
// return values for hasAudioSession (bit field)
enum effect_state {
EFFECT_SESSION = 0x1, // the audio session corresponds to at least one
// effect
TRACK_SESSION = 0x2 // the audio session corresponds to at least one
// track
};
// get effect chain corresponding to session Id.
sp<EffectChain> getEffectChain(int sessionId);
// same as getEffectChain() but must be called with ThreadBase mutex locked
sp<EffectChain> getEffectChain_l(int sessionId);
// add an effect chain to the chain list (mEffectChains)
virtual status_t addEffectChain_l(const sp<EffectChain>& chain) = 0;
// remove an effect chain from the chain list (mEffectChains)
virtual size_t removeEffectChain_l(const sp<EffectChain>& chain) = 0;
// lock mall effect chains Mutexes. Must be called before releasing the
// ThreadBase mutex before processing the mixer and effects. This guarantees the
// integrity of the chains during the process.
void lockEffectChains_l(Vector<sp <EffectChain> >& effectChains);
// unlock effect chains after process
void unlockEffectChains(Vector<sp <EffectChain> >& effectChains);
// set audio mode to all effect chains
void setMode(uint32_t mode);
// get effect module with corresponding ID on specified audio session
sp<AudioFlinger::EffectModule> getEffect_l(int sessionId, int effectId);
// add and effect module. Also creates the effect chain is none exists for
// the effects audio session
status_t addEffect_l(const sp< EffectModule>& effect);
// remove and effect module. Also removes the effect chain is this was the last
// effect
void removeEffect_l(const sp< EffectModule>& effect);
// detach all tracks connected to an auxiliary effect
virtual void detachAuxEffect_l(int effectId) {}
// returns either EFFECT_SESSION if effects on this audio session exist in one
// chain, or TRACK_SESSION if tracks on this audio session exist, or both
virtual uint32_t hasAudioSession(int sessionId) = 0;
// the value returned by default implementation is not important as the
// strategy is only meaningful for PlaybackThread which implements this method
virtual uint32_t getStrategyForSession_l(int sessionId) { return 0; }
// suspend or restore effect according to the type of effect passed. a NULL
// type pointer means suspend all effects in the session
void setEffectSuspended(const effect_uuid_t *type,
bool suspend,
int sessionId = AUDIO_SESSION_OUTPUT_MIX);
// check if some effects must be suspended/restored when an effect is enabled
// or disabled
void checkSuspendOnEffectEnabled(const sp<EffectModule>& effect,
bool enabled,
int sessionId = AUDIO_SESSION_OUTPUT_MIX);
void checkSuspendOnEffectEnabled_l(const sp<EffectModule>& effect,
bool enabled,
int sessionId = AUDIO_SESSION_OUTPUT_MIX);
2009-07-23 13:17:39 -07:00
mutable Mutex mLock;
protected:
// entry describing an effect being suspended in mSuspendedSessions keyed vector
class SuspendedSessionDesc : public RefBase {
public:
SuspendedSessionDesc() : mRefCount(0) {}
int mRefCount; // number of active suspend requests
effect_uuid_t mType; // effect type UUID
};
void acquireWakeLock();
void acquireWakeLock_l();
void releaseWakeLock();
void releaseWakeLock_l();
void setEffectSuspended_l(const effect_uuid_t *type,
bool suspend,
int sessionId = AUDIO_SESSION_OUTPUT_MIX);
// updated mSuspendedSessions when an effect suspended or restored
void updateSuspendedSessions_l(const effect_uuid_t *type,
bool suspend,
int sessionId);
// check if some effects must be suspended when an effect chain is added
void checkSuspendOnAddEffectChain_l(const sp<EffectChain>& chain);
friend class AudioFlinger;
friend class Track;
friend class TrackBase;
friend class PlaybackThread;
friend class MixerThread;
friend class DirectOutputThread;
friend class DuplicatingThread;
friend class RecordThread;
friend class RecordTrack;
int mType;
Condition mWaitWorkCV;
sp<AudioFlinger> mAudioFlinger;
uint32_t mSampleRate;
size_t mFrameCount;
uint32_t mChannelMask;
uint16_t mChannelCount;
uint16_t mFrameSize;
uint32_t mFormat;
Condition mParamCond;
Vector<String8> mNewParameters;
status_t mParamStatus;
Vector<ConfigEvent *> mConfigEvents;
bool mStandby;
int mId;
bool mExiting;
Vector< sp<EffectChain> > mEffectChains;
uint32_t mDevice; // output device for PlaybackThread
// input + output devices for RecordThread
static const int kNameLength = 32;
char mName[kNameLength];
sp<IPowerManager> mPowerManager;
sp<IBinder> mWakeLockToken;
sp<PMDeathRecipient> mDeathRecipient;
// list of suspended effects per session and per type. The first vector is
// keyed by session ID, the second by type UUID timeLow field
KeyedVector< int, KeyedVector< int, sp<SuspendedSessionDesc> > > mSuspendedSessions;
};
// --- PlaybackThread ---
class PlaybackThread : public ThreadBase {
public:
enum mixer_state {
MIXER_IDLE,
MIXER_TRACKS_ENABLED,
MIXER_TRACKS_READY
};
// playback track
class Track : public TrackBase {
public:
Track( const wp<ThreadBase>& thread,
const sp<Client>& client,
int streamType,
uint32_t sampleRate,
uint32_t format,
uint32_t channelMask,
int frameCount,
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
const sp<IMemory>& sharedBuffer,
int sessionId);
~Track();
void dump(char* buffer, size_t size);
virtual status_t start();
virtual void stop();
void pause();
void flush();
void destroy();
void mute(bool);
void setVolume(float left, float right);
int name() const {
return mName;
}
int type() const {
return mStreamType;
}
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
status_t attachAuxEffect(int EffectId);
void setAuxBuffer(int EffectId, int32_t *buffer);
int32_t *auxBuffer() { return mAuxBuffer; }
void setMainBuffer(int16_t *buffer) { mMainBuffer = buffer; }
int16_t *mainBuffer() { return mMainBuffer; }
int auxEffectId() { return mAuxEffectId; }
protected:
friend class ThreadBase;
2009-07-23 13:17:39 -07:00
friend class TrackHandle;
friend class PlaybackThread;
friend class MixerThread;
friend class DirectOutputThread;
Track(const Track&);
Track& operator = (const Track&);
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
virtual status_t getNextBuffer(
AudioBufferProvider::Buffer* buffer,
int64_t pts);
virtual uint32_t framesReady() const;
bool isMuted() { return mMute; }
bool isPausing() const {
return mState == PAUSING;
}
bool isPaused() const {
return mState == PAUSED;
}
bool isReady() const;
void setPaused() { mState = PAUSED; }
void reset();
bool isOutputTrack() const {
return (mStreamType == AUDIO_STREAM_CNT);
}
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
virtual bool isTimedTrack() const { return false; }
// we don't really need a lock for these
float mVolume[2];
volatile bool mMute;
// FILLED state is used for suppressing volume ramp at begin of playing
enum {FS_FILLING, FS_FILLED, FS_ACTIVE};
mutable uint8_t mFillingUpStatus;
int8_t mRetryCount;
sp<IMemory> mSharedBuffer;
bool mResetDone;
int mStreamType;
int mName;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
int16_t *mMainBuffer;
int32_t *mAuxBuffer;
int mAuxEffectId;
bool mHasVolumeController;
}; // end of Track
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
class TimedTrack : public Track {
public:
static sp<TimedTrack> create(const wp<ThreadBase>& thread,
const sp<Client>& client,
int streamType,
uint32_t sampleRate,
uint32_t format,
uint32_t channelMask,
int frameCount,
const sp<IMemory>& sharedBuffer,
int sessionId);
~TimedTrack();
class TimedBuffer {
public:
TimedBuffer();
TimedBuffer(const sp<IMemory>& buffer, int64_t pts);
const sp<IMemory>& buffer() const { return mBuffer; }
int64_t pts() const { return mPTS; }
uint32_t position() const { return mPosition; }
void setPosition(uint32_t pos) { mPosition = pos; }
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
private:
sp<IMemory> mBuffer;
int64_t mPTS;
uint32_t mPosition;
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
};
// Mixer facing methods.
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
virtual bool isTimedTrack() const { return true; }
virtual uint32_t framesReady() const;
virtual status_t getNextBuffer(AudioBufferProvider::Buffer* buffer,
int64_t pts);
virtual void releaseBuffer(AudioBufferProvider::Buffer* buffer);
// Client/App facing methods.
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
status_t allocateTimedBuffer(size_t size,
sp<IMemory>* buffer);
status_t queueTimedBuffer(const sp<IMemory>& buffer,
int64_t pts);
status_t setMediaTimeTransform(const LinearTransform& xform,
TimedAudioTrack::TargetTimeline target);
private:
TimedTrack(const wp<ThreadBase>& thread,
const sp<Client>& client,
int streamType,
uint32_t sampleRate,
uint32_t format,
uint32_t channelMask,
int frameCount,
const sp<IMemory>& sharedBuffer,
int sessionId);
void timedYieldSamples_l(AudioBufferProvider::Buffer* buffer);
void timedYieldSilence_l(uint32_t numFrames,
AudioBufferProvider::Buffer* buffer);
void trimTimedBufferQueue_l();
void trimTimedBufferQueueHead_l(const char* logTag);
void updateFramesPendingAfterTrim_l(const TimedBuffer& buf,
const char* logTag);
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
uint64_t mLocalTimeFreq;
LinearTransform mLocalTimeToSampleTransform;
TimedAudio: Fix a cause of audio popping. Fix an issue with buffer lifecycle management which could cause audio pops on timed outputs. There were two issues at work here. 1) During trim operations for the queued timed audio data, buffers were being trimmed based on their starting PTS instead of when the chunk of audio data actually ended. This means that if you have a very large chunk of audio data (larger than the mixer lead time), then a buffer at the head of the queue could be eligible to be trimmed before its data had been completely mixed into the output stream, even though the output stream was fully buffered and in no danger of underflow. 2) The implementation of getNextBuffer and releaseBuffer for timed audio tracks was not keeping anything like a reference to the data that it handed out to the mixer. The original architecture here seemed to be expecting a ring buffer design, but timed audio tracks use a packet based design. Pieces of packets are handed out to the mixer which then frequently will hold onto that chunk of data across two mix operations, using the first part of the chunk to finish a mix buffer and then using the end of the chunk for the start of the next mix buffer. If the buffer that the mixer is holding a piece of got trimmed before the start of the next mix operation, it would return to its heap and could be filled with who knows what by the time it actually got mixed. On debug builds, they seem to get zero'ed out as they go back to the heap causing obvious pops in presentation. This change addresses both issues. Trim operations are now based on ending presentation time for a chunk of audio, not the start. Also, when the head of the queue is in flight to the mixer, it can no longer be trimmed immediately, merely flagged for trim by the mixer when the mixer finally does call releaseBuffer. Signed-off-by: John Grossman <johngro@google.com> Change-Id: Ia1ba08cb9dea35a698723ab2d9bcbf804f1682fe
2012-03-26 17:51:46 -07:00
LinearTransform mMediaTimeToSampleTransform;
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
sp<MemoryDealer> mTimedMemoryDealer;
TimedAudio: Fix a cause of audio popping. Fix an issue with buffer lifecycle management which could cause audio pops on timed outputs. There were two issues at work here. 1) During trim operations for the queued timed audio data, buffers were being trimmed based on their starting PTS instead of when the chunk of audio data actually ended. This means that if you have a very large chunk of audio data (larger than the mixer lead time), then a buffer at the head of the queue could be eligible to be trimmed before its data had been completely mixed into the output stream, even though the output stream was fully buffered and in no danger of underflow. 2) The implementation of getNextBuffer and releaseBuffer for timed audio tracks was not keeping anything like a reference to the data that it handed out to the mixer. The original architecture here seemed to be expecting a ring buffer design, but timed audio tracks use a packet based design. Pieces of packets are handed out to the mixer which then frequently will hold onto that chunk of data across two mix operations, using the first part of the chunk to finish a mix buffer and then using the end of the chunk for the start of the next mix buffer. If the buffer that the mixer is holding a piece of got trimmed before the start of the next mix operation, it would return to its heap and could be filled with who knows what by the time it actually got mixed. On debug builds, they seem to get zero'ed out as they go back to the heap causing obvious pops in presentation. This change addresses both issues. Trim operations are now based on ending presentation time for a chunk of audio, not the start. Also, when the head of the queue is in flight to the mixer, it can no longer be trimmed immediately, merely flagged for trim by the mixer when the mixer finally does call releaseBuffer. Signed-off-by: John Grossman <johngro@google.com> Change-Id: Ia1ba08cb9dea35a698723ab2d9bcbf804f1682fe
2012-03-26 17:51:46 -07:00
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
Vector<TimedBuffer> mTimedBufferQueue;
TimedAudio: Fix a cause of audio popping. Fix an issue with buffer lifecycle management which could cause audio pops on timed outputs. There were two issues at work here. 1) During trim operations for the queued timed audio data, buffers were being trimmed based on their starting PTS instead of when the chunk of audio data actually ended. This means that if you have a very large chunk of audio data (larger than the mixer lead time), then a buffer at the head of the queue could be eligible to be trimmed before its data had been completely mixed into the output stream, even though the output stream was fully buffered and in no danger of underflow. 2) The implementation of getNextBuffer and releaseBuffer for timed audio tracks was not keeping anything like a reference to the data that it handed out to the mixer. The original architecture here seemed to be expecting a ring buffer design, but timed audio tracks use a packet based design. Pieces of packets are handed out to the mixer which then frequently will hold onto that chunk of data across two mix operations, using the first part of the chunk to finish a mix buffer and then using the end of the chunk for the start of the next mix buffer. If the buffer that the mixer is holding a piece of got trimmed before the start of the next mix operation, it would return to its heap and could be filled with who knows what by the time it actually got mixed. On debug builds, they seem to get zero'ed out as they go back to the heap causing obvious pops in presentation. This change addresses both issues. Trim operations are now based on ending presentation time for a chunk of audio, not the start. Also, when the head of the queue is in flight to the mixer, it can no longer be trimmed immediately, merely flagged for trim by the mixer when the mixer finally does call releaseBuffer. Signed-off-by: John Grossman <johngro@google.com> Change-Id: Ia1ba08cb9dea35a698723ab2d9bcbf804f1682fe
2012-03-26 17:51:46 -07:00
bool mQueueHeadInFlight;
bool mTrimQueueHeadOnRelease;
uint32_t mFramesPendingInQueue;
TimedAudio: Fix a cause of audio popping. Fix an issue with buffer lifecycle management which could cause audio pops on timed outputs. There were two issues at work here. 1) During trim operations for the queued timed audio data, buffers were being trimmed based on their starting PTS instead of when the chunk of audio data actually ended. This means that if you have a very large chunk of audio data (larger than the mixer lead time), then a buffer at the head of the queue could be eligible to be trimmed before its data had been completely mixed into the output stream, even though the output stream was fully buffered and in no danger of underflow. 2) The implementation of getNextBuffer and releaseBuffer for timed audio tracks was not keeping anything like a reference to the data that it handed out to the mixer. The original architecture here seemed to be expecting a ring buffer design, but timed audio tracks use a packet based design. Pieces of packets are handed out to the mixer which then frequently will hold onto that chunk of data across two mix operations, using the first part of the chunk to finish a mix buffer and then using the end of the chunk for the start of the next mix buffer. If the buffer that the mixer is holding a piece of got trimmed before the start of the next mix operation, it would return to its heap and could be filled with who knows what by the time it actually got mixed. On debug builds, they seem to get zero'ed out as they go back to the heap causing obvious pops in presentation. This change addresses both issues. Trim operations are now based on ending presentation time for a chunk of audio, not the start. Also, when the head of the queue is in flight to the mixer, it can no longer be trimmed immediately, merely flagged for trim by the mixer when the mixer finally does call releaseBuffer. Signed-off-by: John Grossman <johngro@google.com> Change-Id: Ia1ba08cb9dea35a698723ab2d9bcbf804f1682fe
2012-03-26 17:51:46 -07:00
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
uint8_t* mTimedSilenceBuffer;
uint32_t mTimedSilenceBufferSize;
mutable Mutex mTimedBufferQueueLock;
bool mTimedAudioOutputOnTime;
CCHelper mCCHelper;
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
Mutex mMediaTimeTransformLock;
LinearTransform mMediaTimeTransform;
bool mMediaTimeTransformValid;
TimedAudioTrack::TargetTimeline mMediaTimeTransformTarget;
};
// playback track
class OutputTrack : public Track {
public:
class Buffer: public AudioBufferProvider::Buffer {
public:
int16_t *mBuffer;
};
OutputTrack( const wp<ThreadBase>& thread,
DuplicatingThread *sourceThread,
uint32_t sampleRate,
uint32_t format,
uint32_t channelMask,
int frameCount);
~OutputTrack();
virtual status_t start();
virtual void stop();
bool write(int16_t* data, uint32_t frames);
bool bufferQueueEmpty() { return (mBufferQueue.size() == 0) ? true : false; }
bool isActive() { return mActive; }
wp<ThreadBase>& thread() { return mThread; }
private:
status_t obtainBuffer(AudioBufferProvider::Buffer* buffer, uint32_t waitTimeMs);
void clearBufferQueue();
// Maximum number of pending buffers allocated by OutputTrack::write()
static const uint8_t kMaxOverFlowBuffers = 10;
Vector < Buffer* > mBufferQueue;
AudioBufferProvider::Buffer mOutBuffer;
bool mActive;
DuplicatingThread* mSourceThread;
}; // end of OutputTrack
PlaybackThread (const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id, uint32_t device);
virtual ~PlaybackThread();
virtual status_t dump(int fd, const Vector<String16>& args);
// Thread virtuals
virtual status_t readyToRun();
virtual void onFirstRef();
virtual status_t initCheck() const { return (mOutput == 0) ? NO_INIT : NO_ERROR; }
virtual uint32_t latency() const;
virtual status_t setMasterVolume(float value);
virtual status_t setMasterMute(bool muted);
virtual float masterVolume() const;
virtual bool masterMute() const;
virtual status_t setStreamVolume(int stream, float value);
virtual status_t setStreamMute(int stream, bool muted);
virtual float streamVolume(int stream) const;
virtual bool streamMute(int stream) const;
sp<Track> createTrack_l(
const sp<AudioFlinger::Client>& client,
int streamType,
uint32_t sampleRate,
uint32_t format,
uint32_t channelMask,
int frameCount,
const sp<IMemory>& sharedBuffer,
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
int sessionId,
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
bool isTimed,
status_t *status);
AudioStreamOut* getOutput();
AudioStreamOut* clearOutput();
virtual audio_stream_t* stream();
void suspend() { mSuspended++; }
void restore() { if (mSuspended) mSuspended--; }
bool isSuspended() { return (mSuspended != 0); }
virtual String8 getParameters(const String8& keys);
Fix issue 2553359: Pandora does not work well with Passion deskdock / Cardock. The problem is due to a too big difference between the buffer size used at the hardware interface and at the A2DP interface. When no resampling occurs we don't notice problems but the timing is very tight. As soon as resampling is activated, the AudioTrack underruns. This is because the AudioTrack buffers are not resized when moving the AudioTrack from hardware to A2DP output. The AudioTrack buffers are calculated based on a hardware output buffer size of 3072 bytes. Which is much less than the A2DP output buffer size (10240). The solution consists in creating new tracks with new buffers in AudioFlinger when the A2DP output is opened instead of just transfering active tracks from hardware output mixer thread to the new A2DP output mixer thread. To avoid synchronization issues between mixer threads and client processes, this is done by invalidating tracks by setting a flag in their control block and having AudioTrack release the handle on this track (IAudioTrack) and create a new IAudioTrack when this flag is detected next time obtainBuffer() or start() is executed. AudioFlinger modifications: - invalidate the tracks when setStreamOutput() is called - make sure that notifications of output opening/closing and change of stream type to output mapping are sent synchronously to client process. This is necessary so that AudioSystem has the new stream to output mapping when the AudioTrack detects the invalidate flag in the client process. Previously their were sent when the corresponding thread loop was executed. AudioTrack modifications: - move frame count calculation and verification from set() to createTrack() so that is is updated every time a new IAudioTrack is created. - detect track invalidate flag in obtainBuffer() and start() and create a new IAudioTrack. AudioTrackShared modifications - group all flags (out, flowControlFlag, forceReady...) into a single bit filed to save space. Change-Id: I9ac26b6192230627d35084e1449640caaf7d56ee
2010-05-14 03:26:45 -07:00
virtual void audioConfigChanged_l(int event, int param = 0);
virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
int16_t *mixBuffer() { return mMixBuffer; };
virtual void detachAuxEffect_l(int effectId);
status_t attachAuxEffect(const sp<AudioFlinger::PlaybackThread::Track> track,
int EffectId);
status_t attachAuxEffect_l(const sp<AudioFlinger::PlaybackThread::Track> track,
int EffectId);
virtual status_t addEffectChain_l(const sp<EffectChain>& chain);
virtual size_t removeEffectChain_l(const sp<EffectChain>& chain);
virtual uint32_t hasAudioSession(int sessionId);
virtual uint32_t getStrategyForSession_l(int sessionId);
void setStreamValid(int streamType, bool valid);
struct stream_type_t {
stream_type_t()
: volume(1.0f),
mute(false),
valid(true)
{
}
float volume;
bool mute;
bool valid;
};
2009-07-23 13:17:39 -07:00
protected:
int16_t* mMixBuffer;
int mSuspended;
2009-07-23 13:17:39 -07:00
int mBytesWritten;
bool mMasterMute;
SortedVector< wp<Track> > mActiveTracks;
virtual int getTrackName_l() = 0;
virtual void deleteTrackName_l(int name) = 0;
virtual uint32_t activeSleepTimeUs();
virtual uint32_t idleSleepTimeUs() = 0;
virtual uint32_t suspendSleepTimeUs() = 0;
private:
friend class AudioFlinger;
friend class OutputTrack;
friend class Track;
friend class TrackBase;
friend class MixerThread;
friend class DirectOutputThread;
friend class DuplicatingThread;
PlaybackThread(const Client&);
PlaybackThread& operator = (const PlaybackThread&);
status_t addTrack_l(const sp<Track>& track);
void destroyTrack_l(const sp<Track>& track);
void removeTrack_l(const sp<Track>& track);
void readOutputParameters();
virtual status_t dumpInternals(int fd, const Vector<String16>& args);
status_t dumpTracks(int fd, const Vector<String16>& args);
SortedVector< sp<Track> > mTracks;
// mStreamTypes[] uses 1 additionnal stream type internally for the OutputTrack used by DuplicatingThread
stream_type_t mStreamTypes[AUDIO_STREAM_CNT + 1];
AudioStreamOut* mOutput;
float mMasterVolume;
nsecs_t mLastWriteTime;
int mNumWrites;
int mNumDelayedWrites;
bool mInWrite;
};
class MixerThread : public PlaybackThread {
public:
MixerThread (const sp<AudioFlinger>& audioFlinger,
AudioStreamOut* output,
int id,
uint32_t device);
virtual ~MixerThread();
// Thread virtuals
virtual bool threadLoop();
Fix issue 2553359: Pandora does not work well with Passion deskdock / Cardock. The problem is due to a too big difference between the buffer size used at the hardware interface and at the A2DP interface. When no resampling occurs we don't notice problems but the timing is very tight. As soon as resampling is activated, the AudioTrack underruns. This is because the AudioTrack buffers are not resized when moving the AudioTrack from hardware to A2DP output. The AudioTrack buffers are calculated based on a hardware output buffer size of 3072 bytes. Which is much less than the A2DP output buffer size (10240). The solution consists in creating new tracks with new buffers in AudioFlinger when the A2DP output is opened instead of just transfering active tracks from hardware output mixer thread to the new A2DP output mixer thread. To avoid synchronization issues between mixer threads and client processes, this is done by invalidating tracks by setting a flag in their control block and having AudioTrack release the handle on this track (IAudioTrack) and create a new IAudioTrack when this flag is detected next time obtainBuffer() or start() is executed. AudioFlinger modifications: - invalidate the tracks when setStreamOutput() is called - make sure that notifications of output opening/closing and change of stream type to output mapping are sent synchronously to client process. This is necessary so that AudioSystem has the new stream to output mapping when the AudioTrack detects the invalidate flag in the client process. Previously their were sent when the corresponding thread loop was executed. AudioTrack modifications: - move frame count calculation and verification from set() to createTrack() so that is is updated every time a new IAudioTrack is created. - detect track invalidate flag in obtainBuffer() and start() and create a new IAudioTrack. AudioTrackShared modifications - group all flags (out, flowControlFlag, forceReady...) into a single bit filed to save space. Change-Id: I9ac26b6192230627d35084e1449640caaf7d56ee
2010-05-14 03:26:45 -07:00
void invalidateTracks(int streamType);
virtual bool checkForNewParameters_l();
virtual status_t dumpInternals(int fd, const Vector<String16>& args);
protected:
uint32_t prepareTracks_l(const SortedVector< wp<Track> >& activeTracks,
Vector< sp<Track> > *tracksToRemove);
virtual int getTrackName_l();
virtual void deleteTrackName_l(int name);
virtual uint32_t idleSleepTimeUs();
virtual uint32_t suspendSleepTimeUs();
AudioMixer* mAudioMixer;
uint32_t mPrevMixerStatus; // previous status (mixer_state) returned by
// prepareTracks_l()
};
class DirectOutputThread : public PlaybackThread {
public:
DirectOutputThread (const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id, uint32_t device);
~DirectOutputThread();
// Thread virtuals
virtual bool threadLoop();
virtual bool checkForNewParameters_l();
protected:
virtual int getTrackName_l();
virtual void deleteTrackName_l(int name);
virtual uint32_t activeSleepTimeUs();
virtual uint32_t idleSleepTimeUs();
virtual uint32_t suspendSleepTimeUs();
private:
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
void applyVolume(uint16_t leftVol, uint16_t rightVol, bool ramp);
float mLeftVolFloat;
float mRightVolFloat;
uint16_t mLeftVolShort;
uint16_t mRightVolShort;
};
class DuplicatingThread : public MixerThread {
public:
DuplicatingThread (const sp<AudioFlinger>& audioFlinger, MixerThread* mainThread, int id);
~DuplicatingThread();
// Thread virtuals
virtual bool threadLoop();
void addOutputTrack(MixerThread* thread);
void removeOutputTrack(MixerThread* thread);
uint32_t waitTimeMs() { return mWaitTimeMs; }
protected:
virtual uint32_t activeSleepTimeUs();
private:
bool outputsReady(SortedVector< sp<OutputTrack> > &outputTracks);
void updateWaitTime();
SortedVector < sp<OutputTrack> > mOutputTracks;
uint32_t mWaitTimeMs;
};
PlaybackThread *checkPlaybackThread_l(int output) const;
MixerThread *checkMixerThread_l(int output) const;
RecordThread *checkRecordThread_l(int input) const;
float streamVolumeInternal(int stream) const { return mStreamTypes[stream].volume; }
void audioConfigChanged_l(int event, int ioHandle, void *param2);
uint32_t nextUniqueId();
status_t moveEffectChain_l(int sessionId,
AudioFlinger::PlaybackThread *srcThread,
AudioFlinger::PlaybackThread *dstThread,
bool reRegister);
PlaybackThread *primaryPlaybackThread_l();
uint32_t primaryOutputDevice_l();
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
friend class AudioBuffer;
class TrackHandle : public android::BnAudioTrack {
public:
TrackHandle(const sp<PlaybackThread::Track>& track);
virtual ~TrackHandle();
virtual status_t start();
virtual void stop();
virtual void flush();
virtual void mute(bool);
virtual void pause();
virtual void setVolume(float left, float right);
virtual sp<IMemory> getCblk() const;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
virtual status_t attachAuxEffect(int effectId);
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
virtual status_t allocateTimedBuffer(size_t size,
sp<IMemory>* buffer);
virtual status_t queueTimedBuffer(const sp<IMemory>& buffer,
int64_t pts);
virtual status_t setMediaTimeTransform(const LinearTransform& xform,
int target);
virtual status_t onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);
private:
sp<PlaybackThread::Track> mTrack;
};
friend class Client;
friend class PlaybackThread::Track;
void removeClient_l(pid_t pid);
void removeNotificationClient(pid_t pid);
// record thread
class RecordThread : public ThreadBase, public AudioBufferProvider
{
public:
// record track
class RecordTrack : public TrackBase {
public:
RecordTrack(const wp<ThreadBase>& thread,
const sp<Client>& client,
uint32_t sampleRate,
uint32_t format,
uint32_t channelMask,
int frameCount,
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
uint32_t flags,
int sessionId);
~RecordTrack();
virtual status_t start();
virtual void stop();
bool overflow() { bool tmp = mOverflow; mOverflow = false; return tmp; }
bool setOverflow() { bool tmp = mOverflow; mOverflow = true; return tmp; }
void dump(char* buffer, size_t size);
private:
friend class AudioFlinger;
2009-07-23 13:17:39 -07:00
friend class RecordThread;
RecordTrack(const RecordTrack&);
RecordTrack& operator = (const RecordTrack&);
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
virtual status_t getNextBuffer(
AudioBufferProvider::Buffer* buffer,
int64_t pts);
bool mOverflow;
};
RecordThread(const sp<AudioFlinger>& audioFlinger,
AudioStreamIn *input,
uint32_t sampleRate,
uint32_t channels,
int id,
uint32_t device);
~RecordThread();
virtual bool threadLoop();
virtual status_t readyToRun();
virtual void onFirstRef();
virtual status_t initCheck() const { return (mInput == 0) ? NO_INIT : NO_ERROR; }
sp<AudioFlinger::RecordThread::RecordTrack> createRecordTrack_l(
const sp<AudioFlinger::Client>& client,
uint32_t sampleRate,
int format,
int channelMask,
int frameCount,
uint32_t flags,
int sessionId,
status_t *status);
status_t start(RecordTrack* recordTrack);
void stop(RecordTrack* recordTrack);
status_t dump(int fd, const Vector<String16>& args);
AudioStreamIn* getInput();
AudioStreamIn* clearInput();
virtual audio_stream_t* stream();
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
virtual status_t getNextBuffer(AudioBufferProvider::Buffer* buffer,
int64_t pts);
virtual void releaseBuffer(AudioBufferProvider::Buffer* buffer);
virtual bool checkForNewParameters_l();
virtual String8 getParameters(const String8& keys);
Fix issue 2553359: Pandora does not work well with Passion deskdock / Cardock. The problem is due to a too big difference between the buffer size used at the hardware interface and at the A2DP interface. When no resampling occurs we don't notice problems but the timing is very tight. As soon as resampling is activated, the AudioTrack underruns. This is because the AudioTrack buffers are not resized when moving the AudioTrack from hardware to A2DP output. The AudioTrack buffers are calculated based on a hardware output buffer size of 3072 bytes. Which is much less than the A2DP output buffer size (10240). The solution consists in creating new tracks with new buffers in AudioFlinger when the A2DP output is opened instead of just transfering active tracks from hardware output mixer thread to the new A2DP output mixer thread. To avoid synchronization issues between mixer threads and client processes, this is done by invalidating tracks by setting a flag in their control block and having AudioTrack release the handle on this track (IAudioTrack) and create a new IAudioTrack when this flag is detected next time obtainBuffer() or start() is executed. AudioFlinger modifications: - invalidate the tracks when setStreamOutput() is called - make sure that notifications of output opening/closing and change of stream type to output mapping are sent synchronously to client process. This is necessary so that AudioSystem has the new stream to output mapping when the AudioTrack detects the invalidate flag in the client process. Previously their were sent when the corresponding thread loop was executed. AudioTrack modifications: - move frame count calculation and verification from set() to createTrack() so that is is updated every time a new IAudioTrack is created. - detect track invalidate flag in obtainBuffer() and start() and create a new IAudioTrack. AudioTrackShared modifications - group all flags (out, flowControlFlag, forceReady...) into a single bit filed to save space. Change-Id: I9ac26b6192230627d35084e1449640caaf7d56ee
2010-05-14 03:26:45 -07:00
virtual void audioConfigChanged_l(int event, int param = 0);
void readInputParameters();
virtual unsigned int getInputFramesLost();
virtual status_t addEffectChain_l(const sp<EffectChain>& chain);
virtual size_t removeEffectChain_l(const sp<EffectChain>& chain);
virtual uint32_t hasAudioSession(int sessionId);
RecordTrack* track();
private:
RecordThread();
AudioStreamIn *mInput;
RecordTrack* mTrack;
sp<RecordTrack> mActiveTrack;
Condition mStartStopCond;
AudioResampler *mResampler;
int32_t *mRsmpOutBuffer;
int16_t *mRsmpInBuffer;
size_t mRsmpInIndex;
size_t mInputBytes;
int mReqChannelCount;
uint32_t mReqSampleRate;
ssize_t mBytesRead;
};
class RecordHandle : public android::BnAudioRecord {
public:
RecordHandle(const sp<RecordThread::RecordTrack>& recordTrack);
virtual ~RecordHandle();
virtual status_t start();
virtual void stop();
virtual sp<IMemory> getCblk() const;
virtual status_t onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);
private:
sp<RecordThread::RecordTrack> mRecordTrack;
};
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
//--- Audio Effect Management
// EffectModule and EffectChain classes both have their own mutex to protect
// state changes or resource modifications. Always respect the following order
// if multiple mutexes must be acquired to avoid cross deadlock:
// AudioFlinger -> ThreadBase -> EffectChain -> EffectModule
// The EffectModule class is a wrapper object controlling the effect engine implementation
// in the effect library. It prevents concurrent calls to process() and command() functions
// from different client threads. It keeps a list of EffectHandle objects corresponding
// to all client applications using this effect and notifies applications of effect state,
// control or parameter changes. It manages the activation state machine to send appropriate
// reset, enable, disable commands to effect engine and provide volume
// ramping when effects are activated/deactivated.
// When controlling an auxiliary effect, the EffectModule also provides an input buffer used by
// the attached track(s) to accumulate their auxiliary channel.
class EffectModule: public RefBase {
public:
EffectModule(const wp<ThreadBase>& wThread,
const wp<AudioFlinger::EffectChain>& chain,
effect_descriptor_t *desc,
int id,
int sessionId);
~EffectModule();
enum effect_state {
IDLE,
RESTART,
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
STARTING,
ACTIVE,
STOPPING,
STOPPED,
DESTROYED
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
};
int id() { return mId; }
void process();
void updateState();
status_t command(uint32_t cmdCode,
uint32_t cmdSize,
void *pCmdData,
uint32_t *replySize,
void *pReplyData);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
void reset_l();
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
status_t configure();
status_t init();
uint32_t state() {
return mState;
}
uint32_t status() {
return mStatus;
}
int sessionId() {
return mSessionId;
}
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
status_t setEnabled(bool enabled);
bool isEnabled();
bool isProcessEnabled();
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
void setInBuffer(int16_t *buffer) { mConfig.inputCfg.buffer.s16 = buffer; }
int16_t *inBuffer() { return mConfig.inputCfg.buffer.s16; }
void setOutBuffer(int16_t *buffer) { mConfig.outputCfg.buffer.s16 = buffer; }
int16_t *outBuffer() { return mConfig.outputCfg.buffer.s16; }
void setChain(const wp<EffectChain>& chain) { mChain = chain; }
void setThread(const wp<ThreadBase>& thread) { mThread = thread; }
wp<ThreadBase>& thread() { return mThread; }
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
status_t addHandle(sp<EffectHandle>& handle);
void disconnect(const wp<EffectHandle>& handle, bool unpiniflast);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
size_t removeHandle (const wp<EffectHandle>& handle);
effect_descriptor_t& desc() { return mDescriptor; }
Various fixes and improvements in audio effects implementation Effect API: - Use different definitions for audio device, channels, formats... in AudioSystem and EffectApi: Removed media/AudioCommon.h file created for initial version of EffectApi - Indicate audio session and output ID to effect library when calling EffectCreate(). Session ID can be useful to optimize the implementation of effect chains in the same audio session. Output ID can be used for effects implemented in audio hardware. - Renamed EffectQueryNext() function to EffectQueryEffect() and changed operating mode: now an index is passed for the queried effect instead of implicitly querying the next one. - Added CPU load and memory usage indication in effects descriptor - Added flags and commands to indicate changes in audio mode (ring tone, in call...) to effect engine - Added flag to indicate hardware accelerated effect implementation. - Renamed EffectFactoryApi.h to EffectsFactoryApi.h for consistency with EffectsFactory.c/h Effect libraries: - Reflected changes in Effect API - Several fixes in reverb implementation - Added build option TEST_EFFECT_LIBRARIES in makefile to prepare integration of actual effect library. - Replaced pointer by integer identifier for library handle returned by effects factory Audio effect framework: - Added support for audio session -1 in preparation of output stage effects configuration. - Reflected changes in Effect API - Removed volume ramp up/down when effect is inserted/removed: this has to be taken care of by effect engines. - Added some overflow verification on indexes used for deferred parameter updates via shared memory - Added hardcoded CPU and memory limit check when creating a new effect instance Change-Id: I43fee5182ee201384ea3479af6d0acb95092901d
2010-06-23 17:38:20 -07:00
wp<EffectChain>& chain() { return mChain; }
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
status_t setDevice(uint32_t device);
status_t setVolume(uint32_t *left, uint32_t *right, bool controller);
Various fixes and improvements in audio effects implementation Effect API: - Use different definitions for audio device, channels, formats... in AudioSystem and EffectApi: Removed media/AudioCommon.h file created for initial version of EffectApi - Indicate audio session and output ID to effect library when calling EffectCreate(). Session ID can be useful to optimize the implementation of effect chains in the same audio session. Output ID can be used for effects implemented in audio hardware. - Renamed EffectQueryNext() function to EffectQueryEffect() and changed operating mode: now an index is passed for the queried effect instead of implicitly querying the next one. - Added CPU load and memory usage indication in effects descriptor - Added flags and commands to indicate changes in audio mode (ring tone, in call...) to effect engine - Added flag to indicate hardware accelerated effect implementation. - Renamed EffectFactoryApi.h to EffectsFactoryApi.h for consistency with EffectsFactory.c/h Effect libraries: - Reflected changes in Effect API - Several fixes in reverb implementation - Added build option TEST_EFFECT_LIBRARIES in makefile to prepare integration of actual effect library. - Replaced pointer by integer identifier for library handle returned by effects factory Audio effect framework: - Added support for audio session -1 in preparation of output stage effects configuration. - Reflected changes in Effect API - Removed volume ramp up/down when effect is inserted/removed: this has to be taken care of by effect engines. - Added some overflow verification on indexes used for deferred parameter updates via shared memory - Added hardcoded CPU and memory limit check when creating a new effect instance Change-Id: I43fee5182ee201384ea3479af6d0acb95092901d
2010-06-23 17:38:20 -07:00
status_t setMode(uint32_t mode);
status_t start();
status_t stop();
void setSuspended(bool suspended);
bool suspended();
sp<EffectHandle> controlHandle();
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
bool isPinned() { return mPinned; }
void unPin() { mPinned = false; }
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
status_t dump(int fd, const Vector<String16>& args);
protected:
friend class EffectHandle;
friend class AudioFlinger;
bool mPinned;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
// Maximum time allocated to effect engines to complete the turn off sequence
static const uint32_t MAX_DISABLE_TIME_MS = 10000;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
EffectModule(const EffectModule&);
EffectModule& operator = (const EffectModule&);
status_t start_l();
status_t stop_l();
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
Mutex mLock; // mutex for process, commands and handles list protection
wp<ThreadBase> mThread; // parent thread
wp<EffectChain> mChain; // parent effect chain
int mId; // this instance unique ID
int mSessionId; // audio session ID
effect_descriptor_t mDescriptor;// effect descriptor received from effect engine
effect_config_t mConfig; // input and output audio configuration
effect_handle_t mEffectInterface; // Effect module C API
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
status_t mStatus; // initialization status
uint32_t mState; // current activation state (effect_state)
Vector< wp<EffectHandle> > mHandles; // list of client handles
uint32_t mMaxDisableWaitCnt; // maximum grace period before forcing an effect off after
// sending disable command.
uint32_t mDisableWaitCnt; // current process() calls count during disable period.
bool mSuspended; // effect is suspended: temporarily disabled by framework
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
};
// The EffectHandle class implements the IEffect interface. It provides resources
// to receive parameter updates, keeps track of effect control
// ownership and state and has a pointer to the EffectModule object it is controlling.
// There is one EffectHandle object for each application controlling (or using)
// an effect module.
// The EffectHandle is obtained by calling AudioFlinger::createEffect().
class EffectHandle: public android::BnEffect {
public:
EffectHandle(const sp<EffectModule>& effect,
const sp<AudioFlinger::Client>& client,
const sp<IEffectClient>& effectClient,
int32_t priority);
virtual ~EffectHandle();
// IEffect
virtual status_t enable();
virtual status_t disable();
virtual status_t command(uint32_t cmdCode,
uint32_t cmdSize,
void *pCmdData,
uint32_t *replySize,
void *pReplyData);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
virtual void disconnect();
virtual void disconnect(bool unpiniflast);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
virtual sp<IMemory> getCblk() const;
virtual status_t onTransact(uint32_t code, const Parcel& data,
Parcel* reply, uint32_t flags);
// Give or take control of effect module
// - hasControl: true if control is given, false if removed
// - signal: true client app should be signaled of change, false otherwise
// - enabled: state of the effect when control is passed
void setControl(bool hasControl, bool signal, bool enabled);
void commandExecuted(uint32_t cmdCode,
uint32_t cmdSize,
void *pCmdData,
uint32_t replySize,
void *pReplyData);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
void setEnabled(bool enabled);
bool enabled() { return mEnabled; }
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
// Getters
int id() { return mEffect->id(); }
int priority() { return mPriority; }
bool hasControl() { return mHasControl; }
sp<EffectModule> effect() { return mEffect; }
void dump(char* buffer, size_t size);
protected:
friend class AudioFlinger;
friend class EffectModule;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
EffectHandle(const EffectHandle&);
EffectHandle& operator =(const EffectHandle&);
sp<EffectModule> mEffect; // pointer to controlled EffectModule
sp<IEffectClient> mEffectClient; // callback interface for client notifications
sp<Client> mClient; // client for shared memory allocation
sp<IMemory> mCblkMemory; // shared memory for control block
effect_param_cblk_t* mCblk; // control block for deferred parameter setting via shared memory
uint8_t* mBuffer; // pointer to parameter area in shared memory
int mPriority; // client application priority to control the effect
bool mHasControl; // true if this handle is controlling the effect
bool mEnabled; // cached enable state: needed when the effect is
// restored after being suspended
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
};
// the EffectChain class represents a group of effects associated to one audio session.
// There can be any number of EffectChain objects per output mixer thread (PlaybackThread).
// The EffecChain with session ID 0 contains global effects applied to the output mix.
// Effects in this chain can be insert or auxiliary. Effects in other chains (attached to tracks)
// are insert only. The EffectChain maintains an ordered list of effect module, the order corresponding
// in the effect process order. When attached to a track (session ID != 0), it also provide it's own
// input buffer used by the track as accumulation buffer.
class EffectChain: public RefBase {
public:
EffectChain(const wp<ThreadBase>& wThread, int sessionId);
~EffectChain();
// special key used for an entry in mSuspendedEffects keyed vector
// corresponding to a suspend all request.
static const int kKeyForSuspendAll = 0;
// minimum duration during which we force calling effect process when last track on
// a session is stopped or removed to allow effect tail to be rendered
static const int kProcessTailDurationMs = 1000;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
void process_l();
void lock() {
mLock.lock();
}
void unlock() {
mLock.unlock();
}
status_t addEffect_l(const sp<EffectModule>& handle);
size_t removeEffect_l(const sp<EffectModule>& handle);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
int sessionId() { return mSessionId; }
void setSessionId(int sessionId) { mSessionId = sessionId; }
sp<EffectModule> getEffectFromDesc_l(effect_descriptor_t *descriptor);
sp<EffectModule> getEffectFromId_l(int id);
sp<EffectModule> getEffectFromType_l(const effect_uuid_t *type);
bool setVolume_l(uint32_t *left, uint32_t *right);
void setDevice_l(uint32_t device);
void setMode_l(uint32_t mode);
Various fixes and improvements in audio effects implementation Effect API: - Use different definitions for audio device, channels, formats... in AudioSystem and EffectApi: Removed media/AudioCommon.h file created for initial version of EffectApi - Indicate audio session and output ID to effect library when calling EffectCreate(). Session ID can be useful to optimize the implementation of effect chains in the same audio session. Output ID can be used for effects implemented in audio hardware. - Renamed EffectQueryNext() function to EffectQueryEffect() and changed operating mode: now an index is passed for the queried effect instead of implicitly querying the next one. - Added CPU load and memory usage indication in effects descriptor - Added flags and commands to indicate changes in audio mode (ring tone, in call...) to effect engine - Added flag to indicate hardware accelerated effect implementation. - Renamed EffectFactoryApi.h to EffectsFactoryApi.h for consistency with EffectsFactory.c/h Effect libraries: - Reflected changes in Effect API - Several fixes in reverb implementation - Added build option TEST_EFFECT_LIBRARIES in makefile to prepare integration of actual effect library. - Replaced pointer by integer identifier for library handle returned by effects factory Audio effect framework: - Added support for audio session -1 in preparation of output stage effects configuration. - Reflected changes in Effect API - Removed volume ramp up/down when effect is inserted/removed: this has to be taken care of by effect engines. - Added some overflow verification on indexes used for deferred parameter updates via shared memory - Added hardcoded CPU and memory limit check when creating a new effect instance Change-Id: I43fee5182ee201384ea3479af6d0acb95092901d
2010-06-23 17:38:20 -07:00
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
void setInBuffer(int16_t *buffer, bool ownsBuffer = false) {
mInBuffer = buffer;
mOwnInBuffer = ownsBuffer;
}
int16_t *inBuffer() {
return mInBuffer;
}
void setOutBuffer(int16_t *buffer) {
mOutBuffer = buffer;
}
int16_t *outBuffer() {
return mOutBuffer;
}
void incTrackCnt() { android_atomic_inc(&mTrackCnt); }
void decTrackCnt() { android_atomic_dec(&mTrackCnt); }
int32_t trackCnt() { return mTrackCnt;}
void incActiveTrackCnt() { android_atomic_inc(&mActiveTrackCnt);
mTailBufferCount = mMaxTailBuffers; }
void decActiveTrackCnt() { android_atomic_dec(&mActiveTrackCnt); }
int32_t activeTrackCnt() { return mActiveTrackCnt;}
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
uint32_t strategy() { return mStrategy; }
void setStrategy(uint32_t strategy)
{ mStrategy = strategy; }
// suspend effect of the given type
void setEffectSuspended_l(const effect_uuid_t *type,
bool suspend);
// suspend all eligible effects
void setEffectSuspendedAll_l(bool suspend);
// check if effects should be suspend or restored when a given effect is enable or disabled
void checkSuspendOnEffectEnabled(const sp<EffectModule>& effect,
bool enabled);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
status_t dump(int fd, const Vector<String16>& args);
protected:
friend class AudioFlinger;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
EffectChain(const EffectChain&);
EffectChain& operator =(const EffectChain&);
class SuspendedEffectDesc : public RefBase {
public:
SuspendedEffectDesc() : mRefCount(0) {}
int mRefCount;
effect_uuid_t mType;
wp<EffectModule> mEffect;
};
// get a list of effect modules to suspend when an effect of the type
// passed is enabled.
Vector< sp<EffectModule> > getSuspendEligibleEffects();
// get an effect module if it is currently enable
sp<EffectModule> getEffectIfEnabled(const effect_uuid_t *type);
// true if the effect whose descriptor is passed can be suspended
// OEMs can modify the rules implemented in this method to exclude specific effect
// types or implementations from the suspend/restore mechanism.
bool isEffectEligibleForSuspend(const effect_descriptor_t& desc);
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
wp<ThreadBase> mThread; // parent mixer thread
Mutex mLock; // mutex protecting effect list
Vector<sp<EffectModule> > mEffects; // list of effect modules
int mSessionId; // audio session ID
int16_t *mInBuffer; // chain input buffer
int16_t *mOutBuffer; // chain output buffer
volatile int32_t mActiveTrackCnt; // number of active tracks connected
volatile int32_t mTrackCnt; // number of tracks connected
int32_t mTailBufferCount; // current effect tail buffer count
int32_t mMaxTailBuffers; // maximum effect tail buffers
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
bool mOwnInBuffer; // true if the chain owns its input buffer
int mVolumeCtrlIdx; // index of insert effect having control over volume
uint32_t mLeftVolume; // previous volume on left channel
uint32_t mRightVolume; // previous volume on right channel
uint32_t mNewLeftVolume; // new volume on left channel
uint32_t mNewRightVolume; // new volume on right channel
uint32_t mStrategy; // strategy for this effect chain
// mSuspendedEffects lists all effect currently suspended in the chain
// use effect type UUID timelow field as key. There is no real risk of identical
// timeLow fields among effect type UUIDs.
KeyedVector< int, sp<SuspendedEffectDesc> > mSuspendedEffects;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
};
struct AudioStreamOut {
audio_hw_device_t *hwDev;
audio_stream_out_t *stream;
AudioStreamOut(audio_hw_device_t *dev, audio_stream_out_t *out) :
hwDev(dev), stream(out) {}
};
struct AudioStreamIn {
audio_hw_device_t *hwDev;
audio_stream_in_t *stream;
AudioStreamIn(audio_hw_device_t *dev, audio_stream_in_t *in) :
hwDev(dev), stream(in) {}
};
struct AudioSessionRef {
int sessionid;
pid_t pid;
int cnt;
};
friend class RecordThread;
friend class PlaybackThread;
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
enum master_volume_support {
MVS_NONE,
MVS_SETONLY,
MVS_FULL,
};
mutable Mutex mLock;
DefaultKeyedVector< pid_t, wp<Client> > mClients;
mutable Mutex mHardwareLock;
audio_hw_device_t* mPrimaryHardwareDev;
Vector<audio_hw_device_t*> mAudioHwDevs;
mutable int mHardwareStatus;
DefaultKeyedVector< int, sp<PlaybackThread> > mPlaybackThreads;
PlaybackThread::stream_type_t mStreamTypes[AUDIO_STREAM_CNT];
float mMasterVolume;
Media framework changes for Tungsten. Squashed merge from master-tungsten of the following changes: commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 13:57:44 2011 -0700 Remove TungstenMisc and rename LinearTransform Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b commit 3114aabe76ad733b59929d87e49c68229f5ae2e8 Author: John Grossman <johngro@google.com> Date: Fri Jun 3 10:47:16 2011 -0700 Name changes and spelling fixes. + Replace the term TungstenTime with the Eugene-approved term CommonTime. + Fix a spelling error in a comment I noticed. Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd commit cbf2903ab6893b6e662514e2f6d670e268a419df Author: John Grossman <johngro@google.com> Date: Fri Apr 15 09:27:54 2011 -0700 Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch. Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502 commit bc7c46aa629f9883e959ef23de8da297f9eb508b Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 13:59:17 2011 -0700 Create a separate class for timed AudioTracks commit 43be3231034ff8537fdd84422a7954780038671f Author: John Grossman <johngro@google.com> Date: Mon Jun 27 18:59:12 2011 -0700 Move libaah_rtp over from the vendor directory. Also move factor PipeEvent out into utils. Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37 commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6 Author: John Grossman <johngro@google.com> Date: Mon Jun 27 17:06:49 2011 -0700 Name changes for the TRTP Players s/tungsten/aah/g Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51 commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c Author: Jason Simmons <jsimmons@google.com> Date: Mon Jun 20 17:56:09 2011 -0700 More timed AudioFlinger changes requested by code review: * change trimTimedBufferQueue to trimTimedBufferQueue_l * create one timed audio buffer heap per client process instead of one per track * grow the silence buffer on demand * some error handling fixes in timed getNextBuffer * calculate the next output PTS in all mixer and track hooks Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad commit a148e2674b1d3cb73289b82b85c333f0a66824a9 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 17:02:24 2011 -0700 Move the A@H time service into frameworks/base Change-Id: I5c570cde70e8931e205516cb33517585804ce841 commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1 Author: John Grossman <johngro@google.com> Date: Mon Jun 20 11:55:36 2011 -0700 Fix the build after Mike's code moving. Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266 commit 04489474ec8e73efe1bf52918831f41659033162 Author: John Grossman <johngro@google.com> Date: Fri Jun 17 14:19:50 2011 -0700 Refactor the local/common clock services. This change is one of a set of 5 changes made to different repositories. Look for this comment in all of them. Refactor the local/common clock services in tungsten to match android best practice. Notable changes include + The kernel no longer knows anything about common time. Common time has been moved completely up into user land. This has an impact on the accuracy of the timesync debugging code, and the netfilter assisted approach to network based timesync is going to have to be modified. + The timesync driver used by A@H is now just local time driver. + The kernel no longer needs access to the linear transform math code, and it has been removed. + A new HAL has been introduced to expose the concept of local time to the system. + A non-slewable stub implementation of the local time HAL based on CLOCK_MONOTONIC has been added. + The TungstenTime library has been eliminated. Its functionality has been distributed among the common time binder service, the local time hal and the linear transform utility code. + All clients of the old TungstenTime library have been changed to be clients of the binder service, the hal and the utility code. + The reset_tt utilities have been removed, they no longer have a purpose in the system. + more progress has been made in eliminating the word "tungsten" from the code. Things left to do include + Finish getting rid of tungsten from the time service. + Move the time service into the framework; AudioFlinger's new timed mode depends on it and the service cannot continue to live in vendor tungsten. Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101 commit d48194545eed1116a84d81e2fb53315d2b0701a7 Author: Jason Simmons <jsimmons@google.com> Date: Thu Jun 16 14:22:46 2011 -0700 Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4 commit 02561419db82b01ffb28df38000716c612988427 Author: John Grossman <johngro@google.com> Date: Tue May 10 14:00:21 2011 -0700 Put in a hack for controling master volume in the policy manager. Fix initial master volume reporting. Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7 commit 549cdc3ba115dc654cdade261fb055c72c6cdb79 Author: John Grossman <johngro@google.com> Date: Wed May 4 11:46:17 2011 -0700 Make certain the logic for computing the output stream mixing point is hardened against underflow and overflow when input and output sample rates don't match. Change-Id: I5ebea07c9938107b435bec7413418622767e4e16 commit 8043d8ed63f51e76d452d22be7d453d4a7794530 Author: Jason Simmons <jsimmons@google.com> Date: Wed Apr 27 18:06:27 2011 -0700 Add the patch for timed audio support to the mono resampler Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711 commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 10:38:57 2011 -0700 Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger. Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26 commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393 Author: John Grossman <johngro@google.com> Date: Wed Apr 27 09:07:14 2011 -0700 Fix an issue with inconsistent volume reporting. Changed masterVolume() to return the same value as the last call to setMasterVolume when the HW layer is implementing master volume control. The masterVolume/setMasterVolume API seems to be an idea which was abandonded a long time ago; as of today the system only ever sets it to 1.0 at startup and then never changes it. Until we can figure out how the concept of external amplifier gain control fits into the Android audio framework, Tungsten is exposing this API via a hack-tastic invoke back door in the TungstenRXPlayer and needs the getter/setter results to be consistent. Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544 commit 086511b2d19cceb976747ac23e12b73fc7c28bea Author: Jason Simmons <jsimmons@google.com> Date: Mon Apr 25 16:07:19 2011 -0700 Add handling of timed audio tracks in the generic resampling mixer Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792 Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b Signed-off-by: Mike J. Chen <mjchen@google.com> Signed-off-by: John Grossman <johngro@google.com> Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-08-15 13:28:26 -07:00
float mMasterVolumeSW;
master_volume_support mMasterVolumeSupportLvl;
bool mMasterMute;
DefaultKeyedVector< int, sp<RecordThread> > mRecordThreads;
DefaultKeyedVector< pid_t, sp<NotificationClient> > mNotificationClients;
Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
2010-06-01 23:49:17 -07:00
volatile int32_t mNextUniqueId;
uint32_t mMode;
bool mBtNrecIsOff;
Various fixes and improvements in audio effects implementation Effect API: - Use different definitions for audio device, channels, formats... in AudioSystem and EffectApi: Removed media/AudioCommon.h file created for initial version of EffectApi - Indicate audio session and output ID to effect library when calling EffectCreate(). Session ID can be useful to optimize the implementation of effect chains in the same audio session. Output ID can be used for effects implemented in audio hardware. - Renamed EffectQueryNext() function to EffectQueryEffect() and changed operating mode: now an index is passed for the queried effect instead of implicitly querying the next one. - Added CPU load and memory usage indication in effects descriptor - Added flags and commands to indicate changes in audio mode (ring tone, in call...) to effect engine - Added flag to indicate hardware accelerated effect implementation. - Renamed EffectFactoryApi.h to EffectsFactoryApi.h for consistency with EffectsFactory.c/h Effect libraries: - Reflected changes in Effect API - Several fixes in reverb implementation - Added build option TEST_EFFECT_LIBRARIES in makefile to prepare integration of actual effect library. - Replaced pointer by integer identifier for library handle returned by effects factory Audio effect framework: - Added support for audio session -1 in preparation of output stage effects configuration. - Reflected changes in Effect API - Removed volume ramp up/down when effect is inserted/removed: this has to be taken care of by effect engines. - Added some overflow verification on indexes used for deferred parameter updates via shared memory - Added hardcoded CPU and memory limit check when creating a new effect instance Change-Id: I43fee5182ee201384ea3479af6d0acb95092901d
2010-06-23 17:38:20 -07:00
Vector<AudioSessionRef*> mAudioSessionRefs;
};
// ----------------------------------------------------------------------------
}; // namespace android
#endif // ANDROID_AUDIO_FLINGER_H