libvideorender: CB1 video frame buffer leak [1/1]
PD#TV-123765
Problem:
video buffer memory leak happend when tsplayer send the same pts
of frame data, but realtime is not equal.
Solution:
using realtime to manage video buffer
Verify:
ap222
Change-Id: I0fed7fa8f9f6817a844ab384ac7f793582e0c10e
Signed-off-by: fei.deng <fei.deng@amlogic.com>
diff --git a/weston/wayland_buffer.cpp b/weston/wayland_buffer.cpp
index f75730a..27019b1 100644
--- a/weston/wayland_buffer.cpp
+++ b/weston/wayland_buffer.cpp
@@ -75,6 +75,7 @@
if (waylandBuffer->mRenderBuffer) {
waylandBuffer->mDisplay->handleBufferReleaseCallback(waylandBuffer);
waylandBuffer->mRenderBuffer = NULL;
+ waylandBuffer->mRealTime = -1;
}
}
diff --git a/weston/wayland_display.cpp b/weston/wayland_display.cpp
index fb3e635..882c441 100644
--- a/weston/wayland_display.cpp
+++ b/weston/wayland_display.cpp
@@ -1345,7 +1345,7 @@
wl_surface_damage (mVideoSurfaceWrapper, 0, 0, mVideoRect.w, mVideoRect.h);
wl_surface_commit (mVideoSurfaceWrapper);
//insert this buffer to committed weston buffer manager
- std::pair<int64_t, WaylandBuffer *> item(buf->pts, waylandBuf);
+ std::pair<int64_t, WaylandBuffer *> item(realDisplayTime, waylandBuf);
mCommittedBufferMap.insert(item);
} else {
WARNING(mLogCategory,"wlbuffer is NULL");
@@ -1377,7 +1377,7 @@
Tls::Mutex::Autolock _l(mRenderMutex);
//remove buffer if this buffer is ready to release
RenderBuffer *renderBuffer = buf->getRenderBuffer();
- auto item = mCommittedBufferMap.find(renderBuffer->pts);
+ auto item = mCommittedBufferMap.find(buf->getRenderRealTime());
if (item != mCommittedBufferMap.end()) {
--mCommitCnt;
mCommittedBufferMap.erase(item);
diff --git a/weston/wayland_plugin.cpp b/weston/wayland_plugin.cpp
index 2a91053..96d2aa3 100644
--- a/weston/wayland_plugin.cpp
+++ b/weston/wayland_plugin.cpp
@@ -133,6 +133,7 @@
mQueue->push(buffer);
DEBUG(mLogCategory,"queue size:%d,pts:%lld us",mQueue->getCnt(),buffer->pts/1000);
} else {
+ buffer->time = displayTime;
mDisplay->displayFrameBuffer(buffer, displayTime);
}
return NO_ERROR;