firefox/mozilla-1670333.patch

69 lines
2.8 KiB
Diff

diff -up firefox-82.0/dom/media/mp4/MP4Demuxer.cpp.1670333 firefox-82.0/dom/media/mp4/MP4Demuxer.cpp
--- firefox-82.0/dom/media/mp4/MP4Demuxer.cpp.1670333 2020-10-14 19:20:18.000000000 +0200
+++ firefox-82.0/dom/media/mp4/MP4Demuxer.cpp 2020-10-19 20:56:38.362039524 +0200
@@ -31,6 +31,8 @@ mozilla::LogModule* GetDemuxerLog() { re
DDMOZ_LOG(gMediaDemuxerLog, mozilla::LogLevel::Debug, "::%s: " arg, \
__func__, ##__VA_ARGS__)
+extern bool gUseKeyframeFromContainer;
+
namespace mozilla {
DDLoggedTypeDeclNameAndBase(MP4TrackDemuxer, MediaTrackDemuxer);
@@ -394,6 +396,12 @@ already_AddRefed<MediaRawData> MP4TrackD
[[fallthrough]];
case H264::FrameType::OTHER: {
bool keyframe = type == H264::FrameType::I_FRAME;
+ if (gUseKeyframeFromContainer) {
+ if (sample->mKeyframe && sample->mKeyframe != keyframe) {
+ sample->mKeyframe = keyframe;
+ }
+ break;
+ }
if (sample->mKeyframe != keyframe) {
NS_WARNING(nsPrintfCString("Frame incorrectly marked as %skeyframe "
"@ pts:%" PRId64 " dur:%" PRId64
diff -up firefox-82.0/dom/media/platforms/PDMFactory.cpp.1670333 firefox-82.0/dom/media/platforms/PDMFactory.cpp
--- firefox-82.0/dom/media/platforms/PDMFactory.cpp.1670333 2020-10-14 19:20:18.000000000 +0200
+++ firefox-82.0/dom/media/platforms/PDMFactory.cpp 2020-10-19 20:53:14.631214334 +0200
@@ -49,6 +49,8 @@
#include <functional>
+bool gUseKeyframeFromContainer = false;
+
namespace mozilla {
extern already_AddRefed<PlatformDecoderModule> CreateBlankDecoderModule();
@@ -380,7 +382,8 @@ void PDMFactory::CreatePDMs() {
#ifdef MOZ_FFMPEG
if (StaticPrefs::media_ffmpeg_enabled()) {
m = FFmpegRuntimeLinker::CreateDecoderModule();
- mFFmpegFailedToLoad = !StartupPDM(m);
+ mFFmpegUsed = StartupPDM(m);
+ mFFmpegFailedToLoad = !mFFmpegUsed;
} else {
mFFmpegFailedToLoad = false;
}
@@ -395,7 +398,8 @@ void PDMFactory::CreatePDMs() {
m = new AgnosticDecoderModule();
StartupPDM(m);
- if (StaticPrefs::media_gmp_decoder_enabled()) {
+ if (StaticPrefs::media_gmp_decoder_enabled() && !mFFmpegUsed) {
+ gUseKeyframeFromContainer = true;
m = new GMPDecoderModule();
mGMPPDMFailedToStartup = !StartupPDM(m);
} else {
diff -up firefox-82.0/dom/media/platforms/PDMFactory.h.1670333 firefox-82.0/dom/media/platforms/PDMFactory.h
--- firefox-82.0/dom/media/platforms/PDMFactory.h.1670333 2020-10-14 19:20:18.000000000 +0200
+++ firefox-82.0/dom/media/platforms/PDMFactory.h 2020-10-19 20:53:14.631214334 +0200
@@ -70,6 +70,7 @@ class PDMFactory final {
bool mWMFFailedToLoad = false;
bool mFFmpegFailedToLoad = false;
+ bool mFFmpegUsed = false;
bool mGMPPDMFailedToStartup = false;
friend class RemoteVideoDecoderParent;