Accepting request 973972 from home:StefanBruens:branches:science

- Add upstream patches for FFmpeg 5.0 support, add
  * videoio_initial_FFmpeg_5_0_support.patch
  * videoio_ffmpeg_avoid_memory_leaks.patch
- Restore memoryperjob constraint, avoid being scheduled on a 16
  core system and use less than half of it.
- Adjust %limit_build to 1800, to avoid recurrent build failures
  on aarch64. (People should not care for their pet architecture
  only, but also carefully check if they break others.)
- Add missing libopencv_aruco dependency in devel package.

OBS-URL: https://build.opensuse.org/request/show/973972
OBS-URL: https://build.opensuse.org/package/show/science/opencv?expand=0&rev=32
This commit is contained in:
Stefan Brüns 2022-05-03 17:42:13 +00:00 committed by Git OBS Bridge
parent 649fdbec90
commit 70a5e1ec8b
5 changed files with 1097 additions and 0 deletions

View File

@ -7,5 +7,10 @@
<memory> <memory>
<size unit="M">5700</size> <size unit="M">5700</size>
</memory> </memory>
<memoryperjob>
<!-- This is the max available on all archs -->
<!-- The actual requirement is enforced with limit_build -->
<size unit="M">1200</size>
</memoryperjob>
</hardware> </hardware>
</constraints> </constraints>

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Fri Apr 29 16:54:16 UTC 2022 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- Add upstream patches for FFmpeg 5.0 support, add
* videoio_initial_FFmpeg_5_0_support.patch
* videoio_ffmpeg_avoid_memory_leaks.patch
-------------------------------------------------------------------
Sat Apr 9 17:42:50 UTC 2022 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- Restore memoryperjob constraint, avoid being scheduled on a 16
core system and use less than half of it.
- Adjust %limit_build to 1800, to avoid recurrent build failures
on aarch64. (People should not care for their pet architecture
only, but also carefully check if they break others.)
- Add missing libopencv_aruco dependency in devel package.
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jan 10 11:08:32 UTC 2022 - Antonio Larrosa <alarrosa@suse.com> Mon Jan 10 11:08:32 UTC 2022 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -47,6 +47,10 @@ Source0: https://github.com/opencv/opencv/archive/%{version}.tar.gz#/%{na
Source1: https://github.com/opencv/opencv_contrib/archive/%{version}.tar.gz#/opencv_contrib-%{version}.tar.gz Source1: https://github.com/opencv/opencv_contrib/archive/%{version}.tar.gz#/opencv_contrib-%{version}.tar.gz
# PATCH-FIX-UPSTREAM # PATCH-FIX-UPSTREAM
Patch0: 0001-highgui-Fix-unresolved-OpenGL-functions-for-Qt-backe.patch Patch0: 0001-highgui-Fix-unresolved-OpenGL-functions-for-Qt-backe.patch
# PATCH-FIX-UPSTREAM
Patch1: https://github.com/opencv/opencv/pull/21754.patch#/videoio_initial_FFmpeg_5_0_support.patch
# PATCH-FIX-UPSTREAM
Patch2: https://github.com/opencv/opencv/commit/271f7df3435c619ceba9261f88dcfbb0714b0b0d.patch#/videoio_ffmpeg_avoid_memory_leaks.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: libeigen3-devel BuildRequires: libeigen3-devel
@ -213,6 +217,7 @@ Summary: Development files for using the OpenCV library
License: BSD-3-Clause License: BSD-3-Clause
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: %{libname}%{soname} = %{version} Requires: %{libname}%{soname} = %{version}
Requires: libopencv_aruco%{soname} = %{version}
Requires: libopencv_face%{soname} = %{version} Requires: libopencv_face%{soname} = %{version}
Requires: libopencv_highgui%{soname} = %{version} Requires: libopencv_highgui%{soname} = %{version}
Requires: libopencv_imgcodecs%{soname} = %{version} Requires: libopencv_imgcodecs%{soname} = %{version}

View File

@ -0,0 +1,69 @@
From 271f7df3435c619ceba9261f88dcfbb0714b0b0d Mon Sep 17 00:00:00 2001
From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
Date: Fri, 1 Apr 2022 18:02:14 +0000
Subject: [PATCH] videoio(ffmpeg): avoid memory leaks
---
modules/videoio/src/cap_ffmpeg_impl.hpp | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp
index 91a0f710aa63..b7fa0b745c1e 100644
--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
+++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
@@ -2496,17 +2496,13 @@ double CvVideoWriter_FFMPEG::getProperty(int propId) const
/// close video output stream and free associated memory
void CvVideoWriter_FFMPEG::close()
{
- // nothing to do if already released
- if ( !picture )
- return;
-
/* no more frame to compress. The codec has a latency of a few
frames if using B frames, so we get the last frames by
passing the same picture again */
// TODO -- do we need to account for latency here?
/* write the trailer, if any */
- if(ok && oc)
+ if (picture && ok && oc)
{
#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(57, 0, 0)
if (!(oc->oformat->flags & AVFMT_RAWPICTURE))
@@ -2529,7 +2525,7 @@ void CvVideoWriter_FFMPEG::close()
}
// free pictures
- if( context->pix_fmt != input_pix_fmt)
+ if (picture && context && context->pix_fmt != input_pix_fmt)
{
if(picture->data[0])
free(picture->data[0]);
@@ -2540,8 +2536,14 @@ void CvVideoWriter_FFMPEG::close()
if (input_picture)
av_free(input_picture);
+#ifdef CV_FFMPEG_CODECPAR
+ avcodec_free_context(&context);
+#else
/* close codec */
- avcodec_close(context);
+ if (context) // fixed after https://github.com/FFmpeg/FFmpeg/commit/3e1f507f3e8f16b716aa115552d243b48ae809bd
+ avcodec_close(context);
+ context = NULL;
+#endif
av_free(outbuf);
@@ -2935,10 +2937,7 @@ bool CvVideoWriter_FFMPEG::open( const char * filename, int fourcc,
#endif
#ifdef CV_FFMPEG_CODECPAR
- if (context)
- {
- avcodec_free_context(&context);
- }
+ avcodec_free_context(&context);
#endif
context = icv_configure_video_stream_FFMPEG(oc, video_st, codec,
width, height, (int) (bitrate + 0.5),

File diff suppressed because it is too large Load Diff