summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
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 "