From 53dfee381409bd3dfe640a8376794fca359060d2 Mon Sep 17 00:00:00 2001 From: 5schatten Date: Mon, 1 Jul 2019 22:07:12 +0200 Subject: [PATCH] Amlogic/Kodi: updated patches for K18.3 --- .../Amlogic/patches/kodi/kodi-PR16313.patch | 72 +++++++++++++++++++ ...etto.patch => kodi-drmprime-seeking.patch} | 34 ++++----- 2 files changed, 85 insertions(+), 21 deletions(-) create mode 100644 projects/Amlogic/patches/kodi/kodi-PR16313.patch rename projects/Amlogic/patches/kodi/{kodi-drmprime-ghetto.patch => kodi-drmprime-seeking.patch} (60%) diff --git a/projects/Amlogic/patches/kodi/kodi-PR16313.patch b/projects/Amlogic/patches/kodi/kodi-PR16313.patch new file mode 100644 index 0000000000..75d6e5bd37 --- /dev/null +++ b/projects/Amlogic/patches/kodi/kodi-PR16313.patch @@ -0,0 +1,72 @@ +From 9da95fb8a3c57fd7b8963f561a05d836edc2b601 Mon Sep 17 00:00:00 2001 +From: Stefan Sichler +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(realloc(m_planeBuffer, planeSize)); ++ m_planeBufferSize = planeSize; ++ } ++ + unsigned char *src(static_cast(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(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}; + diff --git a/projects/Amlogic/patches/kodi/kodi-drmprime-ghetto.patch b/projects/Amlogic/patches/kodi/kodi-drmprime-seeking.patch similarity index 60% rename from projects/Amlogic/patches/kodi/kodi-drmprime-ghetto.patch rename to projects/Amlogic/patches/kodi/kodi-drmprime-seeking.patch index 1b6a8fc485..bf58d241e0 100644 --- a/projects/Amlogic/patches/kodi/kodi-drmprime-ghetto.patch +++ b/projects/Amlogic/patches/kodi/kodi-drmprime-seeking.patch @@ -1,9 +1,7 @@ -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp -index e04c3c6ff6..dcf97af4ef 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp -@@ -156,7 +156,7 @@ void CVideoBufferPoolDRMPRIME::Return(int id) - //------------------------------------------------------------------------------ +--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp 2019-06-14 04:29:43.569698373 +0000 ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp 2019-06-14 04:33:21.357709602 +0000 +@@ -26,7 +26,7 @@ extern "C" { + using namespace KODI::WINDOWING::GBM; CDVDVideoCodecDRMPRIME::CDVDVideoCodecDRMPRIME(CProcessInfo& processInfo) - : CDVDVideoCodec(processInfo) @@ -11,7 +9,7 @@ index e04c3c6ff6..dcf97af4ef 100644 { m_pFrame = av_frame_alloc(); m_videoBufferPool = std::make_shared(); -@@ -406,6 +406,20 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo +@@ -281,6 +281,20 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecD return VC_ERROR; } @@ -32,21 +30,17 @@ index e04c3c6ff6..dcf97af4ef 100644 if (pVideoPicture->videoBuffer) pVideoPicture->videoBuffer->Release(); pVideoPicture->videoBuffer = nullptr; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h -index ffcdf1a7b6..4455280e38 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h -@@ -79,4 +79,6 @@ protected: +--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h 2019-06-14 04:35:37.981723614 +0000 ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h 2019-06-14 04:35:30.437722730 +0000 +@@ -42,4 +42,6 @@ protected: AVCodecContext* m_pCodecContext = nullptr; AVFrame* m_pFrame = nullptr; - std::shared_ptr m_videoBufferPool; + std::shared_ptr m_videoBufferPool; + int64_t m_prevTime; + bool m_seeking; }; -diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp -index e8d9023a9f..4299894c00 100644 ---- 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 ++++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp 2019-06-14 04:37:34.214037038 +0000 @@ -635,6 +635,13 @@ bool CProcessInfo::GetVideoRender() 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) { CSingleLock lock(m_stateSection); -diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.h b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h -index e8042c2bc2..5b4aea9b9d 100644 ---- 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 ++++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h 2019-06-14 04:38:50.698426382 +0000 @@ -101,6 +101,7 @@ public: bool GetGuiRender(); void SetVideoRender(bool video);