Merge "Camera2: Configure ZSL at the right time." into jb-mr1-dev
diff --git a/camera/CameraParameters.cpp b/camera/CameraParameters.cpp
index a657fe3..d10f2e5 100644
--- a/camera/CameraParameters.cpp
+++ b/camera/CameraParameters.cpp
@@ -147,6 +147,7 @@
const char CameraParameters::SCENE_MODE_PARTY[] = "party";
const char CameraParameters::SCENE_MODE_CANDLELIGHT[] = "candlelight";
const char CameraParameters::SCENE_MODE_BARCODE[] = "barcode";
+const char CameraParameters::SCENE_MODE_HDR[] = "hdr";
const char CameraParameters::PIXEL_FORMAT_YUV422SP[] = "yuv422sp";
const char CameraParameters::PIXEL_FORMAT_YUV420SP[] = "yuv420sp";
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h
index 8668958..d521543 100644
--- a/include/camera/CameraParameters.h
+++ b/include/camera/CameraParameters.h
@@ -597,6 +597,10 @@
// Applications are looking for a barcode. Camera driver will be optimized
// for barcode reading.
static const char SCENE_MODE_BARCODE[];
+ // A high-dynamic range mode. In this mode, the HAL module will use a
+ // capture strategy that extends the dynamic range of the captured
+ // image in some fashion. Only the final image is returned.
+ static const char SCENE_MODE_HDR[];
// Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT,
// and KEY_VIDEO_FRAME_FORMAT
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 @@
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 @@
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 @@
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,6 +1198,56 @@
//ALOGV("\tVirtualizerSetStrength Succesfully called LVM_SetControlParameters\n\n");
} /* end setStrength */
+
+//----------------------------------------------------------------------------
+// EqualizerLimitBandLevels()
+//----------------------------------------------------------------------------
+// Purpose: limit all EQ band gains to a value less than MAX_BAND_GAIN_DB while
+// preserving the relative band levels.
+//
+// Inputs:
+// pContext: effect engine context
+//
+// Outputs:
+//
+//----------------------------------------------------------------------------
+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", "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;
+ 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);
+}
+
+
//----------------------------------------------------------------------------
// EqualizerGetBandLevel()
//----------------------------------------------------------------------------
@@ -1207,23 +1261,8 @@
//
//----------------------------------------------------------------------------
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 */
- LVM_EQNB_BandDef_t *BandDef;
- /* Get the current settings */
- LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
- &ActiveParams);
-
- LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "EqualizerGetBandLevel")
-
- BandDef = ActiveParams.pEQNB_BandDefinition;
- Gain = (int32_t)BandDef[band].Gain*100; // Convert to millibels
-
- //ALOGV("\tEqualizerGetBandLevel -> %d\n", Gain );
- //ALOGV("\tEqualizerGetBandLevel Succesfully returned from LVM_GetControlParameters\n");
- return Gain;
+ //ALOGV("\tEqualizerGetBandLevel -> %d\n", pContext->pBundledContext->bandGaindB[band] );
+ return pContext->pBundledContext->bandGaindB[band] * 100;
}
//----------------------------------------------------------------------------
@@ -1248,30 +1287,12 @@
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 @@
{
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 @@
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 @@
#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 @@
int SamplesToExitCountVirt;
LVM_INT16 *workBuffer;
int frameCount;
+ int32_t bandGaindB[FIVEBAND_NUMBANDS];
#ifdef LVM_PCM
FILE *PcmInPtr;
FILE *PcmOutPtr;
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 04f78eb..9f069ae 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -451,7 +451,11 @@
}
if (!haveAudio && !haveVideo) {
- return UNKNOWN_ERROR;
+ if (mWVMExtractor != NULL) {
+ return mWVMExtractor->getError();
+ } else {
+ return UNKNOWN_ERROR;
+ }
}
mExtractorFlags = extractor->flags();
diff --git a/media/libstagefright/WVMExtractor.cpp b/media/libstagefright/WVMExtractor.cpp
index d94fc65..31b2bcf 100644
--- a/media/libstagefright/WVMExtractor.cpp
+++ b/media/libstagefright/WVMExtractor.cpp
@@ -148,6 +148,20 @@
}
}
+status_t WVMExtractor::getError() {
+ if (mImpl == NULL) {
+ return UNKNOWN_ERROR;
+ }
+
+ return mImpl->getError();
+}
+
+void WVMExtractor::setError(status_t err) {
+ if (mImpl != NULL) {
+ mImpl->setError(err);
+ }
+}
+
bool SniffWVM(
const sp<DataSource> &source, String8 *mimeType, float *confidence,
sp<AMessage> *) {
diff --git a/media/libstagefright/include/WVMExtractor.h b/media/libstagefright/include/WVMExtractor.h
index c43c801..8e62946 100644
--- a/media/libstagefright/include/WVMExtractor.h
+++ b/media/libstagefright/include/WVMExtractor.h
@@ -33,9 +33,11 @@
virtual ~WVMLoadableExtractor() {}
virtual int64_t getCachedDurationUs(status_t *finalStatus) = 0;
+ virtual status_t getError() = 0;
virtual status_t getEstimatedBandwidthKbps(int32_t *kbps) = 0;
virtual void setAdaptiveStreamingMode(bool adaptive) = 0;
virtual void setCryptoPluginMode(bool cryptoPluginMode) = 0;
+ virtual void setError(status_t err) = 0;
virtual void setUID(uid_t uid) = 0;
};
@@ -76,6 +78,10 @@
static bool getVendorLibHandle();
+ status_t getError();
+
+ void setError(status_t err);
+
protected:
virtual ~WVMExtractor();
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_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/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index a5d4c6c..27e2ed2 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -3383,9 +3383,9 @@
}
// getTrackName_l() must be called with ThreadBase::mLock held
-int AudioFlinger::MixerThread::getTrackName_l(audio_channel_mask_t channelMask)
+int AudioFlinger::MixerThread::getTrackName_l(audio_channel_mask_t channelMask, int sessionId)
{
- return mAudioMixer->getTrackName(channelMask);
+ return mAudioMixer->getTrackName(channelMask, sessionId);
}
// deleteTrackName_l() must be called with ThreadBase::mLock held
@@ -3498,7 +3498,7 @@
readOutputParameters();
mAudioMixer = new AudioMixer(mNormalFrameCount, mSampleRate);
for (size_t i = 0; i < mTracks.size() ; i++) {
- int name = getTrackName_l(mTracks[i]->mChannelMask);
+ int name = getTrackName_l(mTracks[i]->mChannelMask, mTracks[i]->mSessionId);
if (name < 0) break;
mTracks[i]->mName = name;
// limit track sample rate to 2 x new output sample rate
@@ -3828,7 +3828,8 @@
}
// getTrackName_l() must be called with ThreadBase::mLock held
-int AudioFlinger::DirectOutputThread::getTrackName_l(audio_channel_mask_t channelMask)
+int AudioFlinger::DirectOutputThread::getTrackName_l(audio_channel_mask_t channelMask,
+ int sessionId)
{
return 0;
}
@@ -4293,7 +4294,7 @@
// 16 bit because data is converted to 16 bit before being stored in buffer by AudioTrack
mCblk->frameSize = audio_is_linear_pcm(format) ? mChannelCount * sizeof(int16_t) : sizeof(uint8_t);
// to avoid leaking a track name, do not allocate one unless there is an mCblk
- mName = thread->getTrackName_l(channelMask);
+ mName = thread->getTrackName_l(channelMask, sessionId);
mCblk->mName = mName;
if (mName < 0) {
ALOGE("no more track names available");
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 5ffa5a6..c956861 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -1086,7 +1086,7 @@
// Allocate a track name for a given channel mask.
// Returns name >= 0 if successful, -1 on failure.
- virtual int getTrackName_l(audio_channel_mask_t channelMask) = 0;
+ virtual int getTrackName_l(audio_channel_mask_t channelMask, int sessionId) = 0;
virtual void deleteTrackName_l(int name) = 0;
// Time to sleep between cycles when:
@@ -1202,7 +1202,7 @@
protected:
virtual mixer_state prepareTracks_l(Vector< sp<Track> > *tracksToRemove);
- virtual int getTrackName_l(audio_channel_mask_t channelMask);
+ virtual int getTrackName_l(audio_channel_mask_t channelMask, int sessionId);
virtual void deleteTrackName_l(int name);
virtual uint32_t idleSleepTimeUs() const;
virtual uint32_t suspendSleepTimeUs() const;
@@ -1254,7 +1254,7 @@
virtual bool checkForNewParameters_l();
protected:
- virtual int getTrackName_l(audio_channel_mask_t channelMask);
+ virtual int getTrackName_l(audio_channel_mask_t channelMask, int sessionId);
virtual void deleteTrackName_l(int name);
virtual uint32_t activeSleepTimeUs() const;
virtual uint32_t idleSleepTimeUs() const;
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index a9814a1..ab75dd0 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -163,7 +163,7 @@
delete [] mState.resampleTemp;
}
-int AudioMixer::getTrackName(audio_channel_mask_t channelMask)
+int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId)
{
uint32_t names = (~mTrackNames) & mConfiguredNames;
if (names != 0) {
@@ -189,6 +189,7 @@
t->enabled = false;
t->format = 16;
t->channelMask = AUDIO_CHANNEL_OUT_STEREO;
+ t->sessionId = sessionId;
// setBufferProvider(name, AudioBufferProvider *) is required before enable(name)
t->bufferProvider = NULL;
t->downmixerBufferProvider = NULL;
@@ -270,7 +271,7 @@
}
if (EffectCreate(&dwnmFxDesc.uuid,
- -2 /*sessionId*/, -2 /*ioId*/,// both not relevant here, using random value
+ pTrack->sessionId /*sessionId*/, -2 /*ioId not relevant here, using random value*/,
&pDbp->mDownmixHandle/*pHandle*/) != 0) {
ALOGE("prepareTrackForDownmix(%d) fails: error creating downmixer effect", trackName);
goto noDownmixForActiveTrack;
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index 6e34cd1..6333357 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -91,7 +91,7 @@
// For all APIs with "name": TRACK0 <= name < TRACK0 + MAX_NUM_TRACKS
// Allocate a track name. Returns new track name if successful, -1 on failure.
- int getTrackName(audio_channel_mask_t channelMask);
+ int getTrackName(audio_channel_mask_t channelMask, int sessionId);
// Free an allocated track by name
void deleteTrackName(int name);
@@ -192,7 +192,7 @@
DownmixerBufferProvider* downmixerBufferProvider; // 4 bytes
- int32_t padding;
+ int32_t sessionId;
// 16-byte boundary
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index cdc27a2..13003d9 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -281,8 +281,9 @@
AudioBufferProvider *bufferProvider = fastTrack->mBufferProvider;
ALOG_ASSERT(bufferProvider != NULL && fastTrackNames[i] == -1);
if (mixer != NULL) {
- // calling getTrackName with default channel mask
- name = mixer->getTrackName(AUDIO_CHANNEL_OUT_STEREO);
+ // calling getTrackName with default channel mask and a random invalid
+ // sessionId (no effects here)
+ name = mixer->getTrackName(AUDIO_CHANNEL_OUT_STEREO, -555);
ALOG_ASSERT(name >= 0);
fastTrackNames[i] = name;
mixer->setBufferProvider(name, bufferProvider);
diff --git a/services/camera/libcameraservice/CameraClient.cpp b/services/camera/libcameraservice/CameraClient.cpp
index 562384d..c9c816a 100644
--- a/services/camera/libcameraservice/CameraClient.cpp
+++ b/services/camera/libcameraservice/CameraClient.cpp
@@ -608,11 +608,9 @@
} else if (cmd == CAMERA_CMD_ENABLE_SHUTTER_SOUND) {
switch (arg1) {
case 0:
- enableShutterSound(false);
- break;
+ return enableShutterSound(false);
case 1:
- enableShutterSound(true);
- break;
+ return enableShutterSound(true);
default:
return BAD_VALUE;
}