Use audio_policy_output_flags_t consistently
This affects:
- IAudioFlinger::openOutput
- AudioTrack::AudioTrack
- AudioTrack::set
- apps that call these
Change-Id: I26fb281bac6cb87593d17697bc9cb37a835af205
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 26c9435..57f5d3d 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -279,7 +279,7 @@
format,// word length, PCM
nativeChannelMask,
frameCount,
- 0,// flags
+ AUDIO_POLICY_OUTPUT_FLAG_NONE,
audioCallback, &(lpJniStorage->mCallbackData),//callback, callback data (user)
0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
0,// shared mem
@@ -300,7 +300,7 @@
format,// word length, PCM
nativeChannelMask,
frameCount,
- 0,// flags
+ AUDIO_POLICY_OUTPUT_FLAG_NONE,
audioCallback, &(lpJniStorage->mCallbackData),//callback, callback data (user));
0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
lpJniStorage->mMemBase,// shared mem
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 95b9d86..552e829 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -153,7 +153,7 @@
audio_format_t format = AUDIO_FORMAT_DEFAULT,
int channelMask = 0,
int frameCount = 0,
- uint32_t flags = 0,
+ audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_NONE,
callback_t cbf = NULL,
void* user = NULL,
int notificationFrames = 0,
@@ -165,7 +165,7 @@
int format = AUDIO_FORMAT_DEFAULT,
int channelMask = 0,
int frameCount = 0,
- uint32_t flags = 0,
+ uint32_t flags = (uint32_t) AUDIO_POLICY_OUTPUT_FLAG_NONE,
callback_t cbf = 0,
void* user = 0,
int notificationFrames = 0,
@@ -185,7 +185,7 @@
audio_format_t format = AUDIO_FORMAT_DEFAULT,
int channelMask = 0,
const sp<IMemory>& sharedBuffer = 0,
- uint32_t flags = 0,
+ audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_NONE,
callback_t cbf = NULL,
void* user = NULL,
int notificationFrames = 0,
@@ -209,7 +209,7 @@
audio_format_t format = AUDIO_FORMAT_DEFAULT,
int channelMask = 0,
int frameCount = 0,
- uint32_t flags = 0,
+ audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_NONE,
callback_t cbf = NULL,
void* user = NULL,
int notificationFrames = 0,
@@ -473,7 +473,7 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
+ audio_policy_output_flags_t flags,
const sp<IMemory>& sharedBuffer,
audio_io_handle_t output,
bool enforceFrameCount);
@@ -515,7 +515,7 @@
uint32_t mNewPosition;
uint32_t mUpdatePeriod;
bool mFlushed; // FIXME will be made obsolete by making flush() synchronous
- uint32_t mFlags;
+ audio_policy_output_flags_t mFlags;
int mSessionId;
int mAuxEffectId;
mutable Mutex mLock;
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 7a2ada0..c723b6d 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -28,6 +28,7 @@
#include <media/IAudioRecord.h>
#include <media/IAudioFlingerClient.h>
#include <system/audio.h>
+#include <system/audio_policy.h>
#include <hardware/audio_effect.h>
#include <media/IEffect.h>
#include <media/IEffectClient.h>
@@ -121,7 +122,7 @@
audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t *pLatencyMs,
- uint32_t flags) = 0;
+ audio_policy_output_flags_t flags) = 0;
virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1,
audio_io_handle_t output2) = 0;
virtual status_t closeOutput(audio_io_handle_t output) = 0;
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index ceb87db..5aed8a1 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -608,10 +608,11 @@
// do not create a new audio track if current track is compatible with sample parameters
#ifdef USE_SHARED_MEM_BUFFER
newTrack = new AudioTrack(streamType, sampleRate, sample->format(),
- channels, sample->getIMemory(), 0, callback, userData);
+ channels, sample->getIMemory(), AUDIO_POLICY_OUTPUT_FLAG_NONE, callback, userData);
#else
newTrack = new AudioTrack(streamType, sampleRate, sample->format(),
- channels, frameCount, 0, callback, userData, bufferFrames);
+ channels, frameCount, AUDIO_POLICY_OUTPUT_FLAG_NONE, callback, userData,
+ bufferFrames);
#endif
oldTrack = mAudioTrack;
status = newTrack->initCheck();
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index a1c99e5..34563ca 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -92,7 +92,7 @@
audio_format_t format,
int channelMask,
int frameCount,
- uint32_t flags,
+ audio_policy_output_flags_t flags,
callback_t cbf,
void* user,
int notificationFrames,
@@ -119,10 +119,11 @@
int notificationFrames,
int sessionId)
: mStatus(NO_INIT),
+ mIsTimed(false),
mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(ANDROID_TGROUP_DEFAULT)
{
mStatus = set((audio_stream_type_t)streamType, sampleRate, (audio_format_t)format, channelMask,
- frameCount, flags, cbf, user, notificationFrames,
+ frameCount, (audio_policy_output_flags_t)flags, cbf, user, notificationFrames,
0, false, sessionId);
}
@@ -132,7 +133,7 @@
audio_format_t format,
int channelMask,
const sp<IMemory>& sharedBuffer,
- uint32_t flags,
+ audio_policy_output_flags_t flags,
callback_t cbf,
void* user,
int notificationFrames,
@@ -172,7 +173,7 @@
audio_format_t format,
int channelMask,
int frameCount,
- uint32_t flags,
+ audio_policy_output_flags_t flags,
callback_t cbf,
void* user,
int notificationFrames,
@@ -221,7 +222,7 @@
// force direct flag if format is not linear PCM
if (!audio_is_linear_pcm(format)) {
- flags |= AUDIO_POLICY_OUTPUT_FLAG_DIRECT;
+ flags = (audio_policy_output_flags_t) (flags | AUDIO_POLICY_OUTPUT_FLAG_DIRECT);
}
if (!audio_is_output_channel(channelMask)) {
@@ -233,7 +234,7 @@
audio_io_handle_t output = AudioSystem::getOutput(
streamType,
sampleRate, format, channelMask,
- (audio_policy_output_flags_t)flags);
+ flags);
if (output == 0) {
ALOGE("Could not get audio output for stream type %d", streamType);
@@ -707,7 +708,7 @@
audio_io_handle_t AudioTrack::getOutput_l()
{
return AudioSystem::getOutput(mStreamType,
- mCblk->sampleRate, mFormat, mChannelMask, (audio_policy_output_flags_t)mFlags);
+ mCblk->sampleRate, mFormat, mChannelMask, mFlags);
}
int AudioTrack::getSessionId() const
@@ -734,7 +735,7 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
+ audio_policy_output_flags_t flags,
const sp<IMemory>& sharedBuffer,
audio_io_handle_t output,
bool enforceFrameCount)
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index ebadbfa..47c261da 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -362,7 +362,7 @@
audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t *pLatencyMs,
- uint32_t flags)
+ audio_policy_output_flags_t flags)
{
Parcel data, reply;
uint32_t devices = pDevices ? *pDevices : 0;
@@ -377,7 +377,7 @@
data.writeInt32(format);
data.writeInt32(channels);
data.writeInt32(latency);
- data.writeInt32(flags);
+ data.writeInt32((int32_t) flags);
remote()->transact(OPEN_OUTPUT, data, &reply);
audio_io_handle_t output = (audio_io_handle_t) reply.readInt32();
ALOGV("openOutput() returned output, %d", output);
@@ -845,7 +845,7 @@
audio_format_t format = (audio_format_t) data.readInt32();
uint32_t channels = data.readInt32();
uint32_t latency = data.readInt32();
- uint32_t flags = data.readInt32();
+ audio_policy_output_flags_t flags = (audio_policy_output_flags_t) data.readInt32();
audio_io_handle_t output = openOutput(&devices,
&samplingRate,
&format,
diff --git a/media/libmedia/JetPlayer.cpp b/media/libmedia/JetPlayer.cpp
index 6cb5b82..a85956c 100644
--- a/media/libmedia/JetPlayer.cpp
+++ b/media/libmedia/JetPlayer.cpp
@@ -94,7 +94,7 @@
AUDIO_FORMAT_PCM_16_BIT,
(pLibConfig->numChannels == 2) ? AUDIO_CHANNEL_OUT_STEREO : AUDIO_CHANNEL_OUT_MONO,
mTrackBufferSize,
- 0);
+ AUDIO_POLICY_OUTPUT_FLAG_NONE);
// create render and playback thread
{
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 54eb98a..9c3170c 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -1024,7 +1024,7 @@
AUDIO_FORMAT_PCM_16_BIT,
AUDIO_CHANNEL_OUT_MONO,
0,
- 0,
+ AUDIO_POLICY_OUTPUT_FLAG_NONE,
audioCallback,
this,
0,
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 1a85c9c..bbc53f3 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -1503,7 +1503,7 @@
format,
channelMask,
frameCount,
- 0 /* flags */,
+ AUDIO_POLICY_OUTPUT_FLAG_NONE,
CallbackWrapper,
this,
0,
@@ -1515,7 +1515,7 @@
format,
channelMask,
frameCount,
- 0,
+ AUDIO_POLICY_OUTPUT_FLAG_NONE,
NULL,
NULL,
0,
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 2b3cb1a..23c3c74 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -151,7 +151,7 @@
mAudioTrack = new AudioTrack(
AUDIO_STREAM_MUSIC, mSampleRate, AUDIO_FORMAT_PCM_16_BIT, audioMask,
- 0, 0, &AudioCallback, this, 0);
+ 0, AUDIO_POLICY_OUTPUT_FLAG_NONE, &AudioCallback, this, 0);
if ((err = mAudioTrack->initCheck()) != OK) {
delete mAudioTrack;
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 37f15e2..f94ab84 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -5356,7 +5356,7 @@
audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t *pLatencyMs,
- uint32_t flags)
+ audio_policy_output_flags_t flags)
{
status_t status;
PlaybackThread *thread = NULL;
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index d9f2972..38fff8c 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -143,7 +143,7 @@
audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t *pLatencyMs,
- uint32_t flags);
+ audio_policy_output_flags_t flags);
virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1,
audio_io_handle_t output2);