diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2014-09-22 16:51:34 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2014-10-31 14:12:20 -0700 |
commit | d9cfeb447356cb6334379eaf5da1e49424eb5979 (patch) | |
tree | 5bae7d5985563f2cbbf9cc9cc1a5fca422cb8390 /media/libmedia/AudioTrack.cpp | |
parent | 20f51b1ea04c410a25f214e37bcdb586e2a028cc (diff) | |
download | frameworks_av-d9cfeb447356cb6334379eaf5da1e49424eb5979.zip frameworks_av-d9cfeb447356cb6334379eaf5da1e49424eb5979.tar.gz frameworks_av-d9cfeb447356cb6334379eaf5da1e49424eb5979.tar.bz2 |
Support speaker routing for FLAG_BEACON
Add support for routing audio stream to the speaker when audio
attributes carry the FLAG_BEACON value:
- associate streams with FLAG_BEACON to the up-to-now unused
STREAM_TTS ("Transmitted Through Speaker").
The remapping happens in AudioTrack.
- AudioPolicyManager: define new strategy for handling the Beacon
behavior, that only goes to speaker. Define new volume curves
for STREAM_TTS that are not silence only for the speaker device
category. Keep ref count of other streams and never play Beacon
streams when anything else is playing: either don't start playback
if something else is playing, or unmute STREAM_TTS when it's
allowed to play and mute when it's done.
- Take into account muting latency when starting an output.
Bug 15415971
Change-Id: I26539c7ec1a486accd85bbeb1623e9c7d3a1192f
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 0a89fbb..97c8d84 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -278,7 +278,9 @@ status_t AudioTrack::set( } // handle default values first. - if (streamType == AUDIO_STREAM_DEFAULT) { + // TODO once AudioPolicyManager fully supports audio_attributes_t, + // remove stream "text-to-speech" redirect + if ((streamType == AUDIO_STREAM_DEFAULT) || (streamType == AUDIO_STREAM_TTS)) { streamType = AUDIO_STREAM_MUSIC; } @@ -2124,6 +2126,12 @@ void AudioTrack::setStreamTypeFromAttributes(audio_attributes_t& aa) { mStreamType = AUDIO_STREAM_BLUETOOTH_SCO; return; } + // TODO once AudioPolicyManager fully supports audio_attributes_t, + // remove stream remap, the flag will be enough + if ((aa.flags & AUDIO_FLAG_BEACON) == AUDIO_FLAG_BEACON) { + mStreamType = AUDIO_STREAM_TTS; + return; + } // usage to stream type mapping switch (aa.usage) { @@ -2174,7 +2182,7 @@ void AudioTrack::setStreamTypeFromAttributes(audio_attributes_t& aa) { bool AudioTrack::isValidAttributes(const audio_attributes_t *paa) { // has flags that map to a strategy? - if ((paa->flags & (AUDIO_FLAG_AUDIBILITY_ENFORCED | AUDIO_FLAG_SCO)) != 0) { + if ((paa->flags & (AUDIO_FLAG_AUDIBILITY_ENFORCED | AUDIO_FLAG_SCO | AUDIO_FLAG_BEACON)) != 0) { return true; } |