summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorMichael Gernoth <michael@gernoth.net>2014-11-24 21:25:28 +0100
committerSteve Kondik <shade@chemlab.org>2015-11-07 01:24:14 -0800
commit6652c2586368bfaf14799b06be4eb91d5d21fed9 (patch)
tree901deeb77f976f081d4ef419f4041e775d0d3803 /media/libstagefright/ACodec.cpp
parent6b33144d873c32afb456028416939d096e88b186 (diff)
downloadframeworks_av-6652c2586368bfaf14799b06be4eb91d5d21fed9.zip
frameworks_av-6652c2586368bfaf14799b06be4eb91d5d21fed9.tar.gz
frameworks_av-6652c2586368bfaf14799b06be4eb91d5d21fed9.tar.bz2
libstagefright: Make it possible to skip OMX buffer reallocation
Some devices don't like the call to setParameter() at this point, so skip this call if enough buffers are already allocated. This check was present in KitKat but got removed when code to allocate extra- buffers was introduced. This is activated only for omap4 for now. Squashed 2nd commit: which does same for OMXCodec.cpp Change-Id: I9c1267c2a2a755bc16448a6049cb2e4aff0b65bb
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 9548db0..ebe8046 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -983,6 +983,12 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
// 2. try to allocate two (2) additional buffers to reduce starvation from
// the consumer
// plus an extra buffer to account for incorrect minUndequeuedBufs
+#ifdef BOARD_CANT_REALLOCATE_OMX_BUFFERS
+ // Some devices don't like to set OMX_IndexParamPortDefinition at this
+ // point (even with an unmodified def), so skip it if possible.
+ // This check was present in KitKat.
+ if (def.nBufferCountActual < def.nBufferCountMin + *minUndequeuedBuffers) {
+#endif
for (OMX_U32 extraBuffers = 2 + 1; /* condition inside loop */; extraBuffers--) {
OMX_U32 newBufferCount =
def.nBufferCountMin + *minUndequeuedBuffers + extraBuffers;
@@ -1002,6 +1008,9 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
return err;
}
}
+#ifdef BOARD_CANT_REALLOCATE_OMX_BUFFERS
+ }
+#endif
err = native_window_set_buffer_count(
mNativeWindow.get(), def.nBufferCountActual);