Merge "Allow a system property "media.stagefright.cache-params" to override cache/prefetcher"
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index 6fdb726..6981668 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -554,7 +554,7 @@
}
status_t StagefrightRecorder::setParamGeoDataLongitude(
- int32_t longitudex10000) {
+ int64_t longitudex10000) {
if (longitudex10000 > 1800000 || longitudex10000 < -1800000) {
return BAD_VALUE;
@@ -564,7 +564,7 @@
}
status_t StagefrightRecorder::setParamGeoDataLatitude(
- int32_t latitudex10000) {
+ int64_t latitudex10000) {
if (latitudex10000 > 900000 || latitudex10000 < -900000) {
return BAD_VALUE;
@@ -602,13 +602,13 @@
return setParam64BitFileOffset(use64BitOffset != 0);
}
} else if (key == "param-geotag-longitude") {
- int32_t longitudex10000;
- if (safe_strtoi32(value.string(), &longitudex10000)) {
+ int64_t longitudex10000;
+ if (safe_strtoi64(value.string(), &longitudex10000)) {
return setParamGeoDataLongitude(longitudex10000);
}
} else if (key == "param-geotag-latitude") {
- int32_t latitudex10000;
- if (safe_strtoi32(value.string(), &latitudex10000)) {
+ int64_t latitudex10000;
+ if (safe_strtoi64(value.string(), &latitudex10000)) {
return setParamGeoDataLatitude(latitudex10000);
}
} else if (key == "param-track-time-status") {
diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h
index 5c5f05c..ec5ce7e 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -173,8 +173,8 @@
status_t setParamMaxFileDurationUs(int64_t timeUs);
status_t setParamMaxFileSizeBytes(int64_t bytes);
status_t setParamMovieTimeScale(int32_t timeScale);
- status_t setParamGeoDataLongitude(int32_t longitudex10000);
- status_t setParamGeoDataLatitude(int32_t latitudex10000);
+ status_t setParamGeoDataLongitude(int64_t longitudex10000);
+ status_t setParamGeoDataLatitude(int64_t latitudex10000);
void clipVideoBitRate();
void clipVideoFrameRate();
void clipVideoFrameWidth();
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index 3b79f06..1e24599 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -1972,6 +1972,12 @@
sampleIndex, &syncSampleIndex, findFlags);
}
+ uint32_t sampleTime;
+ if (err == OK) {
+ err = mSampleTable->getMetaDataForSample(
+ sampleIndex, NULL, NULL, &sampleTime);
+ }
+
if (err != OK) {
if (err == ERROR_OUT_OF_RANGE) {
// An attempt to seek past the end of the stream would
@@ -1984,10 +1990,6 @@
return err;
}
- uint32_t sampleTime;
- CHECK_EQ((status_t)OK, mSampleTable->getMetaDataForSample(
- sampleIndex, NULL, NULL, &sampleTime));
-
if (mode == ReadOptions::SEEK_CLOSEST) {
targetSampleTimeUs = (sampleTime * 1000000ll) / mTimescale;
}
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 01f5a6f..ab49f93 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -5550,7 +5550,7 @@
// remove chain first. This is useful only if reconfiguring effect chain on same output thread,
// so that a new chain is created with correct parameters when first effect is added. This is
- // otherwise unecessary as removeEffect_l() will remove the chain when last effect is
+ // otherwise unnecessary as removeEffect_l() will remove the chain when last effect is
// removed.
srcThread->removeEffectChain_l(chain);
@@ -5563,6 +5563,11 @@
while (effect != 0) {
srcThread->removeEffect_l(effect);
dstThread->addEffect_l(effect);
+ // removeEffect_l() has stopped the effect if it was active so it must be restarted
+ if (effect->state() == EffectModule::ACTIVE ||
+ effect->state() == EffectModule::STOPPING) {
+ effect->start();
+ }
// if the move request is not received from audio policy manager, the effect must be
// re-registered with the new strategy and output
if (dstChain == 0) {
@@ -6350,6 +6355,12 @@
return status;
}
+status_t AudioFlinger::EffectModule::start()
+{
+ Mutex::Autolock _l(mLock);
+ return start_l();
+}
+
status_t AudioFlinger::EffectModule::start_l()
{
if (mEffectInterface == NULL) {
@@ -7214,7 +7225,10 @@
// calling stop here will remove pre-processing effect from the audio HAL.
// This is safe as we hold the EffectChain mutex which guarantees that we are not in
// the middle of a read from audio HAL
- mEffects[i]->stop();
+ if (mEffects[i]->state() == EffectModule::ACTIVE ||
+ mEffects[i]->state() == EffectModule::STOPPING) {
+ mEffects[i]->stop();
+ }
if (type == EFFECT_FLAG_TYPE_AUXILIARY) {
delete[] effect->inBuffer();
} else {
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 2e05593..ed9d81e 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -1117,6 +1117,7 @@
status_t setDevice(uint32_t device);
status_t setVolume(uint32_t *left, uint32_t *right, bool controller);
status_t setMode(uint32_t mode);
+ status_t start();
status_t stop();
void setSuspended(bool suspended);
bool suspended();
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index b178fd9..05e7bcf 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -278,9 +278,20 @@
// media players.
static MediaPlayer* newMediaPlayer(const char *file) {
+ // Read the system property to determine if we have need to use the
+ // AUDIO_STREAM_ENFORCED_AUDIBLE type.
+ char value[PROPERTY_VALUE_MAX];
+ property_get("ro.camera.sound.forced", value, "0");
+ int audioStreamType;
+ if (strcmp(value, "0") != 0) {
+ audioStreamType = AUDIO_STREAM_ENFORCED_AUDIBLE;
+ } else {
+ audioStreamType = AUDIO_STREAM_MUSIC;
+ }
+
MediaPlayer* mp = new MediaPlayer();
if (mp->setDataSource(file, NULL) == NO_ERROR) {
- mp->setAudioStreamType(AUDIO_STREAM_ENFORCED_AUDIBLE);
+ mp->setAudioStreamType(audioStreamType);
mp->prepare();
} else {
LOGE("Failed to load CameraService sounds: %s", file);
@@ -849,16 +860,16 @@
if (result != NO_ERROR) return result;
if (cmd == CAMERA_CMD_SET_DISPLAY_ORIENTATION) {
- // The orientation cannot be set during preview.
- if (mHardware->previewEnabled()) {
- return INVALID_OPERATION;
- }
// Mirror the preview if the camera is front-facing.
orientation = getOrientation(arg1, mCameraFacing == CAMERA_FACING_FRONT);
if (orientation == -1) return BAD_VALUE;
if (mOrientation != orientation) {
mOrientation = orientation;
+ if (mPreviewWindow != 0) {
+ native_window_set_buffers_transform(mPreviewWindow.get(),
+ mOrientation);
+ }
}
return OK;
} else if (cmd == CAMERA_CMD_ENABLE_SHUTTER_SOUND) {