Added fix for mozbz#1779186 - fix VA-API playback artifacts
This commit is contained in:
parent
4dc4e22ba3
commit
753639d380
79
D161724.diff
Normal file
79
D161724.diff
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
||||||
|
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
||||||
|
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
||||||
|
@@ -173,10 +173,11 @@
|
||||||
|
|
||||||
|
PtsCorrectionContext mPtsContext;
|
||||||
|
|
||||||
|
DurationMap mDurationMap;
|
||||||
|
const bool mLowLatency;
|
||||||
|
+ AVDiscard mFrameDrop = AVDISCARD_DEFAULT;
|
||||||
|
|
||||||
|
// True if we're allocating shmem for ffmpeg decode buffer.
|
||||||
|
Maybe<Atomic<bool>> mIsUsingShmemBufferForDecode;
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR >= 57 && LIBAVUTIL_VERSION_MAJOR >= 56
|
||||||
|
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
||||||
|
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
||||||
|
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
||||||
|
@@ -829,10 +829,17 @@
|
||||||
|
packet.dts = aSample->mTimecode.ToMicroseconds();
|
||||||
|
packet.pts = aSample->mTime.ToMicroseconds();
|
||||||
|
packet.flags = aSample->mKeyframe ? AV_PKT_FLAG_KEY : 0;
|
||||||
|
packet.pos = aSample->mOffset;
|
||||||
|
|
||||||
|
+ mCodecContext->skip_frame = mFrameDrop;
|
||||||
|
+#if MOZ_LOGGING
|
||||||
|
+ if (mFrameDrop == AVDISCARD_NONREF) {
|
||||||
|
+ FFMPEG_LOG("Frame skip AVDISCARD_NONREF");
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR >= 58
|
||||||
|
packet.duration = aSample->mDuration.ToMicroseconds();
|
||||||
|
int res = mLib->avcodec_send_packet(mCodecContext, &packet);
|
||||||
|
if (res < 0) {
|
||||||
|
// In theory, avcodec_send_packet could sent -EAGAIN should its internal
|
||||||
|
@@ -881,10 +888,22 @@
|
||||||
|
return MediaResult(
|
||||||
|
NS_ERROR_DOM_MEDIA_DECODE_ERR,
|
||||||
|
RESULT_DETAIL("avcodec_receive_frame error: %s", errStr));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (mFrameDrop == AVDISCARD_NONREF) {
|
||||||
|
+ FFMPEG_LOG("Requested pts %" PRId64 " decoded frame pts %" PRId64,
|
||||||
|
+ packet.pts, GetFramePts(mFrame) + mFrame->pkt_duration);
|
||||||
|
+ // Switch back to default frame skip policy if we hit correct
|
||||||
|
+ // decode times. 5 ms treshold is taken from mpv project which
|
||||||
|
+ // use similar approach after seek (feed_packet() at f_decoder_wrapper.c).
|
||||||
|
+ if (packet.pts - 5000 <= GetFramePts(mFrame) + mFrame->pkt_duration) {
|
||||||
|
+ FFMPEG_LOG("Set frame drop to AVDISCARD_DEFAULT.");
|
||||||
|
+ mFrameDrop = AVDISCARD_DEFAULT;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
UpdateDecodeTimes(decodeStart);
|
||||||
|
decodeStart = TimeStamp::Now();
|
||||||
|
|
||||||
|
MediaResult rv;
|
||||||
|
# ifdef MOZ_WAYLAND_USE_VAAPI
|
||||||
|
@@ -1211,13 +1230,18 @@
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
RefPtr<MediaDataDecoder::FlushPromise>
|
||||||
|
FFmpegVideoDecoder<LIBAV_VER>::ProcessFlush() {
|
||||||
|
+ FFMPEG_LOG("ProcessFlush()");
|
||||||
|
MOZ_ASSERT(mTaskQueue->IsOnCurrentThread());
|
||||||
|
mPtsContext.Reset();
|
||||||
|
mDurationMap.Clear();
|
||||||
|
+ // Discard non-ref frames on HW accelerated backend to avoid decode artifacts.
|
||||||
|
+ if (IsHardwareAccelerated()) {
|
||||||
|
+ mFrameDrop = AVDISCARD_NONREF;
|
||||||
|
+ }
|
||||||
|
return FFmpegDataDecoder::ProcessFlush();
|
||||||
|
}
|
||||||
|
|
||||||
|
AVCodecID FFmpegVideoDecoder<LIBAV_VER>::GetCodecId(
|
||||||
|
const nsACString& aMimeType) {
|
||||||
|
|
@ -172,7 +172,7 @@ ExcludeArch: i686
|
|||||||
Summary: Mozilla Firefox Web browser
|
Summary: Mozilla Firefox Web browser
|
||||||
Name: firefox
|
Name: firefox
|
||||||
Version: 107.0
|
Version: 107.0
|
||||||
Release: 3%{?pre_tag}%{?dist}
|
Release: 4%{?pre_tag}%{?dist}
|
||||||
URL: https://www.mozilla.org/firefox/
|
URL: https://www.mozilla.org/firefox/
|
||||||
License: MPLv1.1 or GPLv2+ or LGPLv2+
|
License: MPLv1.1 or GPLv2+ or LGPLv2+
|
||||||
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
|
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
|
||||||
@ -251,6 +251,7 @@ Patch402: mozilla-1196777.patch
|
|||||||
Patch407: mozilla-1667096.patch
|
Patch407: mozilla-1667096.patch
|
||||||
Patch408: mozilla-1663844.patch
|
Patch408: mozilla-1663844.patch
|
||||||
Patch415: mozilla-1670333.patch
|
Patch415: mozilla-1670333.patch
|
||||||
|
Patch416: D161724.diff
|
||||||
|
|
||||||
# PGO/LTO patches
|
# PGO/LTO patches
|
||||||
Patch600: pgo.patch
|
Patch600: pgo.patch
|
||||||
@ -529,6 +530,7 @@ This package contains results of tests executed during build.
|
|||||||
%patch407 -p1 -b .1667096
|
%patch407 -p1 -b .1667096
|
||||||
%patch408 -p1 -b .1663844
|
%patch408 -p1 -b .1663844
|
||||||
%patch415 -p1 -b .1670333
|
%patch415 -p1 -b .1670333
|
||||||
|
%patch416 -p1 -b .D161724
|
||||||
|
|
||||||
# PGO patches
|
# PGO patches
|
||||||
%if %{build_with_pgo}
|
%if %{build_with_pgo}
|
||||||
@ -1131,6 +1133,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
|||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 24 2022 Martin Stransky <stransky@redhat.com>- 107.0-4
|
||||||
|
- Added fix for mozbz#1779186 - fix VA-API playback artifacts
|
||||||
|
|
||||||
* Mon Nov 21 2022 Martin Stransky <stransky@redhat.com>- 107.0-3
|
* Mon Nov 21 2022 Martin Stransky <stransky@redhat.com>- 107.0-3
|
||||||
- Disabled crashreporter
|
- Disabled crashreporter
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user