Amlogic/Kodi: updated patches for K18.3

This commit is contained in:
5schatten 2019-07-01 22:07:12 +02:00 committed by MilhouseVH
parent e60e306861
commit 53dfee3814
2 changed files with 85 additions and 21 deletions

View File

@ -0,0 +1,72 @@
From 9da95fb8a3c57fd7b8963f561a05d836edc2b601 Mon Sep 17 00:00:00 2001
From: Stefan Sichler <stsichler@web.de>
Date: Thu, 27 Jun 2019 09:07:12 +0200
Subject: [PATCH] LinuxRendererGLES: fixed memory leak, fixed segfault when
NV12 textures are in use, when (stride != width*bps) and GL_UNPACK_ROW_LENGTH
is not available
---
.../VideoRenderers/LinuxRendererGLES.cpp | 17 +++++++++++------
.../VideoRenderers/LinuxRendererGLES.h | 1 +
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp
index 39e3866face4..c524a2ff6970 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp
@@ -289,11 +289,18 @@ void CLinuxRendererGLES::LoadPlane(CYuvPlane& plane, int type,
}
else
{
+ size_t planeSize = width * height * bps;
+ if (m_planeBufferSize < planeSize)
+ {
+ m_planeBuffer = static_cast<unsigned char*>(realloc(m_planeBuffer, planeSize));
+ m_planeBufferSize = planeSize;
+ }
+
unsigned char *src(static_cast<unsigned char*>(data)),
*dst(m_planeBuffer);
- for (unsigned int y = 0; y < height; ++y, src += stride, dst += width * bpp)
- memcpy(dst, src, width * bpp);
+ for (unsigned int y = 0; y < height; ++y, src += stride, dst += width * bps)
+ memcpy(dst, src, width * bps);
pixelData = m_planeBuffer;
}
@@ -1292,11 +1299,9 @@ bool CLinuxRendererGLES::CreateYV12Texture(int index)
im.planesize[1] = im.stride[1] * (im.height >> im.cshift_y);
im.planesize[2] = im.stride[2] * (im.height >> im.cshift_y);
- m_planeBuffer = static_cast<unsigned char*>(realloc(m_planeBuffer, m_sourceHeight * m_sourceWidth * im.bpp));
-
for (int i = 0; i < 3; i++)
{
- im.plane[i] = new uint8_t[im.planesize[i]];
+ im.plane[i] = nullptr; // will be set in UploadTexture()
}
for(int f = 0; f < MAX_FIELDS; f++)
@@ -1459,7 +1464,7 @@ bool CLinuxRendererGLES::CreateNV12Texture(int index)
for (int i = 0; i < 2; i++)
{
- im.plane[i] = new uint8_t[im.planesize[i]];
+ im.plane[i] = nullptr; // will be set in UploadTexture()
}
for(int f = 0; f < MAX_FIELDS; f++)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h
index b0f53705d20e..ecb4a9f8c72c 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h
@@ -203,6 +203,7 @@ class CLinuxRendererGLES : public CBaseRenderer
AVColorPrimaries m_srcPrimaries;
bool m_toneMap = false;
unsigned char* m_planeBuffer = nullptr;
+ size_t m_planeBufferSize = 0;
// clear colour for "black" bars
float m_clearColour{0.0f};

View File

@ -1,9 +1,7 @@
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp 2019-06-14 04:29:43.569698373 +0000
index e04c3c6ff6..dcf97af4ef 100644 +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp 2019-06-14 04:33:21.357709602 +0000
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp @@ -26,7 +26,7 @@ extern "C" {
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp using namespace KODI::WINDOWING::GBM;
@@ -156,7 +156,7 @@ void CVideoBufferPoolDRMPRIME::Return(int id)
//------------------------------------------------------------------------------
CDVDVideoCodecDRMPRIME::CDVDVideoCodecDRMPRIME(CProcessInfo& processInfo) CDVDVideoCodecDRMPRIME::CDVDVideoCodecDRMPRIME(CProcessInfo& processInfo)
- : CDVDVideoCodec(processInfo) - : CDVDVideoCodec(processInfo)
@ -11,7 +9,7 @@ index e04c3c6ff6..dcf97af4ef 100644
{ {
m_pFrame = av_frame_alloc(); m_pFrame = av_frame_alloc();
m_videoBufferPool = std::make_shared<CVideoBufferPoolDRMPRIME>(); m_videoBufferPool = std::make_shared<CVideoBufferPoolDRMPRIME>();
@@ -406,6 +406,20 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo @@ -281,6 +281,20 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecD
return VC_ERROR; return VC_ERROR;
} }
@ -32,21 +30,17 @@ index e04c3c6ff6..dcf97af4ef 100644
if (pVideoPicture->videoBuffer) if (pVideoPicture->videoBuffer)
pVideoPicture->videoBuffer->Release(); pVideoPicture->videoBuffer->Release();
pVideoPicture->videoBuffer = nullptr; pVideoPicture->videoBuffer = nullptr;
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h 2019-06-14 04:35:37.981723614 +0000
index ffcdf1a7b6..4455280e38 100644 +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h 2019-06-14 04:35:30.437722730 +0000
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h @@ -42,4 +42,6 @@ protected:
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
@@ -79,4 +79,6 @@ protected:
AVCodecContext* m_pCodecContext = nullptr; AVCodecContext* m_pCodecContext = nullptr;
AVFrame* m_pFrame = nullptr; AVFrame* m_pFrame = nullptr;
std::shared_ptr<CVideoBufferPoolDRMPRIME> m_videoBufferPool; std::shared_ptr<IVideoBufferPool> m_videoBufferPool;
+ int64_t m_prevTime; + int64_t m_prevTime;
+ bool m_seeking; + bool m_seeking;
}; };
diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp --- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp 2019-04-13 17:57:10.000000000 +0000
index e8d9023a9f..4299894c00 100644 +++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp 2019-06-14 04:37:34.214037038 +0000
--- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
+++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
@@ -635,6 +635,13 @@ bool CProcessInfo::GetVideoRender() @@ -635,6 +635,13 @@ bool CProcessInfo::GetVideoRender()
return m_renderVideoLayer; return m_renderVideoLayer;
} }
@ -61,10 +55,8 @@ index e8d9023a9f..4299894c00 100644
void CProcessInfo::SetPlayTimes(time_t start, int64_t current, int64_t min, int64_t max) void CProcessInfo::SetPlayTimes(time_t start, int64_t current, int64_t min, int64_t max)
{ {
CSingleLock lock(m_stateSection); CSingleLock lock(m_stateSection);
diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.h b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h --- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.h 2019-04-13 17:57:10.000000000 +0000
index e8042c2bc2..5b4aea9b9d 100644 +++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h 2019-06-14 04:38:50.698426382 +0000
--- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
+++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
@@ -101,6 +101,7 @@ public: @@ -101,6 +101,7 @@ public:
bool GetGuiRender(); bool GetGuiRender();
void SetVideoRender(bool video); void SetVideoRender(bool video);