summaryrefslogtreecommitdiff
path: root/mozilla-1670333.patch
blob: a7c7f8a7f155bc17c051bf67aff6078f7aae7c18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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;
bgstack15