OSDN Git Service

Reduce memory usage by some extractors.
authoryuedl1 <yuedl1@lenovo.com>
Mon, 13 Mar 2017 10:07:26 +0000 (18:07 +0800)
committerAndy Hung <hunga@google.com>
Tue, 18 Apr 2017 21:36:06 +0000 (14:36 -0700)
Occurs for some extractors that use shared memory without MediaBufferObserver.
Check with high resolution MKV.

Play a mkv file continuously and check file descriptor count.
adb shell lsof | grep mediae | wc
adb shell lsof | grep medias | wc

Test: Photos with mkv.
Bug: 36359517
Change-Id: I8719b628406a838ee091499347b219a8a4736a25
Signed-off-by: yuedl1 <yuedl1@lenovo.com>
media/libmedia/IMediaSource.cpp

index fdbc869..724b3a0 100644 (file)
@@ -389,7 +389,7 @@ status_t BnMediaSource::onTransact(
                     }
                 }
                 if (transferBuf != nullptr) { // Using shared buffers.
-                    if (!transferBuf->isObserved()) {
+                    if (!transferBuf->isObserved() && transferBuf != buf) {
                         // Transfer buffer must be part of a MediaBufferGroup.
                         ALOGV("adding shared memory buffer %p to local group", transferBuf);
                         mGroup->add_buffer(transferBuf);