summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.h
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-08-25 16:36:37 -0700
committerAndy Hung <hunga@google.com>2014-11-07 11:35:47 -0800
commit7f47549516ae5938759b5c834c8423378a60b3d8 (patch)
tree85c60a5278b4ae431a574b229a090e053866d7fb /services/audioflinger/AudioMixer.h
parent0f451e92f09e089e588f303f729425a54fcd804b (diff)
downloadframeworks_av-7f47549516ae5938759b5c834c8423378a60b3d8.zip
frameworks_av-7f47549516ae5938759b5c834c8423378a60b3d8.tar.gz
frameworks_av-7f47549516ae5938759b5c834c8423378a60b3d8.tar.bz2
Fix AudioMixer floating interaction with downmixer
Previously _if_ the full floating point mixer is enabled, a downmixer would force the mixer input for a session submix to integer, breaking other mixer inputs to the same submix that were in float. Use another ReformatBufferProvider after the downmixer to solve this issue. Update the test-mixer app and the mixer_to_wave_tests shell script to detect this issue. Bug: 17363939 Change-Id: I74a56333f9ee75ddde39a75392c021c5eebddbef
Diffstat (limited to 'services/audioflinger/AudioMixer.h')
-rw-r--r--services/audioflinger/AudioMixer.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index 6ed6c1b..88e94c5 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -205,17 +205,34 @@ private:
int32_t* auxBuffer;
// 16-byte boundary
+
+ /* Buffer providers are constructed to translate the track input data as needed.
+ *
+ * 1) mInputBufferProvider: The AudioTrack buffer provider.
+ * 2) mReformatBufferProvider: If not NULL, performs the audio reformat to
+ * match either mMixerInFormat or mDownmixRequiresFormat, if the downmixer
+ * requires reformat. For example, it may convert floating point input to
+ * PCM_16_bit if that's required by the downmixer.
+ * 3) downmixerBufferProvider: If not NULL, performs the channel remixing to match
+ * the number of channels required by the mixer sink.
+ * 4) mPostDownmixReformatBufferProvider: If not NULL, performs reformatting from
+ * the downmixer requirements to the mixer engine input requirements.
+ */
AudioBufferProvider* mInputBufferProvider; // externally provided buffer provider.
CopyBufferProvider* mReformatBufferProvider; // provider wrapper for reformatting.
CopyBufferProvider* downmixerBufferProvider; // wrapper for channel conversion.
+ CopyBufferProvider* mPostDownmixReformatBufferProvider;
+ // 16-byte boundary
int32_t sessionId;
- // 16-byte boundary
audio_format_t mMixerFormat; // output mix format: AUDIO_FORMAT_PCM_(FLOAT|16_BIT)
audio_format_t mFormat; // input track format
audio_format_t mMixerInFormat; // mix internal format AUDIO_FORMAT_PCM_(FLOAT|16_BIT)
// each track must be converted to this format.
+ audio_format_t mDownmixRequiresFormat; // required downmixer format
+ // AUDIO_FORMAT_PCM_16_BIT if 16 bit necessary
+ // AUDIO_FORMAT_INVALID if no required format
float mVolume[MAX_NUM_VOLUMES]; // floating point set volume
float mPrevVolume[MAX_NUM_VOLUMES]; // floating point previous volume
@@ -225,7 +242,6 @@ private:
float mPrevAuxLevel; // floating point prev aux level
float mAuxInc; // floating point aux increment
- // 16-byte boundary
audio_channel_mask_t mMixerChannelMask;
uint32_t mMixerChannelCount;