73cc96
diff -up firefox-99.0/dom/media/mp4/MP4Demuxer.cpp.1670333 firefox-99.0/dom/media/mp4/MP4Demuxer.cpp
73cc96
--- firefox-99.0/dom/media/mp4/MP4Demuxer.cpp.1670333	2022-03-31 01:24:44.000000000 +0200
73cc96
+++ firefox-99.0/dom/media/mp4/MP4Demuxer.cpp	2022-04-04 09:58:35.606351546 +0200
73cc96
@@ -31,6 +31,8 @@ mozilla::LogModule* GetDemuxerLog() { re
73cc96
   DDMOZ_LOG(gMediaDemuxerLog, mozilla::LogLevel::Debug, "::%s: " arg, \
73cc96
             __func__, ##__VA_ARGS__)
73cc96
 
73cc96
+extern bool gUseKeyframeFromContainer;
73cc96
+
73cc96
 namespace mozilla {
73cc96
 
73cc96
 DDLoggedTypeDeclNameAndBase(MP4TrackDemuxer, MediaTrackDemuxer);
73cc96
@@ -394,6 +396,12 @@ already_AddRefed<MediaRawData> MP4TrackD
73cc96
           [[fallthrough]];
73cc96
         case H264::FrameType::OTHER: {
73cc96
           bool keyframe = type == H264::FrameType::I_FRAME;
73cc96
+          if (gUseKeyframeFromContainer) {
73cc96
+            if (sample->mKeyframe && sample->mKeyframe != keyframe) {
73cc96
+              sample->mKeyframe = keyframe;
73cc96
+            }
73cc96
+            break;
73cc96
+          }
73cc96
           if (sample->mKeyframe != keyframe) {
73cc96
             NS_WARNING(nsPrintfCString("Frame incorrectly marked as %skeyframe "
73cc96
                                        "@ pts:%" PRId64 " dur:%" PRId64
73cc96
diff -up firefox-99.0/dom/media/platforms/PDMFactory.cpp.1670333 firefox-99.0/dom/media/platforms/PDMFactory.cpp
73cc96
--- firefox-99.0/dom/media/platforms/PDMFactory.cpp.1670333	2022-03-31 01:24:44.000000000 +0200
73cc96
+++ firefox-99.0/dom/media/platforms/PDMFactory.cpp	2022-04-04 10:09:57.383419125 +0200
73cc96
@@ -58,6 +58,8 @@
73cc96
 
73cc96
 #include <functional>
73cc96
 
73cc96
+bool gUseKeyframeFromContainer = false;
73cc96
+
73cc96
 namespace mozilla {
73cc96
 
73cc96
 #define PDM_INIT_LOG(msg, ...) \
73cc96
@@ -495,7 +497,7 @@ void PDMFactory::CreateRddPDMs() {
73cc96
 #ifdef MOZ_FFMPEG
73cc96
   if (StaticPrefs::media_ffmpeg_enabled() &&
73cc96
       StaticPrefs::media_rdd_ffmpeg_enabled() &&
73cc96
-      !CreateAndStartupPDM<FFmpegRuntimeLinker>()) {
73cc96
+      !(mFFmpegUsed = CreateAndStartupPDM<FFmpegRuntimeLinker>())) {
73cc96
     mFailureFlags += GetFailureFlagBasedOnFFmpegStatus(
73cc96
         FFmpegRuntimeLinker::LinkStatusCode());
73cc96
   }
73cc96
@@ -602,8 +604,9 @@ void PDMFactory::CreateDefaultPDMs() {
73cc96
 
73cc96
   CreateAndStartupPDM<AgnosticDecoderModule>();
73cc96
 
73cc96
-  if (StaticPrefs::media_gmp_decoder_enabled() &&
73cc96
+  if (StaticPrefs::media_gmp_decoder_enabled() && !mFFmpegUsed &&
73cc96
       !CreateAndStartupPDM<GMPDecoderModule>()) {
73cc96
+    gUseKeyframeFromContainer = true;
73cc96
     mFailureFlags += DecoderDoctorDiagnostics::Flags::GMPPDMFailedToStartup;
73cc96
   }
73cc96
 }
73cc96
diff -up firefox-99.0/dom/media/platforms/PDMFactory.h.1670333 firefox-99.0/dom/media/platforms/PDMFactory.h
73cc96
--- firefox-99.0/dom/media/platforms/PDMFactory.h.1670333	2022-03-31 01:24:44.000000000 +0200
73cc96
+++ firefox-99.0/dom/media/platforms/PDMFactory.h	2022-04-04 09:58:35.606351546 +0200
73cc96
@@ -121,6 +121,7 @@ class PDMFactory final {
73cc96
   RefPtr<PlatformDecoderModule> mNullPDM;
73cc96
 
73cc96
   DecoderDoctorDiagnostics::FlagsSet mFailureFlags;
73cc96
+  bool mFFmpegUsed = false;
73cc96
 
73cc96
   friend class RemoteVideoDecoderParent;
73cc96
   static void EnsureInit();