diff options
author | Lajos Molnar <lajos@google.com> | 2014-03-28 01:45:11 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-28 01:45:11 +0000 |
commit | 1000d426bedb1ec38bdfff98fc8f004b64af13cb (patch) | |
tree | 97d6e219016a2ab6613ee979f3b0648274f0f2a6 /media/libstagefright/OMXCodec.cpp | |
parent | 8bf96c011ff4128f9bf06b892a38d869192d6a25 (diff) | |
parent | f780d28de2e3cf7f6b26b9626321dba75719736e (diff) | |
download | frameworks_av-1000d426bedb1ec38bdfff98fc8f004b64af13cb.zip frameworks_av-1000d426bedb1ec38bdfff98fc8f004b64af13cb.tar.gz frameworks_av-1000d426bedb1ec38bdfff98fc8f004b64af13cb.tar.bz2 |
am f780d28d: Merge "DO NOT MERGE: Revert "mediaplayer: keep more buffers with the BufferQueue"" into klp-dev
* commit 'f780d28de2e3cf7f6b26b9626321dba75719736e':
DO NOT MERGE: Revert "mediaplayer: keep more buffers with the BufferQueue"
Diffstat (limited to 'media/libstagefright/OMXCodec.cpp')
-rw-r--r-- | media/libstagefright/OMXCodec.cpp | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 4c460bd..625922f 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -94,7 +94,6 @@ static sp<MediaSource> InstantiateSoftwareEncoder( #define CODEC_LOGI(x, ...) ALOGI("[%s] "x, mComponentName, ##__VA_ARGS__) #define CODEC_LOGV(x, ...) ALOGV("[%s] "x, mComponentName, ##__VA_ARGS__) -#define CODEC_LOGW(x, ...) ALOGW("[%s] "x, mComponentName, ##__VA_ARGS__) #define CODEC_LOGE(x, ...) ALOGE("[%s] "x, mComponentName, ##__VA_ARGS__) struct OMXCodecObserver : public BnOMXObserver { @@ -1795,40 +1794,21 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() { strerror(-err), -err); return err; } - // FIXME: assume that surface is controlled by app (native window - // returns the number for the case when surface is not controlled by app) - minUndequeuedBufs++; - - // Use conservative allocation while also trying to reduce starvation - // - // 1. allocate at least nBufferCountMin + minUndequeuedBuffers - that is the - // 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", - def.nBufferCountMin, def.nBufferCountActual, minUndequeuedBufs); - - for (OMX_U32 extraBuffers = 2; /* condition inside loop */; extraBuffers--) { - OMX_U32 newBufferCount = - def.nBufferCountMin + minUndequeuedBufs + extraBuffers; + + // XXX: Is this the right logic to use? It's not clear to me what the OMX + // buffer counts refer to - how do they account for the renderer holding on + // to buffers? + if (def.nBufferCountActual < def.nBufferCountMin + minUndequeuedBufs) { + OMX_U32 newBufferCount = def.nBufferCountMin + minUndequeuedBufs; def.nBufferCountActual = newBufferCount; err = mOMX->setParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); - - if (err == OK) { - minUndequeuedBufs += extraBuffers; - break; - } - - CODEC_LOGW("setting nBufferCountActual to %lu failed: %d", - newBufferCount, err); - /* exit condition */ - if (extraBuffers == 0) { + if (err != OK) { + CODEC_LOGE("setting nBufferCountActual to %lu failed: %d", + newBufferCount, err); return err; } } - CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d", - def.nBufferCountMin, def.nBufferCountActual, minUndequeuedBufs); err = native_window_set_buffer_count( mNativeWindow.get(), def.nBufferCountActual); |