Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package nodejs-electron for openSUSE:Factory 
checked in at 2024-08-16 12:23:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nodejs-electron (Old)
 and      /work/SRC/openSUSE:Factory/.nodejs-electron.new.2698 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "nodejs-electron"

Fri Aug 16 12:23:29 2024 rev:126 rq:1194025 version:30.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/nodejs-electron/nodejs-electron.changes  
2024-07-22 17:19:01.335719724 +0200
+++ 
/work/SRC/openSUSE:Factory/.nodejs-electron.new.2698/nodejs-electron.changes    
    2024-08-16 12:23:56.363753793 +0200
@@ -1,0 +2,7 @@
+Tue Aug 13 20:28:37 UTC 2024 - Bruno Pitrus <brunopit...@hotmail.com>
+
+- Fix ftbfs with ffmpeg 7.x
+  * add backported ffmpeg-7-ffmpeg_video_decoder-reordered_opaque.patch
+  * do not revert audio_file_reader-ffmpeg-AVFrame-duration.patch when 
building against ffmpeg 6+
+
+-------------------------------------------------------------------

New:
----
  ffmpeg-7-ffmpeg_video_decoder-reordered_opaque.patch

BETA DEBUG BEGIN:
  New:- Fix ftbfs with ffmpeg 7.x
  * add backported ffmpeg-7-ffmpeg_video_decoder-reordered_opaque.patch
  * do not revert audio_file_reader-ffmpeg-AVFrame-duration.patch when building 
against ffmpeg 6+
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ nodejs-electron.spec ++++++
--- /var/tmp/diff_new_pack.valr0O/_old  2024-08-16 12:24:01.307959269 +0200
+++ /var/tmp/diff_new_pack.valr0O/_new  2024-08-16 12:24:01.311959434 +0200
@@ -129,17 +129,11 @@
 %endif
 
 %if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150700 || 0%{?fedora}
-%bcond_without ffmpeg_5
 %bcond_without system_vpx
-%else
-%bcond_with ffmpeg_5
-%bcond_with system_vpx
-%endif
-
-%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150700 || 0%{?fedora} >= 
39
 %bcond_without bro_11
 %bcond_without ffmpeg_6
 %else
+%bcond_with system_vpx
 %bcond_with bro_11
 %bcond_with ffmpeg_6
 %endif
@@ -395,6 +389,7 @@
 Patch3161:      preview_cancel_reason-missing-string.patch
 Patch3162:      script_streamer-atomic-include.patch
 Patch3163:      DesktopNativeWidgetAura-HandleActivationChanged-crash.patch
+Patch3164:      ffmpeg-7-ffmpeg_video_decoder-reordered_opaque.patch
 
 # Patches to re-enable upstream force disabled features.
 # There's no sense in submitting them but they may be reused as-is by other 
packagers.
@@ -545,11 +540,8 @@
 %endif
 %if %{with ffmpeg_6}
 BuildRequires:  pkgconfig(libavcodec) >= 60
-%endif
-%if %{with ffmpeg_5}
-BuildRequires:  pkgconfig(libavcodec) >= 59
-BuildRequires:  pkgconfig(libavformat) >= 59
-BuildRequires:  pkgconfig(libavutil) >= 57
+BuildRequires:  pkgconfig(libavformat) >= 60
+BuildRequires:  pkgconfig(libavutil) >= 58
 %if 0%{?fedora}
 #requires av_stream_get_first_dts, see rhbz#2240127
 BuildRequires:  libavformat-free-devel >= %AVFORMAT_VER
@@ -747,14 +739,13 @@
 patch -R -p1 < %PATCH1076
 %endif
 
-%if %{without ffmpeg_6}
-patch -R -p1 < %SOURCE402
-%endif
 
-%if %{with ffmpeg_5}
+%if %{with ffmpeg_6}
 patch -R -p1 < %PATCH2012
 %else
+patch -R -p1 < %SOURCE402
 patch -R -p1 < %SOURCE400
+patch -R -p1 < %SOURCE401
 %endif
 
 
@@ -770,8 +761,7 @@
 %endif
 
 
-# This one depends on an ffmpeg nightly, reverting unconditionally.
-patch -R -p1 < %SOURCE401
+
 
 # Link system wayland-protocols-devel into where chrome expects them
 mkdir -p third_party/wayland/src
@@ -1056,6 +1046,10 @@
 %endif
 %endif
 
+# Ccache is truncated to 5GB which is not enough for Electron, leading to 
slower rebuilds
+export CCACHE_COMPRESS=1
+ccache -o max_size=0 || true
+
 # Create the configuration for GN
 # Available options: out/Release/gn args --list out/Release/
 myconf_gn=""

++++++ ffmpeg-7-ffmpeg_video_decoder-reordered_opaque.patch ++++++
>From 62274859104bd828373ae406aa9309e610449ac5 Mon Sep 17 00:00:00 2001
From: Ted Meyer <tmathme...@chromium.org>
Date: Fri, 22 Mar 2024 19:56:55 +0000
Subject: [PATCH] Replace deprecated use of AVCodecContext::reordered_opaque

We can use the AV_CODEC_FLAG_COPY_OPAQUE flag on the codec context
now to trigger timestamp propagation.

Bug: 330573128
Change-Id: I6bc57241a35ab5283742aad8d42acb4dc5e85858
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5384308
Commit-Queue: Ted (Chromium) Meyer <tmathme...@chromium.org>
Reviewed-by: Dan Sanders <sande...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1277051}
---
 media/filters/ffmpeg_video_decoder.cc | 17 +++++++++++++----
 media/filters/ffmpeg_video_decoder.h  | 16 ++++++++++++++++
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/media/filters/ffmpeg_video_decoder.cc 
b/media/filters/ffmpeg_video_decoder.cc
index bd75477feeabb7..8a658a58caac5b 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -134,7 +134,7 @@ bool FFmpegVideoDecoder::IsCodecSupported(VideoCodec codec) 
{
 }
 
 FFmpegVideoDecoder::FFmpegVideoDecoder(MediaLog* media_log)
-    : media_log_(media_log) {
+    : media_log_(media_log), timestamp_map_(128) {
   DVLOG(1) << __func__;
   DETACH_FROM_SEQUENCE(sequence_checker_);
 }
@@ -213,10 +213,6 @@ int FFmpegVideoDecoder::GetVideoBuffer(struct 
AVCodecContext* codec_context,
     frame->linesize[plane] = layout->planes()[plane].stride;
   }
 
-  // This seems unsafe, given threaded decoding.  However, `reordered_opaque` 
is
-  // also going away upstream, so we need a whole new mechanism either way.
-  frame->reordered_opaque = codec_context->reordered_opaque;
-
   // This will be freed by `ReleaseVideoBufferImpl`.
   auto* opaque = new OpaqueData(fb_priv, frame_pool_, data, allocation_size,
                                 std::move(*layout));
@@ -363,8 +363,10 @@ bool FFmpegVideoDecoder::FFmpegDecode(const DecoderBuffer& 
buffer) {
     DCHECK(packet->data);
     DCHECK_GT(packet->size, 0);
 
-    // Let FFmpeg handle presentation timestamp reordering.
-    codec_context_->reordered_opaque = buffer.timestamp().InMicroseconds();
+    const int64_t timestamp = buffer.timestamp().InMicroseconds();
+    const TimestampId timestamp_id = timestamp_id_generator_.GenerateNextId();
+    timestamp_map_.Put(std::make_pair(timestamp_id, timestamp));
+    packet->opaque = reinterpret_cast<void*>(timestamp_id.GetUnsafeValue());
   }
   FFmpegDecodingLoop::DecodeStatus decode_status = 
decoding_loop_->DecodePacket(
       packet, base::BindRepeating(&FFmpegVideoDecoder::OnNewFrame,
@@ -423,7 +425,12 @@ bool FFmpegVideoDecoder::OnNewFrame(AVFrame* frame) {
   }
   gfx::Size natural_size = aspect_ratio.GetNaturalSize(visible_rect);
 
-  const auto pts = base::Microseconds(frame->reordered_opaque);
+  const auto ts_id = TimestampId(reinterpret_cast<size_t>(frame->opaque));
+  const auto ts_lookup = timestamp_map_.Get(ts_id);
+  if (ts_lookup == timestamp_map_.end()) {
+    return false;
+  }
+  const auto pts = base::Microseconds(std::get<1>(*ts_lookup));
   auto video_frame = VideoFrame::WrapExternalDataWithLayout(
       opaque->layout, visible_rect, natural_size, opaque->data, opaque->size,
       pts);
@@ -498,8 +505,10 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const 
VideoDecoderConfig& config,
   codec_context_->thread_count = GetFFmpegVideoDecoderThreadCount(config);
   codec_context_->thread_type =
       FF_THREAD_SLICE | (low_delay ? 0 : FF_THREAD_FRAME);
+
   codec_context_->opaque = this;
   codec_context_->get_buffer2 = GetVideoBufferImpl;
+  codec_context_->flags |= AV_CODEC_FLAG_COPY_OPAQUE;
 
   if (base::FeatureList::IsEnabled(kFFmpegAllowLists)) {
     // Note: FFmpeg will try to free this string, so we must duplicate it.
diff --git a/media/filters/ffmpeg_video_decoder.h 
b/media/filters/ffmpeg_video_decoder.h
index d02cb89c3ddf7c..0a2de1c623ffff 100644
--- a/media/filters/ffmpeg_video_decoder.h
+++ b/media/filters/ffmpeg_video_decoder.h
@@ -7,10 +7,12 @@
 
 #include <memory>
 
+#include "base/containers/lru_cache.h"
 #include "base/functional/callback.h"
 #include "base/memory/raw_ptr.h"
 #include "base/memory/scoped_refptr.h"
 #include "base/sequence_checker.h"
+#include "base/types/id_type.h"
 #include "media/base/frame_buffer_pool.h"
 #include "media/base/supported_video_decoder_config.h"
 #include "media/base/video_decoder.h"
@@ -87,6 +89,20 @@ class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
   // FFmpeg structures owned by this object.
   std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
 
+  // The gist here is that timestamps need to be 64 bits to store microsecond
+  // precision. A 32 bit integer would overflow at ~35 minutes at this level of
+  // precision. We can't cast the timestamp to the void ptr object used by the
+  // opaque field in ffmpeg then, because it would lose data on a 32 bit build.
+  // However, we don't actually have 2^31 timestamped frames in a single
+  // playback, so it's fine to use the 32 bit value as a key in a map which
+  // contains the actual timestamps. Additionally, we've in the past set 128
+  // outstanding frames for re-ordering as a limit for cross-thread decoding
+  // tasks, so we'll do that here too with the LRU cache.
+  using TimestampId = base::IdType<int64_t, size_t, 0>;
+
+  TimestampId::Generator timestamp_id_generator_;
+  base::LRUCache<TimestampId, int64_t> timestamp_map_;
+
   VideoDecoderConfig config_;
 
   scoped_refptr<FrameBufferPool> frame_pool_;

Reply via email to