audioflinger: do not spatialize mono or stereo tracks
Never spatialize a mono or stereo track attached to a spatializer
thread. Mono or stereo tracks are never attached to a spatializer thread
unless there is no other choice to reach the selected audio sink device.
In this case it makes more sense to not spatialize the mono or stereo content.
Test: make
Change-Id: Iaf7fd279900bd1873ad8ea4b27e13802e640aaa7
diff --git a/services/audioflinger/TrackBase.h b/services/audioflinger/TrackBase.h
index b582b3a..98a1bd9 100644
--- a/services/audioflinger/TrackBase.h
+++ b/services/audioflinger/TrackBase.h
@@ -108,7 +108,8 @@
audio_attributes_t attributes() const { return mAttr; }
bool canBeSpatialized() const { return mIsOut && (mAttr.flags
- & (AUDIO_FLAG_CONTENT_SPATIALIZED | AUDIO_FLAG_NEVER_SPATIALIZE)) == 0; }
+ & (AUDIO_FLAG_CONTENT_SPATIALIZED | AUDIO_FLAG_NEVER_SPATIALIZE)) == 0
+ && mChannelCount > 2; }
#ifdef TEE_SINK
void dumpTee(int fd, const std::string &reason) const {