diff options
author | Chong Zhang <chz@google.com> | 2014-03-13 23:57:22 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-13 23:57:22 +0000 |
commit | 43d3f40b389904a2bdf4fd4ef8e8b914cf5a4b67 (patch) | |
tree | d0cdb2e78b6b541f0f1c7c75233be99d881923bb /media/libstagefright/omx | |
parent | 29c291f2337561b1f8c2f79bc34339b0b9c28b9c (diff) | |
parent | bd77a1b5115d355eb1e2bc270fe9aa4ceb3d8e65 (diff) | |
download | frameworks_av-43d3f40b389904a2bdf4fd4ef8e8b914cf5a4b67.zip frameworks_av-43d3f40b389904a2bdf4fd4ef8e8b914cf5a4b67.tar.gz frameworks_av-43d3f40b389904a2bdf4fd4ef8e8b914cf5a4b67.tar.bz2 |
am bd77a1b5: am cf49a51f: fix codec buffer leak in error handling when timestamp goes backward
* commit 'bd77a1b5115d355eb1e2bc270fe9aa4ceb3d8e65':
fix codec buffer leak in error handling when timestamp goes backward
Diffstat (limited to 'media/libstagefright/omx')
-rw-r--r-- | media/libstagefright/omx/GraphicBufferSource.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/media/libstagefright/omx/GraphicBufferSource.cpp b/media/libstagefright/omx/GraphicBufferSource.cpp index 20fa7ce..44f0be7 100644 --- a/media/libstagefright/omx/GraphicBufferSource.cpp +++ b/media/libstagefright/omx/GraphicBufferSource.cpp @@ -562,7 +562,7 @@ int64_t GraphicBufferSource::getTimestamp(const BufferQueue::BufferItem &item) { if (originalTimeUs < mPrevOriginalTimeUs) { // Drop the frame if it's going backward in time. Bad timestamp // could disrupt encoder's rate control completely. - ALOGV("Dropping frame that's going backward in time"); + ALOGW("Dropping frame that's going backward in time"); return -1; } int64_t timestampGapUs = originalTimeUs - mPrevOriginalTimeUs; @@ -581,6 +581,12 @@ int64_t GraphicBufferSource::getTimestamp(const BufferQueue::BufferItem &item) { status_t GraphicBufferSource::submitBuffer_l( const BufferQueue::BufferItem &item, int cbi) { ALOGV("submitBuffer_l cbi=%d", cbi); + + int64_t timeUs = getTimestamp(item); + if (timeUs < 0ll) { + return UNKNOWN_ERROR; + } + CodecBuffer& codecBuffer(mCodecBuffers.editItemAt(cbi)); codecBuffer.mGraphicBuffer = mBufferSlot[item.mBuf]; codecBuffer.mBuf = item.mBuf; @@ -594,12 +600,6 @@ status_t GraphicBufferSource::submitBuffer_l( memcpy(data, &type, 4); memcpy(data + 4, &handle, sizeof(buffer_handle_t)); - int64_t timeUs = getTimestamp(item); - if (timeUs < 0ll) { - ALOGE("Dropping frame with bad timestamp"); - return UNKNOWN_ERROR; - } - status_t err = mNodeInstance->emptyDirectBuffer(header, 0, 4 + sizeof(buffer_handle_t), OMX_BUFFERFLAG_ENDOFFRAME, timeUs); |