[SCM] kodi/experimental: Fix Kodi's FFmpeg API usage for allocating and freeing AVFrame

rbalint at users.alioth.debian.org rbalint at users.alioth.debian.org
Mon Oct 31 16:38:36 UTC 2016


The following commit has been merged in the experimental branch:
commit 883aaac50162d1707fb175f9088296f9e34d97b6
Author: Balint Reczey <balint at balintreczey.hu>
Date:   Mon Oct 31 10:59:32 2016 +0100

    Fix Kodi's FFmpeg API usage for allocating and freeing AVFrame
    
    Closes: #831591

diff --git a/debian/patches/0004-Allocate-and-free-AVFrames-with-the-proper-FFmpeg-AP.patch b/debian/patches/0004-Allocate-and-free-AVFrames-with-the-proper-FFmpeg-AP.patch
new file mode 100644
index 0000000..c4b36bf
--- /dev/null
+++ b/debian/patches/0004-Allocate-and-free-AVFrames-with-the-proper-FFmpeg-AP.patch
@@ -0,0 +1,70 @@
+From 9859bc8a9704b226411f0ed1eb73983afdc63378 Mon Sep 17 00:00:00 2001
+From: Andreas Cadhalpun <andreas.cadhalpun at googlemail.com>
+Date: Mon, 31 Oct 2016 10:56:12 +0100
+Subject: [PATCH] Allocate and free AVFrames with the proper FFmpeg API
+
+---
+ xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp         | 11 +++--------
+ .../VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp   |  7 ++++---
+ 2 files changed, 7 insertions(+), 11 deletions(-)
+
+diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+index ebb8fce..cf03738 100644
+--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
++++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+@@ -1871,16 +1871,11 @@ void CDVDDemuxFFmpeg::ParsePacket(AVPacket *pkt)
+     st->codec->skip_loop_filter = AVDISCARD_ALL;
+ 
+     // We are looking for an IDR frame
+-    AVFrame picture;
+-    memset(&picture, 0, sizeof(AVFrame));
+-    picture.pts = picture.pkt_dts = picture.pkt_pts = picture.best_effort_timestamp = AV_NOPTS_VALUE;
+-    picture.pkt_pos = -1;
+-    picture.key_frame = 1;
+-    picture.format = -1;
++    AVFrame *picture = av_frame_alloc();
+ 
+     int got_picture = 0;
+-    avcodec_decode_video2(st->codec, &picture, &got_picture, pkt);
+-    av_frame_unref(&picture);
++    avcodec_decode_video2(st->codec, picture, &got_picture, pkt);
++    av_frame_free(&picture);
+   }
+ }
+ 
+diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp
+index 96a8e61..17d43be 100644
+--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp
++++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp
+@@ -167,7 +167,7 @@ void CMMALPool::AlignedSize(AVCodecContext *avctx, uint32_t &width, uint32_t &he
+   if (!avctx)
+     return;
+   int w = width, h = height;
+-  AVFrame picture;
++  AVFrame *picture = av_frame_alloc();
+   int unaligned;
+   int stride_align[AV_NUM_DATA_POINTERS];
+ 
+@@ -179,16 +179,17 @@ void CMMALPool::AlignedSize(AVCodecContext *avctx, uint32_t &width, uint32_t &he
+   do {
+     // NOTE: do not align linesizes individually, this breaks e.g. assumptions
+     // that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2
+-    av_image_fill_linesizes(picture.linesize, avctx->pix_fmt, w);
++    av_image_fill_linesizes(picture->linesize, avctx->pix_fmt, w);
+     // increase alignment of w for next try (rhs gives the lowest bit set in w)
+     w += w & ~(w - 1);
+ 
+     unaligned = 0;
+     for (int i = 0; i < 4; i++)
+-      unaligned |= picture.linesize[i] % stride_align[i];
++      unaligned |= picture->linesize[i] % stride_align[i];
+   } while (unaligned);
+   width = w;
+   height = h;
++  av_frame_free(&picture);
+ }
+ 
+ CMMALBuffer *CMMALPool::GetBuffer(uint32_t timeout)
+-- 
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index fb462c2..2042f74 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,6 +1,7 @@
 0001-c-pluff-Fix-format-string-warnings.patch
 0002-StringUtils-Fix-format-string.patch
 0003-Revert-droid-fix-builds-with-AML-disabled.patch
+0004-Allocate-and-free-AVFrames-with-the-proper-FFmpeg-AP.patch
 01_reproducible_build.patch
 02_allow_all_arches.patch
 03-privacy.patch

-- 
kodi packaging



More information about the pkg-multimedia-commits mailing list