summaryrefslogtreecommitdiffstats
path: root/media/libavextensions
diff options
context:
space:
mode:
Diffstat (limited to 'media/libavextensions')
-rw-r--r--media/libavextensions/stagefright/AVUtils.cpp42
1 files changed, 38 insertions, 4 deletions
diff --git a/media/libavextensions/stagefright/AVUtils.cpp b/media/libavextensions/stagefright/AVUtils.cpp
index 16ff97c..b17ab2e 100644
--- a/media/libavextensions/stagefright/AVUtils.cpp
+++ b/media/libavextensions/stagefright/AVUtils.cpp
@@ -29,6 +29,7 @@
#define LOG_TAG "AVUtils"
#include <utils/Log.h>
+#include <utils/StrongPointer.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AMessage.h>
@@ -49,6 +50,9 @@
#endif
#endif
+#include <binder/IPCThreadState.h>
+#include <camera/CameraParameters.h>
+
#include "common/ExtensionsLoader.hpp"
#include "stagefright/AVExtensions.h"
@@ -966,12 +970,42 @@ void AVUtils::HEVCMuxer::getHEVCCodecSpecificDataFromInputFormatIfPossible(
}
}
-bool AVUtils::isAudioMuxFormatSupported(const char *) {
- return true;
+bool AVUtils::isAudioMuxFormatSupported(const char * mime) {
+ if (mime == NULL) {
+ ALOGE("NULL audio mime type");
+ return false;
+ }
+
+ if (!strcasecmp(MEDIA_MIMETYPE_AUDIO_AMR_NB, mime)
+ || !strcasecmp(MEDIA_MIMETYPE_AUDIO_AMR_WB, mime)
+ || !strcasecmp(MEDIA_MIMETYPE_AUDIO_AAC, mime)) {
+ return true;
+ }
+ return false;
}
-void AVUtils::cacheCaptureBuffers(sp<ICamera>, video_encoder) {
- return;
+void AVUtils::cacheCaptureBuffers(sp<ICamera> camera, video_encoder encoder) {
+ if (camera != NULL) {
+ char mDeviceName[PROPERTY_VALUE_MAX];
+ property_get("ro.board.platform", mDeviceName, "0");
+ if (!strncmp(mDeviceName, "msm8909", 7)) {
+ int64_t token = IPCThreadState::self()->clearCallingIdentity();
+ String8 s = camera->getParameters();
+ CameraParameters params(s);
+ const char *enable;
+ if (encoder == VIDEO_ENCODER_H263 ||
+ encoder == VIDEO_ENCODER_MPEG_4_SP) {
+ enable = "1";
+ } else {
+ enable = "0";
+ }
+ params.set("cache-video-buffers", enable);
+ if (camera->setParameters(params.flatten()) != OK) {
+ ALOGE("Failed to enabled cached camera buffers");
+ }
+ IPCThreadState::self()->restoreCallingIdentity(token);
+ }
+ }
}
const char *AVUtils::getCustomCodecsLocation() {