summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-03-19 19:56:11 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-19 19:56:11 +0000
commitf4d9d45ebad478091d65b2a4c18544d308d3fff0 (patch)
tree2ac6ef3ce00d28d42f0c8262c83b7c5e4e3eec9f /media/libstagefright
parent4647dba9afd0b365e47b9493a680d71b59a361e6 (diff)
parent1faa41704e0b976e546321effcb09a85767d51ba (diff)
downloadframeworks_av-f4d9d45ebad478091d65b2a4c18544d308d3fff0.zip
frameworks_av-f4d9d45ebad478091d65b2a4c18544d308d3fff0.tar.gz
frameworks_av-f4d9d45ebad478091d65b2a4c18544d308d3fff0.tar.bz2
am 1faa4170: stagefright: allow for minUndequeuedBufs to be one less
* commit '1faa41704e0b976e546321effcb09a85767d51ba': stagefright: allow for minUndequeuedBufs to be one less
Diffstat (limited to 'media/libstagefright')
-rw-r--r--media/libstagefright/ACodec.cpp7
-rw-r--r--media/libstagefright/OMXCodec.cpp10
2 files changed, 10 insertions, 7 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index c117ccc..6e36bbf 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -640,8 +640,8 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
// FIXME: assume that surface is controlled by app (native window
// returns the number for the case when surface is not controlled by app)
- (*minUndequeuedBuffers)++;
-
+ // FIXME2: This means that minUndeqeueudBufs can be 1 larger than reported
+ // For now, try to allocate 1 more buffer, but don't fail if unsuccessful
// Use conservative allocation while also trying to reduce starvation
//
@@ -649,7 +649,8 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
// minimum needed for the consumer to be able to work
// 2. try to allocate two (2) additional buffers to reduce starvation from
// the consumer
- for (OMX_U32 extraBuffers = 2; /* condition inside loop */; extraBuffers--) {
+ // plus an extra buffer to account for incorrect minUndequeuedBufs
+ for (OMX_U32 extraBuffers = 2 + 1; /* condition inside loop */; extraBuffers--) {
OMX_U32 newBufferCount =
def.nBufferCountMin + *minUndequeuedBuffers + extraBuffers;
def.nBufferCountActual = newBufferCount;
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 79a9665..070e438 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1780,7 +1780,8 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
}
// FIXME: assume that surface is controlled by app (native window
// returns the number for the case when surface is not controlled by app)
- minUndequeuedBufs++;
+ // FIXME2: This means that minUndeqeueudBufs can be 1 larger than reported
+ // For now, try to allocate 1 more buffer, but don't fail if unsuccessful
// Use conservative allocation while also trying to reduce starvation
//
@@ -1788,10 +1789,11 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
// minimum needed for the consumer to be able to work
// 2. try to allocate two (2) additional buffers to reduce starvation from
// the consumer
- CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d",
+ // plus an extra buffer to account for incorrect minUndequeuedBufs
+ CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d+1",
def.nBufferCountMin, def.nBufferCountActual, minUndequeuedBufs);
- for (OMX_U32 extraBuffers = 2; /* condition inside loop */; extraBuffers--) {
+ for (OMX_U32 extraBuffers = 2 + 1; /* condition inside loop */; extraBuffers--) {
OMX_U32 newBufferCount =
def.nBufferCountMin + minUndequeuedBufs + extraBuffers;
def.nBufferCountActual = newBufferCount;
@@ -1810,7 +1812,7 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
return err;
}
}
- CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d",
+ CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d+1",
def.nBufferCountMin, def.nBufferCountActual, minUndequeuedBufs);
err = native_window_set_buffer_count(