firefox/D166324.diff
2023-01-17 14:28:43 +01:00

76 lines
2.9 KiB
Diff

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
@@ -175,11 +175,10 @@
PtsCorrectionContext mPtsContext;
DurationMap mDurationMap;
const bool mLowLatency;
- AVDiscard mFrameDrop = AVDISCARD_DEFAULT;
const Maybe<TrackingId> mTrackingId;
PerformanceRecorderMulti<DecodeStage> mPerformanceRecorder;
// True if we're allocating shmem for ffmpeg decode buffer.
Maybe<Atomic<bool>> mIsUsingShmemBufferForDecode;
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
@@ -850,17 +850,10 @@
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
-
mTrackingId.apply([&](const auto& aId) {
MediaInfoFlag flag = MediaInfoFlag::None;
flag |= (aSample->mKeyframe ? MediaInfoFlag::KeyFrame
: MediaInfoFlag::NonKeyFrame);
flag |= (IsHardwareAccelerated() ? MediaInfoFlag::HardwareDecoding
@@ -943,22 +936,10 @@
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
@@ -1366,14 +1347,10 @@
FFMPEG_LOG("ProcessFlush()");
MOZ_ASSERT(mTaskQueue->IsOnCurrentThread());
mPtsContext.Reset();
mDurationMap.Clear();
mPerformanceRecorder.Record(std::numeric_limits<int64_t>::max());
- // 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) {