IAudioFlingerClient::ioConfigChanged param2 const
The 3rd parameter (param2) to AudioFlingerClient::ioConfigChanged
is used as an input. So changed it from void * to const void *.
It is then cast to const OutputDescriptor *
or const audio_stream_type_t * depending on the event.
Change-Id: Ieec0d284f139b74b3389b5ef69c7935a8e5650ee
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h
index 89bc95d..d54ab35 100644
--- a/include/media/AudioSystem.h
+++ b/include/media/AudioSystem.h
@@ -218,8 +218,8 @@
// IAudioFlingerClient
// indicate a change in the configuration of an output or input: keeps the cached
- // values for output/input parameters upto date in client process
- virtual void ioConfigChanged(int event, audio_io_handle_t ioHandle, void *param2);
+ // values for output/input parameters up-to-date in client process
+ virtual void ioConfigChanged(int event, audio_io_handle_t ioHandle, const void *param2);
};
class AudioPolicyServiceClient: public IBinder::DeathRecipient
diff --git a/include/media/IAudioFlingerClient.h b/include/media/IAudioFlingerClient.h
index f3b4df1..75a9971 100644
--- a/include/media/IAudioFlingerClient.h
+++ b/include/media/IAudioFlingerClient.h
@@ -33,7 +33,7 @@
DECLARE_META_INTERFACE(AudioFlingerClient);
// Notifies a change of audio input/output configuration.
- virtual void ioConfigChanged(int event, audio_io_handle_t ioHandle, void *param2) = 0;
+ virtual void ioConfigChanged(int event, audio_io_handle_t ioHandle, const void *param2) = 0;
};
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index ec4c044..e0b186a 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -405,9 +405,9 @@
}
void AudioSystem::AudioFlingerClient::ioConfigChanged(int event, audio_io_handle_t ioHandle,
- void *param2) {
+ const void *param2) {
ALOGV("ioConfigChanged() event %d", event);
- OutputDescriptor *desc;
+ const OutputDescriptor *desc;
audio_stream_type_t stream;
if (ioHandle == 0) return;
@@ -417,7 +417,7 @@
switch (event) {
case STREAM_CONFIG_CHANGED:
if (param2 == NULL) break;
- stream = *(audio_stream_type_t *)param2;
+ stream = *(const audio_stream_type_t *)param2;
ALOGV("ioConfigChanged() STREAM_CONFIG_CHANGED stream %d, output %d", stream, ioHandle);
if (gStreamOutputMap.indexOfKey(stream) >= 0) {
gStreamOutputMap.replaceValueFor(stream, ioHandle);
@@ -429,7 +429,7 @@
break;
}
if (param2 == NULL) break;
- desc = (OutputDescriptor *)param2;
+ desc = (const OutputDescriptor *)param2;
OutputDescriptor *outputDesc = new OutputDescriptor(*desc);
gOutputs.add(ioHandle, outputDesc);
@@ -458,7 +458,7 @@
break;
}
if (param2 == NULL) break;
- desc = (OutputDescriptor *)param2;
+ desc = (const OutputDescriptor *)param2;
ALOGV("ioConfigChanged() new config for output %d samplingRate %d, format %d channels %d frameCount %d latency %d",
ioHandle, desc->samplingRate, desc->format,
diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libmedia/IAudioFlingerClient.cpp
index ce28b33..1db39a3 100644
--- a/media/libmedia/IAudioFlingerClient.cpp
+++ b/media/libmedia/IAudioFlingerClient.cpp
@@ -39,18 +39,18 @@
{
}
- void ioConfigChanged(int event, audio_io_handle_t ioHandle, void *param2)
+ void ioConfigChanged(int event, audio_io_handle_t ioHandle, const void *param2)
{
Parcel data, reply;
data.writeInterfaceToken(IAudioFlingerClient::getInterfaceDescriptor());
data.writeInt32(event);
data.writeInt32((int32_t) ioHandle);
if (event == AudioSystem::STREAM_CONFIG_CHANGED) {
- uint32_t stream = *(uint32_t *)param2;
+ uint32_t stream = *(const uint32_t *)param2;
ALOGV("ioConfigChanged stream %d", stream);
data.writeInt32(stream);
} else if (event != AudioSystem::OUTPUT_CLOSED && event != AudioSystem::INPUT_CLOSED) {
- AudioSystem::OutputDescriptor *desc = (AudioSystem::OutputDescriptor *)param2;
+ const AudioSystem::OutputDescriptor *desc = (const AudioSystem::OutputDescriptor *)param2;
data.writeInt32(desc->samplingRate);
data.writeInt32(desc->format);
data.writeInt32(desc->channels);
@@ -73,7 +73,7 @@
CHECK_INTERFACE(IAudioFlingerClient, data, reply);
int event = data.readInt32();
audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32();
- void *param2 = NULL;
+ const void *param2 = NULL;
AudioSystem::OutputDescriptor desc;
uint32_t stream;
if (event == AudioSystem::STREAM_CONFIG_CHANGED) {
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index d8a5d99..97a8f8b 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1053,7 +1053,7 @@
}
// audioConfigChanged_l() must be called with AudioFlinger::mLock held
-void AudioFlinger::audioConfigChanged_l(int event, audio_io_handle_t ioHandle, void *param2)
+void AudioFlinger::audioConfigChanged_l(int event, audio_io_handle_t ioHandle, const void *param2)
{
size_t size = mNotificationClients.size();
for (size_t i = 0; i < size; i++) {
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 336c777..7fc6cc2 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -1063,7 +1063,7 @@
// no range check, doesn't check per-thread stream volume, AudioFlinger::mLock held
float streamVolume_l(audio_stream_type_t stream) const
{ return mStreamTypes[stream].volume; }
- void audioConfigChanged_l(int event, audio_io_handle_t ioHandle, void *param2);
+ void audioConfigChanged_l(int event, audio_io_handle_t ioHandle, const void *param2);
// allocate an audio_io_handle_t, session ID, or effect ID
uint32_t nextUniqueId();