summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2016-03-18 02:08:46 +0100
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2016-03-18 02:08:46 +0100
commit185e2110a53feb7720d91b6f8366ad27402f21cc (patch)
treea265317b5846eec34d7c87b494ede81857e6c2d3 /media/libstagefright/ACodec.cpp
parentd4590dda7776ec99e4e879c47b3372a5f4b13dcd (diff)
parent8c2e9d8867ccaba1a617f133b37103e2ac77e871 (diff)
downloadframeworks_av-185e2110a53feb7720d91b6f8366ad27402f21cc.zip
frameworks_av-185e2110a53feb7720d91b6f8366ad27402f21cc.tar.gz
frameworks_av-185e2110a53feb7720d91b6f8366ad27402f21cc.tar.bz2
Merge branch 'cm-13.0' of https://github.com/CyanogenMod/android_frameworks_av into replicant-6.0
Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 4807b65..b83d6c6 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -767,7 +767,8 @@ status_t ACodec::handleSetSurface(const sp<Surface> &surface) {
}
// push blank buffers to previous window if requested
- if (mFlags & kFlagPushBlankBuffersToNativeWindowOnShutdown) {
+ if (mFlags & kFlagPushBlankBuffersToNativeWindowOnShutdown ||
+ mFlags & kFlagPushBlankBuffersToNativeWindowOnSwitch) {
pushBlankBuffersToNativeWindow(mNativeWindow.get());
}
@@ -925,10 +926,24 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage(
#endif
ALOGV("gralloc usage: %#x(OMX) => %#x(ACodec)", omxUsage, usage);
+ int32_t width = 0, height = 0;
+ int32_t isAdaptivePlayback = 0;
+
+ if (mInputFormat->findInt32("adaptive-playback", &isAdaptivePlayback)
+ && isAdaptivePlayback
+ && mInputFormat->findInt32("max-width", &width)
+ && mInputFormat->findInt32("max-height", &height)) {
+ width = max(width, (int32_t)def.format.video.nFrameWidth);
+ height = max(height, (int32_t)def.format.video.nFrameHeight);
+ ALOGV("Adaptive playback width = %d, height = %d", width, height);
+ } else {
+ width = def.format.video.nFrameWidth;
+ height = def.format.video.nFrameHeight;
+ }
err = setNativeWindowSizeFormatAndUsage(
nativeWindow,
- def.format.video.nFrameWidth,
- def.format.video.nFrameHeight,
+ width,
+ height,
#ifdef USE_SAMSUNG_COLORFORMAT
eNativeColorFormat,
#else
@@ -1969,6 +1984,12 @@ status_t ACodec::configureCodec(
&& push != 0) {
mFlags |= kFlagPushBlankBuffersToNativeWindowOnShutdown;
}
+
+ int32_t val;
+ if (msg->findInt32("push-blank-buffers-on-switch", &val)
+ && val != 0) {
+ mFlags |= kFlagPushBlankBuffersToNativeWindowOnSwitch;
+ }
}
int32_t rotationDegrees;
@@ -6760,6 +6781,11 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent(
mCodec->mNode, OMX_CommandPortEnable, kPortIndexOutput);
}
+ /* Clear the RenderQueue in which queued GraphicBuffers hold the
+ * actual buffer references in order to free them early.
+ */
+ mCodec->mRenderTracker.clear(systemTime(CLOCK_MONOTONIC));
+
if (err == OK) {
err = mCodec->allocateBuffersOnPort(kPortIndexOutput);
ALOGE_IF(err != OK, "Failed to allocate output port buffers after port "