From ca04d5f1b74639bc2db1e371abbf0182fc431828 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 13 Dec 2023 17:45:56 +0000 Subject: gentoo auto-resync : 13:12:2023 - 17:45:55 --- media-libs/openh264/Manifest | 3 + ...64-2.4.0-fix-off-by-one-decode-regression.patch | 26 ++ .../openh264-2.4.0-unordered-frame-glitches.patch | 264 +++++++++++++++++++++ media-libs/openh264/openh264-2.4.0-r1.ebuild | 136 +++++++++++ 4 files changed, 429 insertions(+) create mode 100644 media-libs/openh264/files/openh264-2.4.0-fix-off-by-one-decode-regression.patch create mode 100644 media-libs/openh264/files/openh264-2.4.0-unordered-frame-glitches.patch create mode 100644 media-libs/openh264/openh264-2.4.0-r1.ebuild (limited to 'media-libs/openh264') diff --git a/media-libs/openh264/Manifest b/media-libs/openh264/Manifest index 3bd1e5d0ddee..9f5b68eea32e 100644 --- a/media-libs/openh264/Manifest +++ b/media-libs/openh264/Manifest @@ -1,8 +1,11 @@ AUX openh264-2.3.0-pkgconfig-pathfix.patch 2023 BLAKE2B 9d380302efe14b45959123f69591aed9f552a954dd9f2f079ba1dc95edfc59869db9ece0ea65d52e58201829e0e4bb791f0380b36b35d288b40769c1c144005e SHA512 24fb7e1bf54d5c1512dab9f5b6cbd61863022d99a1a5d07d5a69037ad3b3857f2ac01fdfae4a1477f1b200c8a4b107247fb9f46af1219e71220e55167f1620ec AUX openh264-2.3.1-pr3630.patch 5566 BLAKE2B 06e6ff75ccbcb287413752283d3b192ccd9ff6172bf2245f28eb219b3c8384f900a54e0d0992589b234e14080dfcdc3c026635ba6070597197f93e8514a77fd8 SHA512 7acc909c8d78e8b9cb366d822b970d4e164d40e0224fe3a07d7750b3b7c3a30ac40afc1bbaac4844d6fbdb6c144830004b12dc3bd64d2574338cebea952648a0 +AUX openh264-2.4.0-fix-off-by-one-decode-regression.patch 1269 BLAKE2B 1b7e87e6e1a52e6a69c247a1c534e0e43f71a9037dc54f6e109decbf91b8e2e29f00479e12eeb4e134eef9f7b00a321a9a920770a44c85944515c6cfaf365107 SHA512 a1bcd6ead4f0b30130232d2936101a5b299849411df478d6b7805ae3f3e046ac6485662372dd4014f5de3e7f9ecd4d7754c8446e9ade17869ae0f67aa97c593a +AUX openh264-2.4.0-unordered-frame-glitches.patch 11895 BLAKE2B 3779c770b04ef44c8b57a21dd9c7ac1292de633f57a0ee41498fdff12b9cb9a38d7fdb2f55f4eb6ff72ce9e9cbd38669ebdc7b83722bac483ecacc274a8bb54c SHA512 2771c6a783184f7dcf17f9604d0a62ae153c7e9bcb11e2b2af09e064607627c87c6524a8a8f772be8bc3730957a8c3dd5760e8c373d1f20b2470a7154eb2267b DIST gmp-api-Firefox114_2-e7d30b921df736a1121a0c8e0cf3ab1ce5b8a4b7.tar.gz 10915 BLAKE2B aa4b82baebbd990d94f381be4516e8780f6bc3a2104c4b899f091a9e6ec91dff9788ee6ef548d3bc07c7bf50f56347c44d01e51805f96cf9b59494889a5f7b61 SHA512 f1c75007d4f1e1ef3a11b8eb9c703935408a5e4051c8eab408e4edc09f265a71f172025269442fdab9d4c2a8b108fa69397bfbd84af4ecda22881b50de804de9 DIST openh264-2.3.1.tar.gz 60290897 BLAKE2B b4480150cfe7c44b89c7b294698db06f93d96f5f9f3ef4345108c4e360e99bc6133407cead54e720e6e74aa17ab9f2e4342287a42f19463a54eb44c9d3141c80 SHA512 fd59c767794cdfb934d692d5929e4500d78606cbf1e403bc7c7dce048cc07e40daa0794357adb856d29479427a53460c76338e156b6bbeaa36139afcd603c8e1 DIST openh264-2.4.0.tar.gz 60297968 BLAKE2B d725896979e8178277e304ac0d94e59f0971a7f0f443f6dee0abffbadc53cce8ba7fe6612a966c697296bf46c3035bd03ac9a65e63d6d87853317b178b06a236 SHA512 dc66986e84ad328e1615384e7bff93d6eaac42a68e87d9c9b59f55d9f90efd13dc87637a7e3b8c9694634dfa82351c5944828f3f478286608e362e014dd70ca1 EBUILD openh264-2.3.1-r3.ebuild 3949 BLAKE2B 68b79ae51de85dc5c4c19fe2f1d5460ce8d0a076e3201d68cafbe0155d9c2d49f127919e30b1d16ce6dc8b0b2359bcdbf8d586c42c95cef2b77afc072fb4f91b SHA512 50aec0bab131871d007a1915c5305b76ea3e1c1f91741ab3596d05a6ac8b0269e57243e4b0ed2a56464c5ddce8a95916a4f8035a1bf5440c4dab75ea09e404fb +EBUILD openh264-2.4.0-r1.ebuild 4085 BLAKE2B 85b0f43420199e8c134c52b3b14eee1b84519a0a669c8ed778f03293448e2eac7cfa202dc7c8f3a98db73aa20d9b873a5cf485dbb47ea4b56aac4eb6e771dff7 SHA512 6b34d3b78538fa419216cad8d5f4304ceeea7b0b2e5ff8723bb44fa8e29da999d0f37b89a089bcaba509dc4c53bbec42c52f1315ec6f9d800be9fb9470660aa3 EBUILD openh264-2.4.0.ebuild 3955 BLAKE2B 6c1bf0aeb775ea849951b3357debc87ecc80887db474b954ed2eb9cdc17e24f2145eded1aa45aa70844726f529b5680b57310a28c6f774c79ea197b89f703921 SHA512 7c91350363615cc9327d6deba0433d4326a8686303763ff2aef19d83e36913f2b68d19c6e9709257e2f770e26cd05ff442c7d7d4c019f4c0b0e346d48c96e09f MISC metadata.xml 627 BLAKE2B aa6bcd394a1b792f8d0fc89030f34df7f0366f049f52ee11a90af301ca901a07acfc1d34a0d6d237a7d713db53b707b3b9f08d3c86574d6067f6ff7e8cf99c3a SHA512 55a7a5ee5f716e9eb1e5711d45a93fe27f057b54240511de72ade7f88c53eeac72f1bf1b524d22278c0fafbea70e1b5892262ee1b97370d70a0258bad7220e30 diff --git a/media-libs/openh264/files/openh264-2.4.0-fix-off-by-one-decode-regression.patch b/media-libs/openh264/files/openh264-2.4.0-fix-off-by-one-decode-regression.patch new file mode 100644 index 000000000000..0ef8e3dc56f2 --- /dev/null +++ b/media-libs/openh264/files/openh264-2.4.0-fix-off-by-one-decode-regression.patch @@ -0,0 +1,26 @@ +From ff7cc30b59bea581b3a9455009cc0deb67fee98c Mon Sep 17 00:00:00 2001 +From: Kalev Lember +Date: Wed, 29 Nov 2023 13:40:53 +0100 +Subject: [PATCH] Fix off by one regression in decoder + +Fix iPicBuffIdx bounds check introduced in commit +986bd65b711191d4883c54ace32a9879e17729c2 and allow 0 as an index value. + +This fixes Big_Buck_Bunny_720_10s_30MB.mp4 playback with gst-play-1.0. +--- + codec/decoder/plus/src/welsDecoderExt.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/codec/decoder/plus/src/welsDecoderExt.cpp b/codec/decoder/plus/src/welsDecoderExt.cpp +index 170d17dec..457effb68 100644 +--- a/codec/decoder/plus/src/welsDecoderExt.cpp ++++ b/codec/decoder/plus/src/welsDecoderExt.cpp +@@ -1136,7 +1136,7 @@ void CWelsDecoder::ReleaseBufferedReadyPictureReorder (PWelsDecoderContext pCtx, + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPOC = IMinInt32; + int32_t iPicBuffIdx = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx; + if (pPicBuff != NULL) { +- if (iPicBuffIdx > 0 && iPicBuffIdx < pPicBuff->iCapacity) ++ if (iPicBuffIdx >= 0 && iPicBuffIdx < pPicBuff->iCapacity) + { + PPicture pPic = pPicBuff->ppPic[iPicBuffIdx]; + --pPic->iRefCount; diff --git a/media-libs/openh264/files/openh264-2.4.0-unordered-frame-glitches.patch b/media-libs/openh264/files/openh264-2.4.0-unordered-frame-glitches.patch new file mode 100644 index 000000000000..373fac95f940 --- /dev/null +++ b/media-libs/openh264/files/openh264-2.4.0-unordered-frame-glitches.patch @@ -0,0 +1,264 @@ +From 56d3ec4c7bfdc545a840512a8f2c72545889c538 Mon Sep 17 00:00:00 2001 +From: Takashi Yano +Date: Tue, 5 Dec 2023 21:48:40 +0900 +Subject: [PATCH 1/3] Add missing iLastWrittenPOC setting in unbuffered + reordering. + +In CWelsDecoder::ReorderPicturesInDisplay(), iLastWrittenPOC was +not set in unbuffered-reordering case. Due to this problem, it +sometimes reordered the frames incorrectly. This patch fixes the +issue. +--- + codec/decoder/plus/src/welsDecoderExt.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/codec/decoder/plus/src/welsDecoderExt.cpp b/codec/decoder/plus/src/welsDecoderExt.cpp +index 457effb68..a1b26c2cb 100644 +--- a/codec/decoder/plus/src/welsDecoderExt.cpp ++++ b/codec/decoder/plus/src/welsDecoderExt.cpp +@@ -1206,6 +1206,7 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay(PWelsDecoderContext pDecCo + if (pDstInfo->iBufferStatus == 1) { + if (m_sReoderingStatus.iLastGOPRemainPicts == 0 && pDecContext->pSliceHeader->eSliceType == B_SLICE && + pDecContext->pSliceHeader->iPicOrderCntLsb <= m_sReoderingStatus.iLastWrittenPOC + 2) { ++ m_sReoderingStatus.iLastWrittenPOC = pDecContext->pSliceHeader->iPicOrderCntLsb; + //issue #3478, use b-slice type to determine correct picture order as the first priority as POC order is not as reliable as based on b-slice + ppDst[0] = pDstInfo->pDst[0]; + ppDst[1] = pDstInfo->pDst[1]; + +From 10d0998a966dc98ba1a93122f214c2aef5bcd33f Mon Sep 17 00:00:00 2001 +From: Takashi Yano +Date: Wed, 6 Dec 2023 02:08:19 +0900 +Subject: [PATCH 2/3] Prevent frame buffer from overwrite at GOP change. + +When bNewSeqBegin got true, iRefCount was forcibly reset even if the +buffer was still used for reordering. Due to this problem, the buffer +in use was sometimes overwritten with newly decoded frame. This commit +is for fixing that problem. +--- + codec/decoder/core/src/manage_dec_ref.cpp | 37 ++++++++++++----------- + codec/decoder/plus/src/welsDecoderExt.cpp | 4 +++ + 2 files changed, 24 insertions(+), 17 deletions(-) + +diff --git a/codec/decoder/core/src/manage_dec_ref.cpp b/codec/decoder/core/src/manage_dec_ref.cpp +index 88099b60e..c3c983129 100644 +--- a/codec/decoder/core/src/manage_dec_ref.cpp ++++ b/codec/decoder/core/src/manage_dec_ref.cpp +@@ -66,8 +66,10 @@ int32_t GetLTRFrameIndex (PRefPic pRefPic, int32_t iAncLTRFrameNum); + #endif + static int32_t RemainOneBufferInDpbForEC (PWelsDecoderContext pCtx, PRefPic pRefPic); + +-static void SetUnRef (PPicture pRef) { +- if (NULL != pRef) { ++static void SetUnRef (PPicture pRef, bool bNewSeqBegin) { ++ if (pRef == NULL) return; ++ ++ if (pRef->iRefCount <= 0 && (!pRef->bUsedAsRef || bNewSeqBegin)) { + pRef->bUsedAsRef = false; + pRef->bIsLongRef = false; + pRef->iFrameNum = -1; +@@ -81,17 +83,18 @@ static void SetUnRef (PPicture pRef) { + pRef->iSpsId = -1; + pRef->bIsComplete = false; + pRef->iRefCount = 0; ++ } + +- if (pRef->eSliceType == I_SLICE) { +- return; +- } +- int32_t lists = pRef->eSliceType == P_SLICE ? 1 : 2; +- for (int32_t i = 0; i < MAX_DPB_COUNT; ++i) { +- for (int32_t list = 0; list < lists; ++list) { +- if (pRef->pRefPic[list][i] != NULL) { +- pRef->pRefPic[list][i]->iRefCount = 0; +- pRef->pRefPic[list][i] = NULL; +- } ++ if (pRef->eSliceType == I_SLICE) { ++ return; ++ } ++ int32_t lists = pRef->eSliceType == P_SLICE ? 1 : 2; ++ for (int32_t i = 0; i < MAX_DPB_COUNT; ++i) { ++ for (int32_t list = 0; list < lists; ++list) { ++ if (pRef->pRefPic[list][i] != NULL) { ++ if (pRef->pRefPic[list][i]->iRefCount > 0) continue; ++ pRef->pRefPic[list][i]->iRefCount = 0; ++ pRef->pRefPic[list][i] = NULL; + } + } + } +@@ -111,7 +114,7 @@ void WelsResetRefPic (PWelsDecoderContext pCtx) { + + for (i = 0; i < MAX_DPB_COUNT; i++) { + if (pRefPic->pShortRefList[LIST_0][i] != NULL) { +- SetUnRef (pRefPic->pShortRefList[LIST_0][i]); ++ SetUnRef (pRefPic->pShortRefList[LIST_0][i], pCtx->bNewSeqBegin); + pRefPic->pShortRefList[LIST_0][i] = NULL; + } + } +@@ -119,7 +122,7 @@ void WelsResetRefPic (PWelsDecoderContext pCtx) { + + for (i = 0; i < MAX_DPB_COUNT; i++) { + if (pRefPic->pLongRefList[LIST_0][i] != NULL) { +- SetUnRef (pRefPic->pLongRefList[LIST_0][i]); ++ SetUnRef (pRefPic->pLongRefList[LIST_0][i], pCtx->bNewSeqBegin); + pRefPic->pLongRefList[LIST_0][i] = NULL; + } + } +@@ -767,7 +770,7 @@ static int32_t SlidingWindow (PWelsDecoderContext pCtx, PRefPic pRefPic) { + for (i = pRefPic->uiShortRefCount[LIST_0] - 1; i >= 0; i--) { + pPic = WelsDelShortFromList (pRefPic, pRefPic->pShortRefList[LIST_0][i]->iFrameNum); + if (pPic) { +- SetUnRef (pPic); ++ SetUnRef (pPic, pCtx->bNewSeqBegin); + break; + } else { + return ERR_INFO_INVALID_MMCO_REF_NUM_OVERFLOW; +@@ -803,7 +806,7 @@ static PPicture WelsDelShortFromList (PRefPic pRefPic, int32_t iFrameNum) { + static PPicture WelsDelShortFromListSetUnref (PRefPic pRefPic, int32_t iFrameNum) { + PPicture pPic = WelsDelShortFromList (pRefPic, iFrameNum); + if (pPic) { +- SetUnRef (pPic); ++ SetUnRef (pPic, false); + } + return pPic; + } +@@ -832,7 +835,7 @@ static PPicture WelsDelLongFromList (PRefPic pRefPic, uint32_t uiLongTermFrameId + static PPicture WelsDelLongFromListSetUnref (PRefPic pRefPic, uint32_t uiLongTermFrameIdx) { + PPicture pPic = WelsDelLongFromList (pRefPic, uiLongTermFrameIdx); + if (pPic) { +- SetUnRef (pPic); ++ SetUnRef (pPic, false); + } + return pPic; + } +diff --git a/codec/decoder/plus/src/welsDecoderExt.cpp b/codec/decoder/plus/src/welsDecoderExt.cpp +index a1b26c2cb..14257afff 100644 +--- a/codec/decoder/plus/src/welsDecoderExt.cpp ++++ b/codec/decoder/plus/src/welsDecoderExt.cpp +@@ -1084,6 +1084,8 @@ void CWelsDecoder::ReleaseBufferedReadyPictureReorder (PWelsDecoderContext pCtx, + if (pPicBuff != NULL) { + PPicture pPic = pPicBuff->ppPic[m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx]; + --pPic->iRefCount; ++ if (m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP) ++ pPic->bUsedAsRef = false; + } + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP = false; + m_sReoderingStatus.iMinPOC = IMinInt32; +@@ -1187,6 +1189,8 @@ void CWelsDecoder::ReleaseBufferedReadyPictureNoReorder(PWelsDecoderContext pCtx + PPicBuff pPicBuff = pCtx ? pCtx->pPicBuff : m_pPicBuff; + PPicture pPic = pPicBuff->ppPic[m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx]; + --pPic->iRefCount; ++ if (m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP) ++ pPic->bUsedAsRef = false; + } + if (m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP) { + --m_sReoderingStatus.iLastGOPRemainPicts; + +From f82abc09a3e7d723e21a06ec7e5f38afc218357f Mon Sep 17 00:00:00 2001 +From: Takashi Yano +Date: Tue, 12 Dec 2023 19:23:32 +0900 +Subject: [PATCH 3/3] Fix test failure due to the issue of the previous commit. + +--- + codec/decoder/core/src/manage_dec_ref.cpp | 14 +++++++------- + codec/decoder/plus/src/welsDecoderExt.cpp | 9 +++++++-- + 2 files changed, 14 insertions(+), 9 deletions(-) + +diff --git a/codec/decoder/core/src/manage_dec_ref.cpp b/codec/decoder/core/src/manage_dec_ref.cpp +index c3c983129..410b9c47f 100644 +--- a/codec/decoder/core/src/manage_dec_ref.cpp ++++ b/codec/decoder/core/src/manage_dec_ref.cpp +@@ -66,10 +66,10 @@ int32_t GetLTRFrameIndex (PRefPic pRefPic, int32_t iAncLTRFrameNum); + #endif + static int32_t RemainOneBufferInDpbForEC (PWelsDecoderContext pCtx, PRefPic pRefPic); + +-static void SetUnRef (PPicture pRef, bool bNewSeqBegin) { ++static void SetUnRef (PPicture pRef) { + if (pRef == NULL) return; + +- if (pRef->iRefCount <= 0 && (!pRef->bUsedAsRef || bNewSeqBegin)) { ++ if (pRef->iRefCount <= 0) { + pRef->bUsedAsRef = false; + pRef->bIsLongRef = false; + pRef->iFrameNum = -1; +@@ -114,7 +114,7 @@ void WelsResetRefPic (PWelsDecoderContext pCtx) { + + for (i = 0; i < MAX_DPB_COUNT; i++) { + if (pRefPic->pShortRefList[LIST_0][i] != NULL) { +- SetUnRef (pRefPic->pShortRefList[LIST_0][i], pCtx->bNewSeqBegin); ++ SetUnRef (pRefPic->pShortRefList[LIST_0][i]); + pRefPic->pShortRefList[LIST_0][i] = NULL; + } + } +@@ -122,7 +122,7 @@ void WelsResetRefPic (PWelsDecoderContext pCtx) { + + for (i = 0; i < MAX_DPB_COUNT; i++) { + if (pRefPic->pLongRefList[LIST_0][i] != NULL) { +- SetUnRef (pRefPic->pLongRefList[LIST_0][i], pCtx->bNewSeqBegin); ++ SetUnRef (pRefPic->pLongRefList[LIST_0][i]); + pRefPic->pLongRefList[LIST_0][i] = NULL; + } + } +@@ -770,7 +770,7 @@ static int32_t SlidingWindow (PWelsDecoderContext pCtx, PRefPic pRefPic) { + for (i = pRefPic->uiShortRefCount[LIST_0] - 1; i >= 0; i--) { + pPic = WelsDelShortFromList (pRefPic, pRefPic->pShortRefList[LIST_0][i]->iFrameNum); + if (pPic) { +- SetUnRef (pPic, pCtx->bNewSeqBegin); ++ SetUnRef (pPic); + break; + } else { + return ERR_INFO_INVALID_MMCO_REF_NUM_OVERFLOW; +@@ -806,7 +806,7 @@ static PPicture WelsDelShortFromList (PRefPic pRefPic, int32_t iFrameNum) { + static PPicture WelsDelShortFromListSetUnref (PRefPic pRefPic, int32_t iFrameNum) { + PPicture pPic = WelsDelShortFromList (pRefPic, iFrameNum); + if (pPic) { +- SetUnRef (pPic, false); ++ SetUnRef (pPic); + } + return pPic; + } +@@ -835,7 +835,7 @@ static PPicture WelsDelLongFromList (PRefPic pRefPic, uint32_t uiLongTermFrameId + static PPicture WelsDelLongFromListSetUnref (PRefPic pRefPic, uint32_t uiLongTermFrameIdx) { + PPicture pPic = WelsDelLongFromList (pRefPic, uiLongTermFrameIdx); + if (pPic) { +- SetUnRef (pPic, false); ++ SetUnRef (pPic); + } + return pPic; + } +diff --git a/codec/decoder/plus/src/welsDecoderExt.cpp b/codec/decoder/plus/src/welsDecoderExt.cpp +index 14257afff..b0936a7d8 100644 +--- a/codec/decoder/plus/src/welsDecoderExt.cpp ++++ b/codec/decoder/plus/src/welsDecoderExt.cpp +@@ -1083,8 +1083,9 @@ void CWelsDecoder::ReleaseBufferedReadyPictureReorder (PWelsDecoderContext pCtx, + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPOC = IMinInt32; + if (pPicBuff != NULL) { + PPicture pPic = pPicBuff->ppPic[m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx]; ++ bool bLastGOP = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP; + --pPic->iRefCount; +- if (m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP) ++ if (pPic->iRefCount <= 0 && bLastGOP) + pPic->bUsedAsRef = false; + } + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP = false; +@@ -1141,7 +1142,10 @@ void CWelsDecoder::ReleaseBufferedReadyPictureReorder (PWelsDecoderContext pCtx, + if (iPicBuffIdx >= 0 && iPicBuffIdx < pPicBuff->iCapacity) + { + PPicture pPic = pPicBuff->ppPic[iPicBuffIdx]; ++ bool bLastGOP = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP; + --pPic->iRefCount; ++ if (pPic->iRefCount <= 0 && bLastGOP) ++ pPic->bUsedAsRef = false; + } + } + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP = false; +@@ -1188,8 +1192,9 @@ void CWelsDecoder::ReleaseBufferedReadyPictureNoReorder(PWelsDecoderContext pCtx + if (pCtx || m_pPicBuff) { + PPicBuff pPicBuff = pCtx ? pCtx->pPicBuff : m_pPicBuff; + PPicture pPic = pPicBuff->ppPic[m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx]; ++ bool bLastGOP = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP; + --pPic->iRefCount; +- if (m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP) ++ if (pPic->iRefCount <= 0 && bLastGOP) + pPic->bUsedAsRef = false; + } + if (m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP) { diff --git a/media-libs/openh264/openh264-2.4.0-r1.ebuild b/media-libs/openh264/openh264-2.4.0-r1.ebuild new file mode 100644 index 000000000000..a98825f85f9b --- /dev/null +++ b/media-libs/openh264/openh264-2.4.0-r1.ebuild @@ -0,0 +1,136 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs multilib-minimal + +MOZVER=114_2 +MY_GMP_COMMIT="e7d30b921df736a1121a0c8e0cf3ab1ce5b8a4b7" + +DESCRIPTION="Cisco OpenH264 library and Gecko Media Plugin for Mozilla packages" +HOMEPAGE="https://www.openh264.org/ https://github.com/cisco/openh264" +SRC_URI="https://github.com/cisco/openh264/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz + https://github.com/mozilla/gmp-api/archive/${MY_GMP_COMMIT}.tar.gz -> gmp-api-Firefox${MOZVER}-${MY_GMP_COMMIT}.tar.gz" +LICENSE="BSD" + +# openh264 soname version. +# (2.2.0 needed a minor bump due to undocumented but breaking ABI changes, just to be sure. +# https://github.com/cisco/openh264/issues/3459 ) +SLOT="0/7" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="cpu_flags_arm_neon cpu_flags_x86_avx2 +plugin test utils" + +RESTRICT="bindist !test? ( test )" + +BDEPEND=" + abi_x86_32? ( dev-lang/nasm ) + abi_x86_64? ( dev-lang/nasm ) + test? ( dev-cpp/gtest[${MULTILIB_USEDEP}] )" + +DOCS=( LICENSE CONTRIBUTORS README.md ) + +PATCHES=( + "${FILESDIR}"/openh264-2.3.0-pkgconfig-pathfix.patch + "${FILESDIR}"/${PN}-2.3.1-pr3630.patch + "${FILESDIR}"/openh264-2.4.0-fix-off-by-one-decode-regression.patch + "${FILESDIR}"/openh264-2.4.0-unordered-frame-glitches.patch +) + +src_prepare() { + default + + ln -svf "/dev/null" "build/gtest-targets.mk" || die + sed -i -e 's/$(LIBPREFIX)gtest.$(LIBSUFFIX)//g' Makefile || die + + sed -i -e 's/ | generate-version//g' Makefile || die + sed -e 's|$FULL_VERSION|""|g' codec/common/inc/version_gen.h.template > \ + codec/common/inc/version_gen.h + + multilib_copy_sources +} + +multilib_src_configure() { + ln -s "${WORKDIR}"/gmp-api-${MY_GMP_COMMIT} gmp-api || die +} + +emakecmd() { + CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" AR="$(tc-getAR)" \ + emake V=Yes CFLAGS_M32="" CFLAGS_M64="" CFLAGS_OPT="" \ + PREFIX="${EPREFIX}/usr" \ + LIBDIR_NAME="$(get_libdir)" \ + SHAREDLIB_DIR="${EPREFIX}/usr/$(get_libdir)" \ + INCLUDES_DIR="${EPREFIX}/usr/include/${PN}" \ + HAVE_AVX2=$(usex cpu_flags_x86_avx2 Yes No) \ + HAVE_GTEST=$(usex test Yes No) \ + ARCH="$(tc-arch)" \ + ENABLEPIC="Yes" \ + $@ +} + +multilib_src_compile() { + local myopts="ENABLE64BIT=No" + case "${ABI}" in + s390x|alpha|*64) myopts="ENABLE64BIT=Yes";; + esac + + if use arm; then + myopts+=" USE_ASM=$(usex cpu_flags_arm_neon Yes No)" + fi + + emakecmd ${myopts} + use plugin && emakecmd ${myopts} plugin +} + +multilib_src_test() { + emakecmd test +} + +multilib_src_install() { + emakecmd DESTDIR="${D}" install-shared + + if use utils; then + newbin h264enc openh264enc + newbin h264dec openh264dec + fi + + if use plugin; then + local plugpath="${ROOT}/usr/$(get_libdir)/nsbrowser/plugins/gmp-gmp${PN}/system-installed" + insinto "${plugpath}" + doins libgmpopenh264.so* gmpopenh264.info + echo "MOZ_GMP_PATH=\"${plugpath}\"" >"${T}"/98-moz-gmp-${PN} + doenvd "${T}"/98-moz-gmp-${PN} + + cat <"${T}"/${P}.js +pref("media.gmp-gmp${PN}.autoupdate", false); +pref("media.gmp-gmp${PN}.version", "system-installed"); +PREFEOF + + insinto /usr/$(get_libdir)/firefox/defaults/pref + newins "${T}"/${P}.js ${PN}-${PV/_p*/}.js + + insinto /usr/$(get_libdir)/seamonkey/defaults/pref + newins "${T}"/${P}.js ${PN}-${PV/_p*/}.js + fi +} + +pkg_postinst() { + if use plugin; then + if [[ -z ${REPLACING_VERSIONS} ]]; then + elog "Please restart your login session, in order for the session's environment" + elog "to include the new MOZ_GMP_PATH variable." + elog "" + fi + elog "This package attempts to override the Mozilla GMPInstaller auto-update process," + elog "however even if it is not successful in doing so the profile-installed plugin" + elog "will not be used unless this package is removed. This package will take precedence" + elog "over any gmp-gmpopenh264 that may be installed in a user's profile." + elog "" + fi + + if use utils; then + elog "Utilities h264enc and h264dec are installed as openh264enc and openh264dec" + elog "to avoid file collisions with media-video/h264enc" + elog "" + fi +} -- cgit v1.2.3