patch from Sami<samiwieciekto at gmail.com> with pref guard:

Enable skipping loop filter and allow non spec compliant speedup tricks.
to enable, create new boolean pref "media.ffmpeg.skip_loop_filter" and set it to true.
This commit is contained in:
Roy Tam 2019-12-30 23:58:56 +08:00
commit dd094ae552
2 changed files with 10 additions and 0 deletions

View file

@ -117,6 +117,9 @@ private:
#ifdef MOZ_FFVPX
DECL_MEDIA_PREF("media.ffvpx.enabled", PDMFFVPXEnabled, bool, true);
#endif
#if defined(MOZ_FFVPX) || defined(MOZ_FFMPEG)
DECL_MEDIA_PREF("media.ffmpeg.skip_loop_filter", FFmpegSkipLoopFilter, bool, false);
#endif
#ifdef MOZ_AV1
DECL_MEDIA_PREF("media.av1.enabled", AV1Enabled, bool, false);
#endif

View file

@ -15,6 +15,7 @@
#include "FFmpegVideoDecoder.h"
#include "FFmpegLog.h"
#include "MediaPrefs.h"
#include "mozilla/PodOperations.h"
#include "libavutil/pixfmt.h"
@ -152,6 +153,12 @@ FFmpegVideoDecoder<LIBAV_VER>::InitCodecContext()
mCodecContext->thread_type = FF_THREAD_SLICE | FF_THREAD_FRAME;
}
if(MediaPrefs::FFmpegSkipLoopFilter()) {
// Enable skipping loop filter and allow non spec compliant speedup tricks.
mCodecContext->flags2 |= 1; //AV_CODEC_FLAG2_FAST - could not inline for unknown reason ^-^'
mCodecContext->skip_loop_filter = AVDISCARD_ALL;
}
// FFmpeg will call back to this to negotiate a video pixel format.
mCodecContext->get_format = ChoosePixelFormat;