Fix issue 3371080.

Move isStreamActive() method from AudioFlinger to AudioPolicyManager.
iStreamActive() now specifies a time window during which the stream is considered
active after it actually stopped.

Change-Id: Ib0d7d8f061b9f809d307ecfac40960ef582e5f0f
This commit is contained in:
Eric Laurent 2011-02-02 12:10:13 -08:00
parent c3045e4626
commit 36291a74cd
2 changed files with 7 additions and 3 deletions

View file

@ -141,6 +141,8 @@ public:
int id) = 0;
virtual status_t unregisterEffect(int id) = 0;
virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const = 0;
//dump state
virtual status_t dump(int fd) = 0;
};

View file

@ -32,9 +32,9 @@ namespace android {
#define SONIFICATION_HEADSET_VOLUME_FACTOR 0.5
// Min volume for STRATEGY_SONIFICATION streams when limited by music volume: -36dB
#define SONIFICATION_HEADSET_VOLUME_MIN 0.016
// Time in seconds during which we consider that music is still active after a music
// Time in milliseconds during which we consider that music is still active after a music
// track was stopped - see computeVolume()
#define SONIFICATION_HEADSET_MUSIC_DELAY 5
#define SONIFICATION_HEADSET_MUSIC_DELAY 5000
// Time in milliseconds during witch some streams are muted while the audio path
// is switched
#define MUTE_TIME_MS 2000
@ -112,6 +112,8 @@ public:
int id);
virtual status_t unregisterEffect(int id);
virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const;
virtual status_t dump(int fd);
protected:
@ -148,6 +150,7 @@ protected:
AudioSystem::output_flags mFlags; //
uint32_t mDevice; // current device this output is routed to
uint32_t mRefCount[AudioSystem::NUM_STREAM_TYPES]; // number of streams of each type using this output
nsecs_t mStopTime[AudioSystem::NUM_STREAM_TYPES];
AudioOutputDescriptor *mOutput1; // used by duplicated outputs: first output
AudioOutputDescriptor *mOutput2; // used by duplicated outputs: second output
float mCurVolume[AudioSystem::NUM_STREAM_TYPES]; // current stream volume
@ -304,7 +307,6 @@ protected:
StreamDescriptor mStreams[AudioSystem::NUM_STREAM_TYPES]; // stream descriptors for volume control
String8 mA2dpDeviceAddress; // A2DP device MAC address
String8 mScoDeviceAddress; // SCO device MAC address
nsecs_t mMusicStopTime; // time when last music stream was stopped
bool mLimitRingtoneVolume; // limit ringtone volume to music volume if headset connected
uint32_t mDeviceForStrategy[NUM_STRATEGIES];
float mLastVoiceVolume; // last voice volume value sent to audio HAL