diff options
-rw-r--r-- | media/libeffects/data/audio_effects.conf | 39 | ||||
-rw-r--r-- | media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp | 106 | ||||
-rw-r--r-- | media/libeffects/lvm/wrapper/Bundle/EffectBundle.h | 2 | ||||
-rw-r--r-- | media/mtp/Android.mk | 28 | ||||
-rw-r--r-- | services/camera/libcameraservice/Camera2Client.cpp | 9 | ||||
-rw-r--r-- | services/camera/libcameraservice/camera2/ZslProcessor.cpp | 19 |
6 files changed, 110 insertions, 93 deletions
diff --git a/media/libeffects/data/audio_effects.conf b/media/libeffects/data/audio_effects.conf index d681c69..93f27cb 100644 --- a/media/libeffects/data/audio_effects.conf +++ b/media/libeffects/data/audio_effects.conf @@ -15,14 +15,18 @@ libraries { visualizer { path /system/lib/soundfx/libvisualizer.so } - pre_processing { - path /system/lib/soundfx/libaudiopreprocessing.so - } downmix { path /system/lib/soundfx/libdownmix.so } } +# Default pre-processing library. Add to audio_effect.conf "libraries" section if +# audio HAL implements support for default software audio pre-processing effects +# +# pre_processing { +# path /system/lib/soundfx/libaudiopreprocessing.so +# } + # list of effects to load. Each effect element must contain a "library" and a "uuid" element. # The value of the "library" element must correspond to the name of one library element in the # "libraries" element. @@ -79,19 +83,24 @@ effects { library downmix uuid 93f04452-e4fe-41cc-91f9-e475b6d1d69f } - agc { - library pre_processing - uuid aa8130e0-66fc-11e0-bad0-0002a5d5c51b - } - aec { - library pre_processing - uuid bb392ec0-8d4d-11e0-a896-0002a5d5c51b - } - ns { - library pre_processing - uuid c06c8400-8e06-11e0-9cb6-0002a5d5c51b - } } + +# Default pre-processing effects. Add to audio_effect.conf "effects" section if +# audio HAL implements support for them. +# +# agc { +# library pre_processing +# uuid aa8130e0-66fc-11e0-bad0-0002a5d5c51b +# } +# aec { +# library pre_processing +# uuid bb392ec0-8d4d-11e0-a896-0002a5d5c51b +# } +# ns { +# library pre_processing +# uuid c06c8400-8e06-11e0-9cb6-0002a5d5c51b +# } + # Audio preprocessor configurations. # The pre processor configuration consists in a list of elements each describing # pre processor settings for a given input source. Valid input source names are: diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp index d4be9fa..f3f2d1e 100644 --- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp @@ -299,6 +299,10 @@ extern "C" int EffectCreate(const effect_uuid_t *uuid, pContext->pBundledContext->SamplesToExitCountBb = 0; pContext->pBundledContext->SamplesToExitCountEq = 0; + for (int i = 0; i < FIVEBAND_NUMBANDS; i++) { + pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i]; + } + ALOGV("\tEffectCreate - Calling LvmBundle_init"); ret = LvmBundle_init(pContext); @@ -1194,36 +1198,71 @@ void VirtualizerSetStrength(EffectContext *pContext, uint32_t strength){ //ALOGV("\tVirtualizerSetStrength Succesfully called LVM_SetControlParameters\n\n"); } /* end setStrength */ + //---------------------------------------------------------------------------- -// EqualizerGetBandLevel() +// EqualizerLimitBandLevels() //---------------------------------------------------------------------------- -// Purpose: Retrieve the gain currently being used for the band passed in +// Purpose: limit all EQ band gains to a value less than MAX_BAND_GAIN_DB while +// preserving the relative band levels. // // Inputs: -// band: band number // pContext: effect engine context // // Outputs: // //---------------------------------------------------------------------------- -int32_t EqualizerGetBandLevel(EffectContext *pContext, int32_t band){ - - int32_t Gain =0; - LVM_ControlParams_t ActiveParams; /* Current control Parameters */ - LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */ +void EqualizerLimitBandLevels(EffectContext *pContext) { + LVM_ControlParams_t ActiveParams; /* Current control Parameters */ + LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */ LVM_EQNB_BandDef_t *BandDef; - /* Get the current settings */ - LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, - &ActiveParams); - LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "EqualizerGetBandLevel") + /* Get the current settings */ + LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams); + LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "EqualizerLimitBandLevels") + //ALOGV("\tEqualizerLimitBandLevels Succesfully returned from LVM_GetControlParameters\n"); + //ALOGV("\tEqualizerLimitBandLevels just Got -> %d\n", + // ActiveParams.pEQNB_BandDefinition[band].Gain); + + int gainCorrection = 0; + for (int i = 0; i < FIVEBAND_NUMBANDS; i++) { + int level = pContext->pBundledContext->bandGaindB[i] + ActiveParams.VC_EffectLevel; + if (level > MAX_BAND_GAIN_DB) { + int correction = MAX_BAND_GAIN_DB -level; + if (correction < gainCorrection) { + gainCorrection = correction; + } + } + } + /* Set local EQ parameters */ BandDef = ActiveParams.pEQNB_BandDefinition; - Gain = (int32_t)BandDef[band].Gain*100; // Convert to millibels + for (int i=0; i < FIVEBAND_NUMBANDS; i++) { + ActiveParams.pEQNB_BandDefinition[i].Gain = pContext->pBundledContext->bandGaindB[i] + + gainCorrection; + } + /* Activate the initial settings */ + LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams); + LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "EqualizerLimitBandLevels") + //ALOGV("\tEqualizerLimitBandLevels just Set -> %d\n", + // ActiveParams.pEQNB_BandDefinition[band].Gain); +} - //ALOGV("\tEqualizerGetBandLevel -> %d\n", Gain ); - //ALOGV("\tEqualizerGetBandLevel Succesfully returned from LVM_GetControlParameters\n"); - return Gain; + +//---------------------------------------------------------------------------- +// EqualizerGetBandLevel() +//---------------------------------------------------------------------------- +// Purpose: Retrieve the gain currently being used for the band passed in +// +// Inputs: +// band: band number +// pContext: effect engine context +// +// Outputs: +// +//---------------------------------------------------------------------------- +int32_t EqualizerGetBandLevel(EffectContext *pContext, int32_t band){ + //ALOGV("\tEqualizerGetBandLevel -> %d\n", pContext->pBundledContext->bandGaindB[band] ); + return pContext->pBundledContext->bandGaindB[band] * 100; } //---------------------------------------------------------------------------- @@ -1248,30 +1287,12 @@ void EqualizerSetBandLevel(EffectContext *pContext, int band, short Gain){ gainRounded = (int)((Gain-50)/100); } //ALOGV("\tEqualizerSetBandLevel(%d)->(%d)", Gain, gainRounded); - - - LVM_ControlParams_t ActiveParams; /* Current control Parameters */ - LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */ - LVM_EQNB_BandDef_t *BandDef; - - /* Get the current settings */ - LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams); - LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "EqualizerSetBandLevel") - //ALOGV("\tEqualizerSetBandLevel Succesfully returned from LVM_GetControlParameters\n"); - //ALOGV("\tEqualizerSetBandLevel just Got -> %d\n",ActiveParams.pEQNB_BandDefinition[band].Gain); - - /* Set local EQ parameters */ - BandDef = ActiveParams.pEQNB_BandDefinition; - ActiveParams.pEQNB_BandDefinition[band].Gain = gainRounded; - - /* Activate the initial settings */ - LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams); - LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "EqualizerSetBandLevel") - //ALOGV("\tEqualizerSetBandLevel just Set -> %d\n",ActiveParams.pEQNB_BandDefinition[band].Gain); - + pContext->pBundledContext->bandGaindB[band] = gainRounded; pContext->pBundledContext->CurPreset = PRESET_CUSTOM; - return; + + EqualizerLimitBandLevels(pContext); } + //---------------------------------------------------------------------------- // EqualizerGetCentreFrequency() //---------------------------------------------------------------------------- @@ -1410,13 +1431,15 @@ void EqualizerSetPreset(EffectContext *pContext, int preset){ { ActiveParams.pEQNB_BandDefinition[i].Frequency = EQNB_5BandPresetsFrequencies[i]; ActiveParams.pEQNB_BandDefinition[i].QFactor = EQNB_5BandPresetsQFactors[i]; - ActiveParams.pEQNB_BandDefinition[i].Gain - = EQNB_5BandSoftPresets[i + preset * FIVEBAND_NUMBANDS]; + pContext->pBundledContext->bandGaindB[i] = + EQNB_5BandSoftPresets[i + preset * FIVEBAND_NUMBANDS]; } /* Activate the new settings */ LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams); LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "EqualizerSetPreset") + EqualizerLimitBandLevels(pContext); + //ALOGV("\tEqualizerSetPreset Succesfully called LVM_SetControlParameters\n"); return; } @@ -1494,6 +1517,9 @@ int VolumeSetVolumeLevel(EffectContext *pContext, int16_t level){ ALOGV("\tLVM_VOLUME: Disabling Smoothing for first volume change to remove spikes/clicks"); pContext->pBundledContext->firstVolume = LVM_FALSE; } + + EqualizerLimitBandLevels(pContext); + return 0; } /* end VolumeSetVolumeLevel */ diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h index 5634ca1..9c58ecd 100644 --- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h +++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h @@ -38,6 +38,7 @@ extern "C" { #define VOLUME_CUP_LOAD_ARM9E 0 // Expressed in 0.1 MIPS #define BUNDLE_MEM_USAGE 25 // Expressed in kB //#define LVM_PCM +#define MAX_BAND_GAIN_DB 4 #ifndef OPENSL_ES_H_ static const effect_uuid_t SL_IID_VOLUME_ = { 0x09e8ede0, 0xddde, 0x11db, 0xb4f6, @@ -95,6 +96,7 @@ struct BundledEffectContext{ int SamplesToExitCountVirt; LVM_INT16 *workBuffer; int frameCount; + int32_t bandGaindB[FIVEBAND_NUMBANDS]; #ifdef LVM_PCM FILE *PcmInPtr; FILE *PcmOutPtr; diff --git a/media/mtp/Android.mk b/media/mtp/Android.mk index fc7fc4f..bee28d4 100644 --- a/media/mtp/Android.mk +++ b/media/mtp/Android.mk @@ -45,31 +45,3 @@ LOCAL_C_INCLUDES := bionic/libc/private LOCAL_SHARED_LIBRARIES := libutils libcutils libusbhost libbinder include $(BUILD_SHARED_LIBRARY) - -ifeq ($(HOST_OS),linux) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - MtpDataPacket.cpp \ - MtpDebug.cpp \ - MtpDevice.cpp \ - MtpEventPacket.cpp \ - MtpDeviceInfo.cpp \ - MtpObjectInfo.cpp \ - MtpPacket.cpp \ - MtpProperty.cpp \ - MtpRequestPacket.cpp \ - MtpResponsePacket.cpp \ - MtpStorageInfo.cpp \ - MtpStringBuffer.cpp \ - MtpStorage.cpp \ - MtpUtils.cpp \ - -LOCAL_MODULE:= libmtp - -LOCAL_CFLAGS := -DMTP_HOST - -include $(BUILD_HOST_STATIC_LIBRARY) - -endif diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp index 90355be..4237afb 100644 --- a/services/camera/libcameraservice/Camera2Client.cpp +++ b/services/camera/libcameraservice/Camera2Client.cpp @@ -681,13 +681,8 @@ status_t Camera2Client::startPreviewL(Parameters ¶ms, bool restart) { } request = &mRecordingRequest; - res = updateRecordingStream(params); - if (res != OK) { - ALOGE("%s: Camera %d: Unable to pre-configure recording " - "stream: %s (%d)", - __FUNCTION__, mCameraId, strerror(-res), res); - return res; - } + // TODO: Re-enable recording stream creation/update here once issues are + // resolved res = mJpegProcessor->updateStream(params); if (res != OK) { diff --git a/services/camera/libcameraservice/camera2/ZslProcessor.cpp b/services/camera/libcameraservice/camera2/ZslProcessor.cpp index ac02afc..ea1c2b9 100644 --- a/services/camera/libcameraservice/camera2/ZslProcessor.cpp +++ b/services/camera/libcameraservice/camera2/ZslProcessor.cpp @@ -134,7 +134,7 @@ status_t ZslProcessor::updateStream(const Parameters ¶ms) { } if (currentWidth != (uint32_t)params.pictureWidth || currentHeight != (uint32_t)params.pictureHeight) { - res = device->deleteStream(mZslReprocessStreamId); + res = device->deleteReprocessStream(mZslReprocessStreamId); if (res != OK) { ALOGE("%s: Camera %d: Unable to delete old reprocess stream " "for ZSL: %s (%d)", __FUNCTION__, @@ -189,9 +189,22 @@ status_t ZslProcessor::deleteStream() { if (client == 0) return OK; sp<Camera2Device> device = client->getCameraDevice(); - device->deleteStream(mZslReprocessStreamId); + res = device->deleteReprocessStream(mZslReprocessStreamId); + if (res != OK) { + ALOGE("%s: Camera %d: Cannot delete ZSL reprocessing stream %d: " + "%s (%d)", __FUNCTION__, client->getCameraId(), + mZslReprocessStreamId, strerror(-res), res); + return res; + } + mZslReprocessStreamId = NO_STREAM; - device->deleteStream(mZslStreamId); + res = device->deleteStream(mZslStreamId); + if (res != OK) { + ALOGE("%s: Camera %d: Cannot delete ZSL output stream %d: " + "%s (%d)", __FUNCTION__, client->getCameraId(), + mZslStreamId, strerror(-res), res); + return res; + } mZslWindow.clear(); mZslConsumer.clear(); |