summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/media/Visualizer.h3
-rw-r--r--include/media/stagefright/ACodec.h3
-rw-r--r--include/media/stagefright/FrameRenderTracker.h5
-rw-r--r--media/libeffects/downmix/EffectDownmix.c18
-rw-r--r--media/libeffects/loudness/EffectLoudnessEnhancer.cpp12
-rw-r--r--media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp134
-rw-r--r--media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp30
-rw-r--r--media/libeffects/preprocessing/PreProcessing.cpp35
-rw-r--r--media/libeffects/visualizer/EffectVisualizer.cpp16
-rw-r--r--media/libmedia/Visualizer.cpp12
-rw-r--r--media/libstagefright/ACodec.cpp24
-rw-r--r--media/libstagefright/FrameRenderTracker.cpp21
-rw-r--r--media/libstagefright/MediaCodec.cpp6
-rw-r--r--media/libstagefright/omx/OMXNodeInstance.cpp31
-rw-r--r--services/audioflinger/FastMixer.cpp4
-rw-r--r--services/audioflinger/SpdifStreamOut.cpp3
-rw-r--r--services/audiopolicy/managerdefault/AudioPolicyManager.cpp25
-rw-r--r--services/audiopolicy/managerdefault/AudioPolicyManager.h2
-rw-r--r--services/camera/libcameraservice/device3/Camera3Device.cpp6
19 files changed, 200 insertions, 190 deletions
diff --git a/include/media/Visualizer.h b/include/media/Visualizer.h
index b92f816..186e018 100644
--- a/include/media/Visualizer.h
+++ b/include/media/Visualizer.h
@@ -95,7 +95,8 @@ public:
// install a callback to receive periodic captures. The capture rate is specified in milliHertz
// and the capture format is according to flags (see callback_flags).
- status_t setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags, uint32_t rate);
+ status_t setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags, uint32_t rate,
+ bool force = false);
// set the capture size capture size must be a power of two in the range
// [VISUALIZER_CAPTURE_SIZE_MAX. VISUALIZER_CAPTURE_SIZE_MIN]
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index f9ea38e..a4b24d7 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -110,6 +110,9 @@ private:
enum {
kWhatSetup = 'setu',
kWhatOMXMessage = 'omx ',
+ // same as kWhatOMXMessage - but only used with
+ // handleMessage during OMX message-list handling
+ kWhatOMXMessageItem = 'omxI',
kWhatOMXMessageList = 'omxL',
kWhatInputBufferFilled = 'inpF',
kWhatOutputBufferDrained = 'outD',
diff --git a/include/media/stagefright/FrameRenderTracker.h b/include/media/stagefright/FrameRenderTracker.h
index 3b0db5a..9333e8f 100644
--- a/include/media/stagefright/FrameRenderTracker.h
+++ b/include/media/stagefright/FrameRenderTracker.h
@@ -119,8 +119,9 @@ struct FrameRenderTracker : public RefBase {
std::list<Info> checkFencesAndGetRenderedFrames(const Info *until, bool dropIncomplete);
// Stop tracking a queued frame (e.g. if the frame has been discarded). If |info| is NULL or is
- // not tracked, this method is a no-op.
- void untrackFrame(const Info *info);
+ // not tracked, this method is a no-op. If |index| is specified, all indices larger that |index|
+ // are decremented. This is useful if the untracked frame is deleted from the frame vector.
+ void untrackFrame(const Info *info, ssize_t index = SSIZE_MAX);
void dumpRenderQueue() const;
diff --git a/media/libeffects/downmix/EffectDownmix.c b/media/libeffects/downmix/EffectDownmix.c
index 6686f27..4a41037 100644
--- a/media/libeffects/downmix/EffectDownmix.c
+++ b/media/libeffects/downmix/EffectDownmix.c
@@ -149,8 +149,8 @@ void Downmix_testIndexComputation(uint32_t mask) {
/*--- Effect Library Interface Implementation ---*/
int32_t DownmixLib_Create(const effect_uuid_t *uuid,
- int32_t sessionId,
- int32_t ioId,
+ int32_t sessionId __unused,
+ int32_t ioId __unused,
effect_handle_t *pHandle) {
int ret;
int i;
@@ -370,7 +370,7 @@ static int Downmix_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdS
switch (cmdCode) {
case EFFECT_CMD_INIT:
- if (pReplyData == NULL || *replySize != sizeof(int)) {
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
*(int *) pReplyData = Downmix_Init(pDwmModule);
@@ -378,7 +378,7 @@ static int Downmix_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdS
case EFFECT_CMD_SET_CONFIG:
if (pCmdData == NULL || cmdSize != sizeof(effect_config_t)
- || pReplyData == NULL || *replySize != sizeof(int)) {
+ || pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
*(int *) pReplyData = Downmix_Configure(pDwmModule,
@@ -393,7 +393,7 @@ static int Downmix_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdS
ALOGV("Downmix_Command EFFECT_CMD_GET_PARAM pCmdData %p, *replySize %" PRIu32 ", pReplyData: %p",
pCmdData, *replySize, pReplyData);
if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
- pReplyData == NULL ||
+ pReplyData == NULL || replySize == NULL ||
*replySize < (int) sizeof(effect_param_t) + 2 * sizeof(int32_t)) {
return -EINVAL;
}
@@ -410,7 +410,7 @@ static int Downmix_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdS
ALOGV("Downmix_Command EFFECT_CMD_SET_PARAM cmdSize %d pCmdData %p, *replySize %" PRIu32
", pReplyData %p", cmdSize, pCmdData, *replySize, pReplyData);
if (pCmdData == NULL || (cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)))
- || pReplyData == NULL || *replySize != (int)sizeof(int32_t)) {
+ || pReplyData == NULL || replySize == NULL || *replySize != (int)sizeof(int32_t)) {
return -EINVAL;
}
effect_param_t *cmd = (effect_param_t *) pCmdData;
@@ -429,7 +429,7 @@ static int Downmix_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdS
break;
case EFFECT_CMD_ENABLE:
- if (pReplyData == NULL || *replySize != sizeof(int)) {
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
if (pDownmixer->state != DOWNMIX_STATE_INITIALIZED) {
@@ -441,7 +441,7 @@ static int Downmix_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdS
break;
case EFFECT_CMD_DISABLE:
- if (pReplyData == NULL || *replySize != sizeof(int)) {
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
if (pDownmixer->state != DOWNMIX_STATE_ACTIVE) {
@@ -659,7 +659,7 @@ int Downmix_Configure(downmix_module_t *pDwmModule, effect_config_t *pConfig, bo
*----------------------------------------------------------------------------
*/
-int Downmix_Reset(downmix_object_t *pDownmixer, bool init) {
+int Downmix_Reset(downmix_object_t *pDownmixer __unused, bool init __unused) {
// nothing to do here
return 0;
}
diff --git a/media/libeffects/loudness/EffectLoudnessEnhancer.cpp b/media/libeffects/loudness/EffectLoudnessEnhancer.cpp
index 3c2b320..a5a1a3f 100644
--- a/media/libeffects/loudness/EffectLoudnessEnhancer.cpp
+++ b/media/libeffects/loudness/EffectLoudnessEnhancer.cpp
@@ -189,8 +189,8 @@ int LE_init(LoudnessEnhancerContext *pContext)
//
int LELib_Create(const effect_uuid_t *uuid,
- int32_t sessionId,
- int32_t ioId,
+ int32_t sessionId __unused,
+ int32_t ioId __unused,
effect_handle_t *pHandle) {
ALOGV("LELib_Create()");
int ret;
@@ -327,7 +327,7 @@ int LE_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
break;
case EFFECT_CMD_SET_CONFIG:
if (pCmdData == NULL || cmdSize != sizeof(effect_config_t)
- || pReplyData == NULL || *replySize != sizeof(int)) {
+ || pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
*(int *) pReplyData = LE_setConfig(pContext,
@@ -344,7 +344,7 @@ int LE_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
LE_reset(pContext);
break;
case EFFECT_CMD_ENABLE:
- if (pReplyData == NULL || *replySize != sizeof(int)) {
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
if (pContext->mState != LOUDNESS_ENHANCER_STATE_INITIALIZED) {
@@ -368,7 +368,7 @@ int LE_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
case EFFECT_CMD_GET_PARAM: {
if (pCmdData == NULL ||
cmdSize != (int)(sizeof(effect_param_t) + sizeof(uint32_t)) ||
- pReplyData == NULL ||
+ pReplyData == NULL || replySize == NULL ||
*replySize < (int)(sizeof(effect_param_t) + sizeof(uint32_t) + sizeof(uint32_t))) {
return -EINVAL;
}
@@ -394,7 +394,7 @@ int LE_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
case EFFECT_CMD_SET_PARAM: {
if (pCmdData == NULL ||
cmdSize != (int)(sizeof(effect_param_t) + sizeof(uint32_t) + sizeof(uint32_t)) ||
- pReplyData == NULL || *replySize != sizeof(int32_t)) {
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
return -EINVAL;
}
*(int32_t *)pReplyData = 0;
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index d904ab6..af904a6 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -3034,7 +3034,7 @@ int Effect_command(effect_handle_t self,
switch (cmdCode){
case EFFECT_CMD_INIT:
- if (pReplyData == NULL || *replySize != sizeof(int)){
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)){
ALOGV("\tLVM_ERROR, EFFECT_CMD_INIT: ERROR for effect type %d",
pContext->EffectType);
return -EINVAL;
@@ -3061,10 +3061,8 @@ int Effect_command(effect_handle_t self,
case EFFECT_CMD_SET_CONFIG:
//ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_CONFIG start");
- if (pCmdData == NULL||
- cmdSize != sizeof(effect_config_t)||
- pReplyData == NULL||
- *replySize != sizeof(int)){
+ if (pCmdData == NULL || cmdSize != sizeof(effect_config_t) ||
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
"EFFECT_CMD_SET_CONFIG: ERROR");
return -EINVAL;
@@ -3074,8 +3072,7 @@ int Effect_command(effect_handle_t self,
break;
case EFFECT_CMD_GET_CONFIG:
- if (pReplyData == NULL ||
- *replySize != sizeof(effect_config_t)) {
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(effect_config_t)) {
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
"EFFECT_CMD_GET_CONFIG: ERROR");
return -EINVAL;
@@ -3093,30 +3090,27 @@ int Effect_command(effect_handle_t self,
case EFFECT_CMD_GET_PARAM:{
//ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
- if(pContext->EffectType == LVM_BASS_BOOST){
- if (pCmdData == NULL ||
- cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
- pReplyData == NULL ||
- *replySize < (sizeof(effect_param_t) + sizeof(int32_t))){
- ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
- "EFFECT_CMD_GET_PARAM: ERROR");
- return -EINVAL;
- }
- effect_param_t *p = (effect_param_t *)pCmdData;
+ effect_param_t *p = (effect_param_t *)pCmdData;
+
+ if (pCmdData == NULL || cmdSize < sizeof(effect_param_t) ||
+ cmdSize < (sizeof(effect_param_t) + p->psize) ||
+ pReplyData == NULL || replySize == NULL ||
+ *replySize < (sizeof(effect_param_t) + p->psize)) {
+ ALOGV("\tLVM_ERROR : EFFECT_CMD_GET_PARAM: ERROR");
+ return -EINVAL;
+ }
- memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
+ memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
- p = (effect_param_t *)pReplyData;
+ p = (effect_param_t *)pReplyData;
- int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
+ int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
+ if(pContext->EffectType == LVM_BASS_BOOST){
p->status = android::BassBoost_getParameter(pContext,
p->data,
&p->vsize,
p->data + voffset);
-
- *replySize = sizeof(effect_param_t) + voffset + p->vsize;
-
//ALOGV("\tBassBoost_command EFFECT_CMD_GET_PARAM "
// "*pCmdData %d, *replySize %d, *pReplyData %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
@@ -3125,27 +3119,10 @@ int Effect_command(effect_handle_t self,
}
if(pContext->EffectType == LVM_VIRTUALIZER){
- if (pCmdData == NULL ||
- cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
- pReplyData == NULL ||
- *replySize < (sizeof(effect_param_t) + sizeof(int32_t))){
- ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
- "EFFECT_CMD_GET_PARAM: ERROR");
- return -EINVAL;
- }
- effect_param_t *p = (effect_param_t *)pCmdData;
-
- memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
-
- p = (effect_param_t *)pReplyData;
-
- int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
-
p->status = android::Virtualizer_getParameter(pContext,
(void *)p->data,
&p->vsize,
p->data + voffset);
- *replySize = sizeof(effect_param_t) + voffset + p->vsize;
//ALOGV("\tVirtualizer_command EFFECT_CMD_GET_PARAM "
// "*pCmdData %d, *replySize %d, *pReplyData %d ",
@@ -3156,29 +3133,11 @@ int Effect_command(effect_handle_t self,
if(pContext->EffectType == LVM_EQUALIZER){
//ALOGV("\tEqualizer_command cmdCode Case: "
// "EFFECT_CMD_GET_PARAM start");
- if (pCmdData == NULL ||
- cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
- pReplyData == NULL ||
- *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))) {
- ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
- "EFFECT_CMD_GET_PARAM");
- return -EINVAL;
- }
- effect_param_t *p = (effect_param_t *)pCmdData;
-
- memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
-
- p = (effect_param_t *)pReplyData;
-
- int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
-
p->status = android::Equalizer_getParameter(pContext,
p->data,
&p->vsize,
p->data + voffset);
- *replySize = sizeof(effect_param_t) + voffset + p->vsize;
-
//ALOGV("\tEqualizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, "
// "*pReplyData %08x %08x",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)), *replySize,
@@ -3188,35 +3147,19 @@ int Effect_command(effect_handle_t self,
}
if(pContext->EffectType == LVM_VOLUME){
//ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
- if (pCmdData == NULL ||
- cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
- pReplyData == NULL ||
- *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
- ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
- "EFFECT_CMD_GET_PARAM: ERROR");
- return -EINVAL;
- }
- effect_param_t *p = (effect_param_t *)pCmdData;
-
- memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
-
- p = (effect_param_t *)pReplyData;
-
- int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
-
p->status = android::Volume_getParameter(pContext,
(void *)p->data,
&p->vsize,
p->data + voffset);
- *replySize = sizeof(effect_param_t) + voffset + p->vsize;
-
//ALOGV("\tVolume_command EFFECT_CMD_GET_PARAM "
// "*pCmdData %d, *replySize %d, *pReplyData %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
// *replySize,
// *(int16_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset));
}
+ *replySize = sizeof(effect_param_t) + voffset + p->vsize;
+
//ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM end");
} break;
case EFFECT_CMD_SET_PARAM:{
@@ -3227,10 +3170,9 @@ int Effect_command(effect_handle_t self,
// *replySize,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
- if (pCmdData == NULL||
- cmdSize != (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))||
- pReplyData == NULL||
- *replySize != sizeof(int32_t)){
+ if (pCmdData == NULL ||
+ cmdSize != (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t)) ||
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
@@ -3262,11 +3204,10 @@ int Effect_command(effect_handle_t self,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
if (pCmdData == NULL ||
- // legal parameters are int16_t or int32_t
- cmdSize > (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int32_t)) ||
- cmdSize < (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t)) ||
- pReplyData == NULL ||
- *replySize != sizeof(int32_t)){
+ // legal parameters are int16_t or int32_t
+ cmdSize > (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int32_t)) ||
+ cmdSize < (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t)) ||
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
@@ -3299,7 +3240,7 @@ int Effect_command(effect_handle_t self,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
if (pCmdData == NULL || cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
- pReplyData == NULL || *replySize != sizeof(int32_t)) {
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
@@ -3317,10 +3258,10 @@ int Effect_command(effect_handle_t self,
// *replySize,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) +sizeof(int32_t)));
- if ( pCmdData == NULL||
- cmdSize < (sizeof(effect_param_t) + sizeof(int32_t))||
- pReplyData == NULL||
- *replySize != sizeof(int32_t)){
+ if (pCmdData == NULL ||
+ cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
+ pReplyData == NULL || replySize == NULL ||
+ *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
@@ -3336,7 +3277,7 @@ int Effect_command(effect_handle_t self,
case EFFECT_CMD_ENABLE:
ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_ENABLE start");
- if (pReplyData == NULL || *replySize != sizeof(int)){
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
return -EINVAL;
}
@@ -3346,7 +3287,7 @@ int Effect_command(effect_handle_t self,
case EFFECT_CMD_DISABLE:
//ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_DISABLE start");
- if (pReplyData == NULL || *replySize != sizeof(int)){
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
return -EINVAL;
}
@@ -3356,6 +3297,11 @@ int Effect_command(effect_handle_t self,
case EFFECT_CMD_SET_DEVICE:
{
ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE start");
+ if (pCmdData == NULL){
+ ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_SET_DEVICE: ERROR");
+ return -EINVAL;
+ }
+
uint32_t device = *(uint32_t *)pCmdData;
pContext->pBundledContext->nOutputDevice = (audio_devices_t) device;
@@ -3444,8 +3390,8 @@ int Effect_command(effect_handle_t self,
break;
}
- if (pCmdData == NULL ||
- cmdSize != 2 * sizeof(uint32_t)) {
+ if (pCmdData == NULL || cmdSize != 2 * sizeof(uint32_t) || pReplyData == NULL ||
+ replySize == NULL || *replySize < 2*sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
"EFFECT_CMD_SET_VOLUME: ERROR");
return -EINVAL;
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 13f1a0d..a48a4e3 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -190,8 +190,8 @@ int Reverb_LoadPreset (ReverbContext *pContext);
/* Effect Library Interface Implementation */
extern "C" int EffectCreate(const effect_uuid_t *uuid,
- int32_t sessionId,
- int32_t ioId,
+ int32_t sessionId __unused,
+ int32_t ioId __unused,
effect_handle_t *pHandle){
int ret;
int i;
@@ -1915,7 +1915,7 @@ int Reverb_command(effect_handle_t self,
//ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_INIT start");
- if (pReplyData == NULL || *replySize != sizeof(int)){
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)){
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
"EFFECT_CMD_INIT: ERROR");
return -EINVAL;
@@ -1926,10 +1926,8 @@ int Reverb_command(effect_handle_t self,
case EFFECT_CMD_SET_CONFIG:
//ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_SET_CONFIG start");
- if (pCmdData == NULL ||
- cmdSize != sizeof(effect_config_t) ||
- pReplyData == NULL ||
- *replySize != sizeof(int)) {
+ if (pCmdData == NULL || cmdSize != sizeof(effect_config_t) ||
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
"EFFECT_CMD_SET_CONFIG: ERROR");
return -EINVAL;
@@ -1939,8 +1937,7 @@ int Reverb_command(effect_handle_t self,
break;
case EFFECT_CMD_GET_CONFIG:
- if (pReplyData == NULL ||
- *replySize != sizeof(effect_config_t)) {
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(effect_config_t)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
"EFFECT_CMD_GET_CONFIG: ERROR");
return -EINVAL;
@@ -1958,15 +1955,16 @@ int Reverb_command(effect_handle_t self,
case EFFECT_CMD_GET_PARAM:{
//ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_GET_PARAM start");
- if (pCmdData == NULL ||
- cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
- pReplyData == NULL ||
- *replySize < (sizeof(effect_param_t) + sizeof(int32_t))){
+ effect_param_t *p = (effect_param_t *)pCmdData;
+
+ if (pCmdData == NULL || cmdSize < sizeof(effect_param_t) ||
+ cmdSize < (sizeof(effect_param_t) + p->psize) ||
+ pReplyData == NULL || replySize == NULL ||
+ *replySize < (sizeof(effect_param_t) + p->psize)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
"EFFECT_CMD_GET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t *p = (effect_param_t *)pCmdData;
memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
@@ -1997,8 +1995,8 @@ int Reverb_command(effect_handle_t self,
// *replySize,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
- if (pCmdData == NULL || (cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)))
- || pReplyData == NULL || *replySize != sizeof(int32_t)) {
+ if (pCmdData == NULL || (cmdSize < (sizeof(effect_param_t) + sizeof(int32_t))) ||
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp
index cf98f56..6dd4439 100644
--- a/media/libeffects/preprocessing/PreProcessing.cpp
+++ b/media/libeffects/preprocessing/PreProcessing.cpp
@@ -575,16 +575,18 @@ int NsCreate(preproc_effect_t *effect)
return 0;
}
-int NsGetParameter(preproc_effect_t *effect,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue)
+int NsGetParameter(preproc_effect_t *effect __unused,
+ void *pParam __unused,
+ uint32_t *pValueSize __unused,
+ void *pValue __unused)
{
int status = 0;
return status;
}
-int NsSetParameter (preproc_effect_t *effect, void *pParam, void *pValue)
+int NsSetParameter (preproc_effect_t *effect __unused,
+ void *pParam __unused,
+ void *pValue __unused)
{
int status = 0;
return status;
@@ -1434,16 +1436,17 @@ int PreProcessingFx_Command(effect_handle_t self,
}
break;
- case EFFECT_CMD_GET_PARAM:{
- if (pCmdData == NULL ||
- cmdSize < (int)sizeof(effect_param_t) ||
- pReplyData == NULL ||
- *replySize < (int)sizeof(effect_param_t)){
+ case EFFECT_CMD_GET_PARAM: {
+ effect_param_t *p = (effect_param_t *)pCmdData;
+
+ if (pCmdData == NULL || cmdSize < sizeof(effect_param_t) ||
+ cmdSize < (sizeof(effect_param_t) + p->psize) ||
+ pReplyData == NULL || replySize == NULL ||
+ *replySize < (sizeof(effect_param_t) + p->psize)){
ALOGV("PreProcessingFx_Command cmdCode Case: "
"EFFECT_CMD_GET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t *p = (effect_param_t *)pCmdData;
memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
@@ -1461,8 +1464,8 @@ int PreProcessingFx_Command(effect_handle_t self,
case EFFECT_CMD_SET_PARAM:{
if (pCmdData == NULL||
- cmdSize < (int)sizeof(effect_param_t) ||
- pReplyData == NULL ||
+ cmdSize < sizeof(effect_param_t) ||
+ pReplyData == NULL || replySize == NULL ||
*replySize != sizeof(int32_t)){
ALOGV("PreProcessingFx_Command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
@@ -1483,7 +1486,7 @@ int PreProcessingFx_Command(effect_handle_t self,
} break;
case EFFECT_CMD_ENABLE:
- if (pReplyData == NULL || *replySize != sizeof(int)){
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)){
ALOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
return -EINVAL;
}
@@ -1491,7 +1494,7 @@ int PreProcessingFx_Command(effect_handle_t self,
break;
case EFFECT_CMD_DISABLE:
- if (pReplyData == NULL || *replySize != sizeof(int)){
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)){
ALOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
return -EINVAL;
}
@@ -1711,7 +1714,7 @@ int PreProcessingFx_GetDescriptor(effect_handle_t self,
int PreProcessingFx_ProcessReverse(effect_handle_t self,
audio_buffer_t *inBuffer,
- audio_buffer_t *outBuffer)
+ audio_buffer_t *outBuffer __unused)
{
preproc_effect_t * effect = (preproc_effect_t *)self;
int status = 0;
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index e5089da..0c310c5 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -424,21 +424,21 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
switch (cmdCode) {
case EFFECT_CMD_INIT:
- if (pReplyData == NULL || *replySize != sizeof(int)) {
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
*(int *) pReplyData = Visualizer_init(pContext);
break;
case EFFECT_CMD_SET_CONFIG:
if (pCmdData == NULL || cmdSize != sizeof(effect_config_t)
- || pReplyData == NULL || *replySize != sizeof(int)) {
+ || pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
*(int *) pReplyData = Visualizer_setConfig(pContext,
(effect_config_t *) pCmdData);
break;
case EFFECT_CMD_GET_CONFIG:
- if (pReplyData == NULL ||
+ if (pReplyData == NULL || replySize == NULL ||
*replySize != sizeof(effect_config_t)) {
return -EINVAL;
}
@@ -448,7 +448,7 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
Visualizer_reset(pContext);
break;
case EFFECT_CMD_ENABLE:
- if (pReplyData == NULL || *replySize != sizeof(int)) {
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
if (pContext->mState != VISUALIZER_STATE_INITIALIZED) {
@@ -459,7 +459,7 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
*(int *)pReplyData = 0;
break;
case EFFECT_CMD_DISABLE:
- if (pReplyData == NULL || *replySize != sizeof(int)) {
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
if (pContext->mState != VISUALIZER_STATE_ACTIVE) {
@@ -472,7 +472,7 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
case EFFECT_CMD_GET_PARAM: {
if (pCmdData == NULL ||
cmdSize != (int)(sizeof(effect_param_t) + sizeof(uint32_t)) ||
- pReplyData == NULL ||
+ pReplyData == NULL || replySize == NULL ||
*replySize < (int)(sizeof(effect_param_t) + sizeof(uint32_t) + sizeof(uint32_t))) {
return -EINVAL;
}
@@ -510,7 +510,7 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
case EFFECT_CMD_SET_PARAM: {
if (pCmdData == NULL ||
cmdSize != (int)(sizeof(effect_param_t) + sizeof(uint32_t) + sizeof(uint32_t)) ||
- pReplyData == NULL || *replySize != sizeof(int32_t)) {
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
return -EINVAL;
}
*(int32_t *)pReplyData = 0;
@@ -548,7 +548,7 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
case VISUALIZER_CMD_CAPTURE: {
uint32_t captureSize = pContext->mCaptureSize;
- if (pReplyData == NULL || *replySize != captureSize) {
+ if (pReplyData == NULL || replySize == NULL || *replySize != captureSize) {
ALOGV("VISUALIZER_CMD_CAPTURE() error *replySize %" PRIu32 " captureSize %" PRIu32,
*replySize, captureSize);
return -EINVAL;
diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp
index dc46038..f5c1b1f 100644
--- a/media/libmedia/Visualizer.cpp
+++ b/media/libmedia/Visualizer.cpp
@@ -54,12 +54,8 @@ Visualizer::Visualizer (const String16& opPackageName,
Visualizer::~Visualizer()
{
ALOGV("Visualizer::~Visualizer()");
- if (mCaptureThread != NULL) {
- mCaptureThread->requestExitAndWait();
- mCaptureThread.clear();
- }
- mCaptureCallBack = NULL;
- mCaptureFlags = 0;
+ setEnabled(false);
+ setCaptureCallBack(NULL, NULL, 0, 0, true);
}
status_t Visualizer::setEnabled(bool enabled)
@@ -99,14 +95,14 @@ status_t Visualizer::setEnabled(bool enabled)
}
status_t Visualizer::setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags,
- uint32_t rate)
+ uint32_t rate, bool force)
{
if (rate > CAPTURE_RATE_MAX) {
return BAD_VALUE;
}
Mutex::Autolock _l(mCaptureLock);
- if (mEnabled) {
+ if (force || mEnabled) {
return INVALID_OPERATION;
}
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 527e9cd..bb53ce6 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -1271,8 +1271,12 @@ void ACodec::notifyOfRenderedFrames(bool dropIncomplete, FrameRenderTracker::Inf
// unlink untracked frames
for (std::list<FrameRenderTracker::Info>::const_iterator it = done.cbegin();
it != done.cend(); ++it) {
- if (it->getIndex() >= 0) {
- mBuffers[kPortIndexOutput].editItemAt(it->getIndex()).mRenderInfo = NULL;
+ ssize_t index = it->getIndex();
+ if (index >= 0 && (size_t)index < mBuffers[kPortIndexOutput].size()) {
+ mBuffers[kPortIndexOutput].editItemAt(index).mRenderInfo = NULL;
+ } else if (index >= 0) {
+ // THIS SHOULD NEVER HAPPEN
+ ALOGE("invalid index %zd in %zu", index, mBuffers[kPortIndexOutput].size());
}
}
@@ -1467,12 +1471,13 @@ status_t ACodec::freeBuffer(OMX_U32 portIndex, size_t i) {
::close(info->mFenceFd);
}
- mRenderTracker.untrackFrame(info->mRenderInfo);
- info->mRenderInfo = NULL;
+ if (portIndex == kPortIndexOutput) {
+ mRenderTracker.untrackFrame(info->mRenderInfo, i);
+ info->mRenderInfo = NULL;
+ }
// remove buffer even if mOMX->freeBuffer fails
mBuffers[portIndex].removeAt(i);
-
return err;
}
@@ -4506,6 +4511,12 @@ bool ACodec::BaseState::onMessageReceived(const sp<AMessage> &msg) {
return checkOMXMessage(msg) ? onOMXMessageList(msg) : true;
}
+ case ACodec::kWhatOMXMessageItem:
+ {
+ // no need to check as we already did it for kWhatOMXMessageList
+ return onOMXMessage(msg);
+ }
+
case ACodec::kWhatOMXMessage:
{
return checkOMXMessage(msg) ? onOMXMessage(msg) : true;
@@ -4593,7 +4604,8 @@ bool ACodec::BaseState::onOMXMessageList(const sp<AMessage> &msg) {
bool receivedRenderedEvents = false;
for (std::list<sp<AMessage>>::const_iterator it = msgList->getList().cbegin();
it != msgList->getList().cend(); ++it) {
- onOMXMessage(*it);
+ (*it)->setWhat(ACodec::kWhatOMXMessageItem);
+ mCodec->handleMessage(*it);
int32_t type;
CHECK((*it)->findInt32("type", &type));
if (type == omx_message::FRAME_RENDERED) {
diff --git a/media/libstagefright/FrameRenderTracker.cpp b/media/libstagefright/FrameRenderTracker.cpp
index ebd2197..917870f 100644
--- a/media/libstagefright/FrameRenderTracker.cpp
+++ b/media/libstagefright/FrameRenderTracker.cpp
@@ -149,14 +149,21 @@ std::list<FrameRenderTracker::Info> FrameRenderTracker::checkFencesAndGetRendere
return done;
}
-void FrameRenderTracker::untrackFrame(const FrameRenderTracker::Info *info) {
- if (info != NULL) {
- for (std::list<Info>::iterator it = mRenderQueue.begin();
- it != mRenderQueue.end(); ++it) {
- if (&*it == info) {
- mRenderQueue.erase(it);
- return;
+void FrameRenderTracker::untrackFrame(const FrameRenderTracker::Info *info, ssize_t index) {
+ if (info == NULL && index == SSIZE_MAX) {
+ // nothing to do
+ return;
+ }
+
+ for (std::list<Info>::iterator it = mRenderQueue.begin();
+ it != mRenderQueue.end(); ) {
+ if (&*it == info) {
+ mRenderQueue.erase(it++);
+ } else {
+ if (it->mIndex > index) {
+ --(it->mIndex);
}
+ ++it;
}
}
}
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index e5b7202..b576cd9 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -1160,6 +1160,12 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
case CodecBase::kWhatComponentConfigured:
{
+ if (mState == UNINITIALIZED || mState == INITIALIZED) {
+ // In case a kWhatError message came in and replied with error,
+ // we log a warning and ignore.
+ ALOGW("configure interrupted by error, current state %d", mState);
+ break;
+ }
CHECK_EQ(mState, CONFIGURING);
// reset input surface flag
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 6ee1a77..147aae7 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -121,9 +121,10 @@ struct BufferMeta {
return;
}
- memcpy((OMX_U8 *)mMem->pointer() + header->nOffset,
- header->pBuffer + header->nOffset,
- header->nFilledLen);
+ // check component returns proper range
+ sp<ABuffer> codec = getBuffer(header, false /* backup */, true /* limit */);
+
+ memcpy((OMX_U8 *)mMem->pointer() + header->nOffset, codec->data(), codec->size());
}
void CopyToOMX(const OMX_BUFFERHEADERTYPE *header) {
@@ -137,14 +138,21 @@ struct BufferMeta {
}
// return either the codec or the backup buffer
- sp<ABuffer> getBuffer(const OMX_BUFFERHEADERTYPE *header, bool backup) {
+ sp<ABuffer> getBuffer(const OMX_BUFFERHEADERTYPE *header, bool backup, bool limit) {
sp<ABuffer> buf;
if (backup && mMem != NULL) {
buf = new ABuffer(mMem->pointer(), mMem->size());
} else {
buf = new ABuffer(header->pBuffer, header->nAllocLen);
}
- buf->setRange(header->nOffset, header->nFilledLen);
+ if (limit) {
+ if (header->nOffset + header->nFilledLen > header->nOffset
+ && header->nOffset + header->nFilledLen <= header->nAllocLen) {
+ buf->setRange(header->nOffset, header->nFilledLen);
+ } else {
+ buf->setRange(0, 0);
+ }
+ }
return buf;
}
@@ -1089,10 +1097,11 @@ status_t OMXNodeInstance::emptyBuffer(
OMX_BUFFERHEADERTYPE *header = findBufferHeader(buffer);
BufferMeta *buffer_meta =
static_cast<BufferMeta *>(header->pAppPrivate);
- sp<ABuffer> backup = buffer_meta->getBuffer(header, true /* backup */);
- sp<ABuffer> codec = buffer_meta->getBuffer(header, false /* backup */);
+ sp<ABuffer> backup = buffer_meta->getBuffer(header, true /* backup */, false /* limit */);
+ sp<ABuffer> codec = buffer_meta->getBuffer(header, false /* backup */, false /* limit */);
// convert incoming ANW meta buffers if component is configured for gralloc metadata mode
+ // ignore rangeOffset in this case
if (mMetadataType[kPortIndexInput] == kMetadataBufferTypeGrallocSource
&& backup->capacity() >= sizeof(VideoNativeMetadata)
&& codec->capacity() >= sizeof(VideoGrallocMetadata)
@@ -1102,7 +1111,7 @@ status_t OMXNodeInstance::emptyBuffer(
VideoGrallocMetadata &codecMeta = *(VideoGrallocMetadata *)codec->base();
CLOG_BUFFER(emptyBuffer, "converting ANWB %p to handle %p",
backupMeta.pBuffer, backupMeta.pBuffer->handle);
- codecMeta.pHandle = backupMeta.pBuffer->handle;
+ codecMeta.pHandle = backupMeta.pBuffer != NULL ? backupMeta.pBuffer->handle : NULL;
codecMeta.eType = kMetadataBufferTypeGrallocSource;
header->nFilledLen = rangeLength ? sizeof(codecMeta) : 0;
header->nOffset = 0;
@@ -1111,6 +1120,7 @@ status_t OMXNodeInstance::emptyBuffer(
// corner case: we permit rangeOffset == end-of-buffer with rangeLength == 0.
if (rangeOffset > header->nAllocLen
|| rangeLength > header->nAllocLen - rangeOffset) {
+ CLOG_ERROR(emptyBuffer, OMX_ErrorBadParameter, FULL_BUFFER(NULL, header, fenceFd));
if (fenceFd >= 0) {
::close(fenceFd);
}
@@ -1380,6 +1390,11 @@ bool OMXNodeInstance::handleMessage(omx_message &msg) {
BufferMeta *buffer_meta =
static_cast<BufferMeta *>(buffer->pAppPrivate);
+ if (buffer->nOffset + buffer->nFilledLen < buffer->nOffset
+ || buffer->nOffset + buffer->nFilledLen > buffer->nAllocLen) {
+ CLOG_ERROR(onFillBufferDone, OMX_ErrorBadParameter,
+ FULL_BUFFER(NULL, buffer, msg.fenceFd));
+ }
buffer_meta->CopyFromOMX(buffer);
if (bufferSource != NULL) {
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index f1cf0aa..45c68b5 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -177,6 +177,10 @@ void FastMixer::onStateChange()
free(mSinkBuffer);
mSinkBuffer = NULL;
if (frameCount > 0 && mSampleRate > 0) {
+ // The mixer produces either 16 bit PCM or float output, select
+ // float output if the HAL supports higher than 16 bit precision.
+ mMixerBufferFormat = mFormat.mFormat == AUDIO_FORMAT_PCM_16_BIT ?
+ AUDIO_FORMAT_PCM_16_BIT : AUDIO_FORMAT_PCM_FLOAT;
// FIXME new may block for unbounded time at internal mutex of the heap
// implementation; it would be better to have normal mixer allocate for us
// to avoid blocking here and to prevent possible priority inversion
diff --git a/services/audioflinger/SpdifStreamOut.cpp b/services/audioflinger/SpdifStreamOut.cpp
index 45b541a..ac637ef 100644
--- a/services/audioflinger/SpdifStreamOut.cpp
+++ b/services/audioflinger/SpdifStreamOut.cpp
@@ -128,7 +128,7 @@ status_t SpdifStreamOut::getRenderPosition(uint32_t *frames)
int SpdifStreamOut::flush()
{
- // FIXME Is there an issue here with flush being asynchronous?
+ mSpdifEncoder.reset();
mRenderPositionHal = 0;
mPreviousHalPosition32 = 0;
return AudioStreamOut::flush();
@@ -136,6 +136,7 @@ int SpdifStreamOut::flush()
int SpdifStreamOut::standby()
{
+ mSpdifEncoder.reset();
mRenderPositionHal = 0;
mPreviousHalPosition32 = 0;
return AudioStreamOut::standby();
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index deebc23..a0de34d 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -213,7 +213,7 @@ status_t AudioPolicyManager::setDeviceConnectionStateInt(audio_devices_t device,
device);
return INVALID_OPERATION;
}
- if (checkInputsForDevice(device, state, inputs, devDesc->mAddress) != NO_ERROR) {
+ if (checkInputsForDevice(devDesc, state, inputs, devDesc->mAddress) != NO_ERROR) {
return INVALID_OPERATION;
}
@@ -247,7 +247,7 @@ status_t AudioPolicyManager::setDeviceConnectionStateInt(audio_devices_t device,
param.addInt(String8(AUDIO_PARAMETER_DEVICE_DISCONNECT), device);
mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
- checkInputsForDevice(device, state, inputs, devDesc->mAddress);
+ checkInputsForDevice(devDesc, state, inputs, devDesc->mAddress);
mAvailableInputDevices.remove(devDesc);
// Propagate device availability to Engine
@@ -3196,7 +3196,9 @@ status_t AudioPolicyManager::checkOutputsForDevice(const sp<DeviceDescriptor> de
if (!desc->isDuplicated() && desc->mProfile == profile) {
// matching profile: save the sample rates, format and channel masks supported
// by the profile in our device descriptor
- devDesc->importAudioPort(profile);
+ if (audio_device_is_digital(device)) {
+ devDesc->importAudioPort(profile);
+ }
break;
}
}
@@ -3359,7 +3361,10 @@ status_t AudioPolicyManager::checkOutputsForDevice(const sp<DeviceDescriptor> de
profile_index--;
} else {
outputs.add(output);
- devDesc->importAudioPort(profile);
+ // Load digital format info only for digital devices
+ if (audio_device_is_digital(device)) {
+ devDesc->importAudioPort(profile);
+ }
if (device_distinguishes_on_address(device)) {
ALOGV("checkOutputsForDevice(): setOutputDevice(dev=0x%x, addr=%s)",
@@ -3422,11 +3427,13 @@ status_t AudioPolicyManager::checkOutputsForDevice(const sp<DeviceDescriptor> de
return NO_ERROR;
}
-status_t AudioPolicyManager::checkInputsForDevice(audio_devices_t device,
+status_t AudioPolicyManager::checkInputsForDevice(const sp<DeviceDescriptor> devDesc,
audio_policy_dev_state_t state,
SortedVector<audio_io_handle_t>& inputs,
const String8 address)
{
+ audio_devices_t device = devDesc->type();
+
sp<AudioInputDescriptor> desc;
if (state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE) {
// first list already open inputs that can be routed to this device
@@ -3477,6 +3484,9 @@ status_t AudioPolicyManager::checkInputsForDevice(audio_devices_t device,
for (input_index = 0; input_index < mInputs.size(); input_index++) {
desc = mInputs.valueAt(input_index);
if (desc->mProfile == profile) {
+ if (audio_device_is_digital(device)) {
+ devDesc->importAudioPort(profile);
+ }
break;
}
}
@@ -3562,6 +3572,9 @@ status_t AudioPolicyManager::checkInputsForDevice(audio_devices_t device,
profile_index--;
} else {
inputs.add(input);
+ if (audio_device_is_digital(device)) {
+ devDesc->importAudioPort(profile);
+ }
ALOGV("checkInputsForDevice(): adding input %d", input);
}
} // end scan profiles
@@ -3591,7 +3604,7 @@ status_t AudioPolicyManager::checkInputsForDevice(audio_devices_t device,
profile_index < mHwModules[module_index]->mInputProfiles.size();
profile_index++) {
sp<IOProfile> profile = mHwModules[module_index]->mInputProfiles[profile_index];
- if (profile->mSupportedDevices.types() & device & ~AUDIO_DEVICE_BIT_IN) {
+ if (profile->mSupportedDevices.types() & (device & ~AUDIO_DEVICE_BIT_IN)) {
ALOGV("checkInputsForDevice(): clearing direct input profile %zu on module %zu",
profile_index, module_index);
if (profile->mSamplingRates[0] == 0) {
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index f9d1198..cf64154 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -456,7 +456,7 @@ protected:
SortedVector<audio_io_handle_t>& outputs,
const String8 address);
- status_t checkInputsForDevice(audio_devices_t device,
+ status_t checkInputsForDevice(const sp<DeviceDescriptor> devDesc,
audio_policy_dev_state_t state,
SortedVector<audio_io_handle_t>& inputs,
const String8 address);
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index c28a57e..9d725de 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -1033,7 +1033,11 @@ status_t Camera3Device::configureStreams(bool isConstrainedHighSpeed) {
Mutex::Autolock il(mInterfaceLock);
Mutex::Autolock l(mLock);
- mIsConstrainedHighSpeedConfiguration = isConstrainedHighSpeed;
+
+ if (mIsConstrainedHighSpeedConfiguration != isConstrainedHighSpeed) {
+ mNeedConfig = true;
+ mIsConstrainedHighSpeedConfiguration = isConstrainedHighSpeed;
+ }
return configureStreamsLocked();
}