summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2014-07-20 17:58:33 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2014-07-20 17:58:33 -0700
commitdf813a3ba59109ca519ce0cb00a1a9144074f40e (patch)
treee56950313351561dce84d6001ce25ad50cb49dac /media/libmedia
parent8bce84142802ecdc1794d59488ede629801a5cba (diff)
downloadframeworks_av-df813a3ba59109ca519ce0cb00a1a9144074f40e.zip
frameworks_av-df813a3ba59109ca519ce0cb00a1a9144074f40e.tar.gz
frameworks_av-df813a3ba59109ca519ce0cb00a1a9144074f40e.tar.bz2
audio_attributes_t for SoundPool
Add support for the audio_attributes_t structure in the SoundPoool constructor. Remove SRC quality which was never implemented. Remove stream types. Add file to contain audio helper functions related to policy. Change-Id: I1720ff15e7b23ea7b713a4395fdfac26dc3fd4da
Diffstat (limited to 'media/libmedia')
-rw-r--r--media/libmedia/SoundPool.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/media/libmedia/SoundPool.cpp b/media/libmedia/SoundPool.cpp
index 2aa0592..d2e381b 100644
--- a/media/libmedia/SoundPool.cpp
+++ b/media/libmedia/SoundPool.cpp
@@ -28,6 +28,7 @@
#include <media/mediaplayer.h>
#include <media/SoundPool.h>
#include "SoundPoolThread.h"
+#include <media/AudioPolicyHelper.h>
namespace android
{
@@ -39,10 +40,10 @@ uint32_t kDefaultFrameCount = 1200;
size_t kDefaultHeapSize = 1024 * 1024; // 1MB
-SoundPool::SoundPool(int maxChannels, audio_stream_type_t streamType, int srcQuality)
+SoundPool::SoundPool(int maxChannels, const audio_attributes_t* pAttributes)
{
- ALOGV("SoundPool constructor: maxChannels=%d, streamType=%d, srcQuality=%d",
- maxChannels, streamType, srcQuality);
+ ALOGV("SoundPool constructor: maxChannels=%d, attr.usage=%d, attr.flags=0x%x, attr.tags=%s",
+ maxChannels, pAttributes->usage, pAttributes->flags, pAttributes->tags);
// check limits
mMaxChannels = maxChannels;
@@ -56,8 +57,7 @@ SoundPool::SoundPool(int maxChannels, audio_stream_type_t streamType, int srcQua
mQuit = false;
mDecodeThread = 0;
- mStreamType = streamType;
- mSrcQuality = srcQuality;
+ memcpy(&mAttributes, pAttributes, sizeof(audio_attributes_t));
mAllocated = 0;
mNextSampleID = 0;
mNextChannelID = 0;
@@ -580,7 +580,7 @@ void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftV
// initialize track
size_t afFrameCount;
uint32_t afSampleRate;
- audio_stream_type_t streamType = mSoundPool->streamType();
+ audio_stream_type_t streamType = audio_attributes_to_stream_type(mSoundPool->attributes());
if (AudioSystem::getOutputFrameCount(&afFrameCount, streamType) != NO_ERROR) {
afFrameCount = kDefaultFrameCount;
}