From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- dom/media/platforms/AllocationPolicy.cpp | 241 + dom/media/platforms/AllocationPolicy.h | 183 + dom/media/platforms/MediaCodecsSupport.cpp | 206 + dom/media/platforms/MediaCodecsSupport.h | 194 + dom/media/platforms/MediaTelemetryConstants.h | 21 + dom/media/platforms/PDMFactory.cpp | 904 ++++ dom/media/platforms/PDMFactory.h | 113 + dom/media/platforms/PEMFactory.cpp | 74 + dom/media/platforms/PEMFactory.h | 40 + dom/media/platforms/PlatformDecoderModule.cpp | 55 + dom/media/platforms/PlatformDecoderModule.h | 567 ++ dom/media/platforms/PlatformEncoderModule.h | 408 ++ dom/media/platforms/ReorderQueue.h | 28 + dom/media/platforms/SimpleMap.h | 55 + dom/media/platforms/agnostic/AOMDecoder.cpp | 1066 ++++ dom/media/platforms/agnostic/AOMDecoder.h | 287 ++ .../platforms/agnostic/AgnosticDecoderModule.cpp | 218 + .../platforms/agnostic/AgnosticDecoderModule.h | 39 + .../platforms/agnostic/BlankDecoderModule.cpp | 144 + dom/media/platforms/agnostic/BlankDecoderModule.h | 68 + dom/media/platforms/agnostic/DAV1DDecoder.cpp | 382 ++ dom/media/platforms/agnostic/DAV1DDecoder.h | 68 + .../platforms/agnostic/DummyMediaDataDecoder.cpp | 80 + .../platforms/agnostic/DummyMediaDataDecoder.h | 68 + dom/media/platforms/agnostic/NullDecoderModule.cpp | 57 + dom/media/platforms/agnostic/OpusDecoder.cpp | 380 ++ dom/media/platforms/agnostic/OpusDecoder.h | 70 + dom/media/platforms/agnostic/TheoraDecoder.cpp | 267 + dom/media/platforms/agnostic/TheoraDecoder.h | 64 + dom/media/platforms/agnostic/VPXDecoder.cpp | 676 +++ dom/media/platforms/agnostic/VPXDecoder.h | 208 + dom/media/platforms/agnostic/VorbisDecoder.cpp | 364 ++ dom/media/platforms/agnostic/VorbisDecoder.h | 66 + dom/media/platforms/agnostic/WAVDecoder.cpp | 162 + dom/media/platforms/agnostic/WAVDecoder.h | 44 + dom/media/platforms/agnostic/bytestreams/Adts.cpp | 94 + dom/media/platforms/agnostic/bytestreams/Adts.h | 22 + .../platforms/agnostic/bytestreams/AnnexB.cpp | 364 ++ dom/media/platforms/agnostic/bytestreams/AnnexB.h | 66 + dom/media/platforms/agnostic/bytestreams/H264.cpp | 1356 +++++ dom/media/platforms/agnostic/bytestreams/H264.h | 525 ++ .../agnostic/bytestreams/gtest/TestAnnexB.cpp | 144 + .../platforms/agnostic/bytestreams/gtest/moz.build | 11 + dom/media/platforms/agnostic/bytestreams/moz.build | 35 + .../agnostic/eme/ChromiumCDMVideoDecoder.cpp | 156 + .../agnostic/eme/ChromiumCDMVideoDecoder.h | 54 + .../agnostic/eme/DecryptThroughputLimit.h | 103 + .../platforms/agnostic/eme/EMEDecoderModule.cpp | 479 ++ .../platforms/agnostic/eme/EMEDecoderModule.h | 79 + .../agnostic/eme/SamplesWaitingForKey.cpp | 79 + .../platforms/agnostic/eme/SamplesWaitingForKey.h | 68 + dom/media/platforms/agnostic/eme/moz.build | 22 + .../platforms/agnostic/gmp/GMPDecoderModule.cpp | 94 + .../platforms/agnostic/gmp/GMPDecoderModule.h | 58 + .../platforms/agnostic/gmp/GMPVideoDecoder.cpp | 489 ++ dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h | 129 + dom/media/platforms/agnostic/gmp/moz.build | 24 + dom/media/platforms/android/AndroidDataEncoder.cpp | 534 ++ dom/media/platforms/android/AndroidDataEncoder.h | 110 + .../platforms/android/AndroidDecoderModule.cpp | 243 + dom/media/platforms/android/AndroidDecoderModule.h | 60 + .../platforms/android/AndroidEncoderModule.cpp | 56 + dom/media/platforms/android/AndroidEncoderModule.h | 23 + dom/media/platforms/android/JavaCallbacksSupport.h | 73 + dom/media/platforms/android/RemoteDataDecoder.cpp | 1136 ++++ dom/media/platforms/android/RemoteDataDecoder.h | 112 + dom/media/platforms/apple/AppleATDecoder.cpp | 672 +++ dom/media/platforms/apple/AppleATDecoder.h | 80 + dom/media/platforms/apple/AppleDecoderModule.cpp | 230 + dom/media/platforms/apple/AppleDecoderModule.h | 62 + dom/media/platforms/apple/AppleEncoderModule.cpp | 25 + dom/media/platforms/apple/AppleEncoderModule.h | 27 + dom/media/platforms/apple/AppleUtils.h | 88 + dom/media/platforms/apple/AppleVTDecoder.cpp | 761 +++ dom/media/platforms/apple/AppleVTDecoder.h | 145 + dom/media/platforms/apple/AppleVTEncoder.cpp | 628 +++ dom/media/platforms/apple/AppleVTEncoder.h | 85 + dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp | 421 ++ dom/media/platforms/ffmpeg/FFmpegAudioDecoder.h | 65 + dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp | 308 ++ dom/media/platforms/ffmpeg/FFmpegDataDecoder.h | 90 + dom/media/platforms/ffmpeg/FFmpegDecoderModule.cpp | 13 + dom/media/platforms/ffmpeg/FFmpegDecoderModule.h | 129 + dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp | 358 ++ dom/media/platforms/ffmpeg/FFmpegLibWrapper.h | 180 + dom/media/platforms/ffmpeg/FFmpegLibs.h | 50 + dom/media/platforms/ffmpeg/FFmpegLog.h | 23 + dom/media/platforms/ffmpeg/FFmpegRDFTTypes.h | 34 + dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp | 199 + dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h | 45 + dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp | 1627 ++++++ dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h | 233 + .../platforms/ffmpeg/FFmpegVideoFramePool.cpp | 414 ++ dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h | 155 + dom/media/platforms/ffmpeg/README_mozilla | 11 + .../ffmpeg/ffmpeg57/include/COPYING.LGPLv2.1 | 504 ++ .../ffmpeg/ffmpeg57/include/libavcodec/avcodec.h | 5418 ++++++++++++++++++++ .../ffmpeg/ffmpeg57/include/libavcodec/avfft.h | 118 + .../ffmpeg/ffmpeg57/include/libavcodec/vaapi.h | 189 + .../ffmpeg/ffmpeg57/include/libavcodec/vdpau.h | 253 + .../ffmpeg/ffmpeg57/include/libavcodec/version.h | 210 + .../ffmpeg/ffmpeg57/include/libavutil/attributes.h | 168 + .../ffmpeg/ffmpeg57/include/libavutil/avconfig.h | 7 + .../ffmpeg/ffmpeg57/include/libavutil/avutil.h | 343 ++ .../ffmpeg/ffmpeg57/include/libavutil/buffer.h | 274 + .../ffmpeg57/include/libavutil/channel_layout.h | 223 + .../ffmpeg/ffmpeg57/include/libavutil/common.h | 519 ++ .../ffmpeg/ffmpeg57/include/libavutil/cpu.h | 117 + .../ffmpeg/ffmpeg57/include/libavutil/dict.h | 198 + .../ffmpeg/ffmpeg57/include/libavutil/error.h | 126 + .../ffmpeg/ffmpeg57/include/libavutil/frame.h | 713 +++ .../ffmpeg/ffmpeg57/include/libavutil/intfloat.h | 77 + .../ffmpeg/ffmpeg57/include/libavutil/log.h | 359 ++ .../ffmpeg/ffmpeg57/include/libavutil/macros.h | 50 + .../ffmpeg57/include/libavutil/mathematics.h | 165 + .../ffmpeg/ffmpeg57/include/libavutil/mem.h | 406 ++ .../ffmpeg/ffmpeg57/include/libavutil/pixfmt.h | 469 ++ .../ffmpeg/ffmpeg57/include/libavutil/rational.h | 173 + .../ffmpeg/ffmpeg57/include/libavutil/samplefmt.h | 271 + .../ffmpeg/ffmpeg57/include/libavutil/version.h | 129 + dom/media/platforms/ffmpeg/ffmpeg57/moz.build | 31 + .../ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1 | 504 ++ .../ffmpeg/ffmpeg58/include/libavcodec/avcodec.h | 4184 +++++++++++++++ .../ffmpeg/ffmpeg58/include/libavcodec/avfft.h | 118 + .../ffmpeg/ffmpeg58/include/libavcodec/bsf.h | 325 ++ .../ffmpeg/ffmpeg58/include/libavcodec/codec.h | 480 ++ .../ffmpeg58/include/libavcodec/codec_desc.h | 128 + .../ffmpeg/ffmpeg58/include/libavcodec/codec_id.h | 629 +++ .../ffmpeg/ffmpeg58/include/libavcodec/codec_par.h | 234 + .../ffmpeg/ffmpeg58/include/libavcodec/packet.h | 774 +++ .../ffmpeg/ffmpeg58/include/libavcodec/vaapi.h | 86 + .../ffmpeg/ffmpeg58/include/libavcodec/vdpau.h | 176 + .../ffmpeg/ffmpeg58/include/libavcodec/version.h | 137 + .../ffmpeg/ffmpeg58/include/libavutil/attributes.h | 167 + .../ffmpeg/ffmpeg58/include/libavutil/avconfig.h | 6 + .../ffmpeg/ffmpeg58/include/libavutil/avutil.h | 365 ++ .../ffmpeg/ffmpeg58/include/libavutil/buffer.h | 291 ++ .../ffmpeg58/include/libavutil/channel_layout.h | 232 + .../ffmpeg/ffmpeg58/include/libavutil/common.h | 560 ++ .../ffmpeg/ffmpeg58/include/libavutil/cpu.h | 130 + .../ffmpeg/ffmpeg58/include/libavutil/dict.h | 200 + .../ffmpeg/ffmpeg58/include/libavutil/error.h | 126 + .../ffmpeg/ffmpeg58/include/libavutil/frame.h | 893 ++++ .../ffmpeg/ffmpeg58/include/libavutil/hwcontext.h | 584 +++ .../ffmpeg58/include/libavutil/hwcontext_drm.h | 169 + .../ffmpeg58/include/libavutil/hwcontext_vaapi.h | 117 + .../ffmpeg/ffmpeg58/include/libavutil/intfloat.h | 77 + .../ffmpeg/ffmpeg58/include/libavutil/log.h | 362 ++ .../ffmpeg/ffmpeg58/include/libavutil/macros.h | 50 + .../ffmpeg58/include/libavutil/mathematics.h | 242 + .../ffmpeg/ffmpeg58/include/libavutil/mem.h | 700 +++ .../ffmpeg/ffmpeg58/include/libavutil/pixfmt.h | 529 ++ .../ffmpeg/ffmpeg58/include/libavutil/rational.h | 214 + .../ffmpeg/ffmpeg58/include/libavutil/samplefmt.h | 272 + .../ffmpeg/ffmpeg58/include/libavutil/version.h | 139 + dom/media/platforms/ffmpeg/ffmpeg58/moz.build | 39 + .../ffmpeg/ffmpeg59/include/COPYING.LGPLv2.1 | 504 ++ .../ffmpeg/ffmpeg59/include/libavcodec/avcodec.h | 3204 ++++++++++++ .../ffmpeg/ffmpeg59/include/libavcodec/avfft.h | 119 + .../ffmpeg/ffmpeg59/include/libavcodec/bsf.h | 320 ++ .../ffmpeg/ffmpeg59/include/libavcodec/codec.h | 513 ++ .../ffmpeg59/include/libavcodec/codec_desc.h | 128 + .../ffmpeg/ffmpeg59/include/libavcodec/codec_id.h | 637 +++ .../ffmpeg/ffmpeg59/include/libavcodec/codec_par.h | 236 + .../ffmpeg/ffmpeg59/include/libavcodec/defs.h | 171 + .../ffmpeg/ffmpeg59/include/libavcodec/packet.h | 724 +++ .../ffmpeg/ffmpeg59/include/libavcodec/vdpau.h | 156 + .../ffmpeg/ffmpeg59/include/libavcodec/version.h | 67 + .../ffmpeg/ffmpeg59/include/libavutil/attributes.h | 173 + .../ffmpeg/ffmpeg59/include/libavutil/avconfig.h | 6 + .../ffmpeg/ffmpeg59/include/libavutil/avutil.h | 366 ++ .../ffmpeg/ffmpeg59/include/libavutil/buffer.h | 324 ++ .../ffmpeg59/include/libavutil/channel_layout.h | 270 + .../ffmpeg/ffmpeg59/include/libavutil/common.h | 590 +++ .../ffmpeg/ffmpeg59/include/libavutil/cpu.h | 138 + .../ffmpeg/ffmpeg59/include/libavutil/dict.h | 215 + .../ffmpeg/ffmpeg59/include/libavutil/error.h | 158 + .../ffmpeg/ffmpeg59/include/libavutil/frame.h | 927 ++++ .../ffmpeg/ffmpeg59/include/libavutil/hwcontext.h | 601 +++ .../ffmpeg59/include/libavutil/hwcontext_drm.h | 169 + .../ffmpeg59/include/libavutil/hwcontext_vaapi.h | 117 + .../ffmpeg/ffmpeg59/include/libavutil/intfloat.h | 73 + .../ffmpeg/ffmpeg59/include/libavutil/log.h | 388 ++ .../ffmpeg/ffmpeg59/include/libavutil/macros.h | 87 + .../ffmpeg59/include/libavutil/mathematics.h | 247 + .../ffmpeg/ffmpeg59/include/libavutil/mem.h | 708 +++ .../ffmpeg/ffmpeg59/include/libavutil/pixfmt.h | 808 +++ .../ffmpeg/ffmpeg59/include/libavutil/rational.h | 221 + .../ffmpeg/ffmpeg59/include/libavutil/samplefmt.h | 276 + .../ffmpeg/ffmpeg59/include/libavutil/version.h | 118 + dom/media/platforms/ffmpeg/ffmpeg59/moz.build | 39 + .../ffmpeg/ffmpeg60/include/COPYING.LGPLv2.1 | 504 ++ .../ffmpeg/ffmpeg60/include/libavcodec/avcodec.h | 3230 ++++++++++++ .../ffmpeg/ffmpeg60/include/libavcodec/avdct.h | 85 + .../ffmpeg/ffmpeg60/include/libavcodec/avfft.h | 119 + .../ffmpeg/ffmpeg60/include/libavcodec/bsf.h | 335 ++ .../ffmpeg/ffmpeg60/include/libavcodec/codec.h | 387 ++ .../ffmpeg60/include/libavcodec/codec_desc.h | 128 + .../ffmpeg/ffmpeg60/include/libavcodec/codec_id.h | 669 +++ .../ffmpeg/ffmpeg60/include/libavcodec/codec_par.h | 247 + .../ffmpeg/ffmpeg60/include/libavcodec/defs.h | 203 + .../ffmpeg/ffmpeg60/include/libavcodec/packet.h | 730 +++ .../ffmpeg/ffmpeg60/include/libavcodec/vdpau.h | 156 + .../ffmpeg/ffmpeg60/include/libavcodec/version.h | 45 + .../ffmpeg60/include/libavcodec/version_major.h | 52 + .../ffmpeg/ffmpeg60/include/libavutil/attributes.h | 173 + .../ffmpeg/ffmpeg60/include/libavutil/avconfig.h | 6 + .../ffmpeg/ffmpeg60/include/libavutil/avutil.h | 371 ++ .../ffmpeg/ffmpeg60/include/libavutil/buffer.h | 324 ++ .../ffmpeg60/include/libavutil/channel_layout.h | 842 +++ .../ffmpeg/ffmpeg60/include/libavutil/common.h | 589 +++ .../ffmpeg/ffmpeg60/include/libavutil/cpu.h | 150 + .../ffmpeg/ffmpeg60/include/libavutil/dict.h | 259 + .../ffmpeg/ffmpeg60/include/libavutil/error.h | 158 + .../ffmpeg/ffmpeg60/include/libavutil/frame.h | 960 ++++ .../ffmpeg/ffmpeg60/include/libavutil/hwcontext.h | 606 +++ .../ffmpeg60/include/libavutil/hwcontext_drm.h | 169 + .../ffmpeg60/include/libavutil/hwcontext_vaapi.h | 117 + .../ffmpeg/ffmpeg60/include/libavutil/intfloat.h | 73 + .../ffmpeg/ffmpeg60/include/libavutil/log.h | 388 ++ .../ffmpeg/ffmpeg60/include/libavutil/macros.h | 87 + .../ffmpeg60/include/libavutil/mathematics.h | 249 + .../ffmpeg/ffmpeg60/include/libavutil/mem.h | 613 +++ .../ffmpeg/ffmpeg60/include/libavutil/pixfmt.h | 891 ++++ .../ffmpeg/ffmpeg60/include/libavutil/rational.h | 222 + .../ffmpeg/ffmpeg60/include/libavutil/samplefmt.h | 274 + .../ffmpeg/ffmpeg60/include/libavutil/version.h | 122 + dom/media/platforms/ffmpeg/ffmpeg60/moz.build | 39 + .../platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp | 130 + .../platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.h | 37 + dom/media/platforms/ffmpeg/ffvpx/moz.build | 50 + .../ffmpeg/libav53/include/COPYING.LGPLv2.1 | 504 ++ .../ffmpeg/libav53/include/libavcodec/avcodec.h | 4761 +++++++++++++++++ .../ffmpeg/libav53/include/libavcodec/avfft.h | 99 + .../ffmpeg/libav53/include/libavcodec/dxva2.h | 71 + .../libav53/include/libavcodec/old_codec_ids.h | 398 ++ .../ffmpeg/libav53/include/libavcodec/opt.h | 34 + .../ffmpeg/libav53/include/libavcodec/vaapi.h | 167 + .../ffmpeg/libav53/include/libavcodec/vda.h | 144 + .../ffmpeg/libav53/include/libavcodec/vdpau.h | 88 + .../ffmpeg/libav53/include/libavcodec/version.h | 126 + .../ffmpeg/libav53/include/libavcodec/xvmc.h | 151 + .../ffmpeg/libav53/include/libavutil/adler32.h | 43 + .../ffmpeg/libav53/include/libavutil/aes.h | 57 + .../ffmpeg/libav53/include/libavutil/attributes.h | 136 + .../ffmpeg/libav53/include/libavutil/audio_fifo.h | 146 + .../libav53/include/libavutil/audioconvert.h | 130 + .../ffmpeg/libav53/include/libavutil/avassert.h | 66 + .../ffmpeg/libav53/include/libavutil/avconfig.h | 6 + .../ffmpeg/libav53/include/libavutil/avstring.h | 175 + .../ffmpeg/libav53/include/libavutil/avutil.h | 326 ++ .../ffmpeg/libav53/include/libavutil/base64.h | 65 + .../ffmpeg/libav53/include/libavutil/blowfish.h | 77 + .../ffmpeg/libav53/include/libavutil/bprint.h | 169 + .../ffmpeg/libav53/include/libavutil/bswap.h | 109 + .../ffmpeg/libav53/include/libavutil/common.h | 398 ++ .../ffmpeg/libav53/include/libavutil/cpu.h | 56 + .../ffmpeg/libav53/include/libavutil/crc.h | 44 + .../ffmpeg/libav53/include/libavutil/dict.h | 121 + .../ffmpeg/libav53/include/libavutil/error.h | 81 + .../ffmpeg/libav53/include/libavutil/eval.h | 113 + .../ffmpeg/libav53/include/libavutil/fifo.h | 141 + .../ffmpeg/libav53/include/libavutil/file.h | 52 + .../ffmpeg/libav53/include/libavutil/imgutils.h | 138 + .../ffmpeg/libav53/include/libavutil/intfloat.h | 73 + .../libav53/include/libavutil/intfloat_readwrite.h | 40 + .../libav53/include/libavutil/intreadwrite.h | 522 ++ .../ffmpeg/libav53/include/libavutil/lfg.h | 62 + .../ffmpeg/libav53/include/libavutil/log.h | 172 + .../ffmpeg/libav53/include/libavutil/lzo.h | 77 + .../ffmpeg/libav53/include/libavutil/mathematics.h | 122 + .../ffmpeg/libav53/include/libavutil/md5.h | 46 + .../ffmpeg/libav53/include/libavutil/mem.h | 136 + .../libav53/include/libavutil/old_pix_fmts.h | 171 + .../ffmpeg/libav53/include/libavutil/opt.h | 591 +++ .../ffmpeg/libav53/include/libavutil/parseutils.h | 124 + .../ffmpeg/libav53/include/libavutil/pixdesc.h | 177 + .../ffmpeg/libav53/include/libavutil/pixfmt.h | 198 + .../ffmpeg/libav53/include/libavutil/random_seed.h | 44 + .../ffmpeg/libav53/include/libavutil/rational.h | 144 + .../ffmpeg/libav53/include/libavutil/samplefmt.h | 148 + .../ffmpeg/libav53/include/libavutil/sha.h | 66 + .../ffmpeg/libav53/include/libavutil/time.h | 41 + .../ffmpeg/libav53/include/libavutil/timecode.h | 140 + .../ffmpeg/libav53/include/libavutil/timestamp.h | 74 + .../ffmpeg/libav53/include/libavutil/version.h | 132 + .../ffmpeg/libav53/include/libavutil/xtea.h | 62 + dom/media/platforms/ffmpeg/libav53/moz.build | 23 + .../ffmpeg/libav54/include/COPYING.LGPLv2.1 | 504 ++ .../ffmpeg/libav54/include/libavcodec/avcodec.h | 4658 +++++++++++++++++ .../ffmpeg/libav54/include/libavcodec/avfft.h | 116 + .../ffmpeg/libav54/include/libavcodec/dxva2.h | 88 + .../libav54/include/libavcodec/old_codec_ids.h | 366 ++ .../ffmpeg/libav54/include/libavcodec/vaapi.h | 173 + .../ffmpeg/libav54/include/libavcodec/vda.h | 217 + .../ffmpeg/libav54/include/libavcodec/vdpau.h | 94 + .../ffmpeg/libav54/include/libavcodec/version.h | 95 + .../ffmpeg/libav54/include/libavcodec/xvmc.h | 168 + .../ffmpeg/libav54/include/libavutil/adler32.h | 43 + .../ffmpeg/libav54/include/libavutil/aes.h | 67 + .../ffmpeg/libav54/include/libavutil/attributes.h | 122 + .../ffmpeg/libav54/include/libavutil/audio_fifo.h | 146 + .../libav54/include/libavutil/audioconvert.h | 6 + .../ffmpeg/libav54/include/libavutil/avassert.h | 66 + .../ffmpeg/libav54/include/libavutil/avconfig.h | 6 + .../ffmpeg/libav54/include/libavutil/avstring.h | 191 + .../ffmpeg/libav54/include/libavutil/avutil.h | 275 + .../ffmpeg/libav54/include/libavutil/base64.h | 65 + .../ffmpeg/libav54/include/libavutil/blowfish.h | 76 + .../ffmpeg/libav54/include/libavutil/bswap.h | 109 + .../libav54/include/libavutil/channel_layout.h | 182 + .../ffmpeg/libav54/include/libavutil/common.h | 406 ++ .../ffmpeg/libav54/include/libavutil/cpu.h | 84 + .../ffmpeg/libav54/include/libavutil/crc.h | 74 + .../ffmpeg/libav54/include/libavutil/dict.h | 129 + .../ffmpeg/libav54/include/libavutil/error.h | 83 + .../ffmpeg/libav54/include/libavutil/eval.h | 113 + .../ffmpeg/libav54/include/libavutil/fifo.h | 131 + .../ffmpeg/libav54/include/libavutil/file.h | 54 + .../ffmpeg/libav54/include/libavutil/imgutils.h | 138 + .../ffmpeg/libav54/include/libavutil/intfloat.h | 77 + .../libav54/include/libavutil/intfloat_readwrite.h | 40 + .../libav54/include/libavutil/intreadwrite.h | 549 ++ .../ffmpeg/libav54/include/libavutil/lfg.h | 62 + .../ffmpeg/libav54/include/libavutil/log.h | 173 + .../ffmpeg/libav54/include/libavutil/lzo.h | 66 + .../ffmpeg/libav54/include/libavutil/mathematics.h | 111 + .../ffmpeg/libav54/include/libavutil/md5.h | 51 + .../ffmpeg/libav54/include/libavutil/mem.h | 183 + .../libav54/include/libavutil/old_pix_fmts.h | 128 + .../ffmpeg/libav54/include/libavutil/opt.h | 516 ++ .../ffmpeg/libav54/include/libavutil/parseutils.h | 124 + .../ffmpeg/libav54/include/libavutil/pixdesc.h | 223 + .../ffmpeg/libav54/include/libavutil/pixfmt.h | 268 + .../ffmpeg/libav54/include/libavutil/random_seed.h | 44 + .../ffmpeg/libav54/include/libavutil/rational.h | 155 + .../ffmpeg/libav54/include/libavutil/samplefmt.h | 220 + .../ffmpeg/libav54/include/libavutil/sha.h | 76 + .../ffmpeg/libav54/include/libavutil/time.h | 39 + .../ffmpeg/libav54/include/libavutil/version.h | 87 + .../ffmpeg/libav54/include/libavutil/xtea.h | 61 + dom/media/platforms/ffmpeg/libav54/moz.build | 23 + .../ffmpeg/libav55/include/COPYING.LGPLv2.1 | 504 ++ .../ffmpeg/libav55/include/libavcodec/avcodec.h | 4356 ++++++++++++++++ .../ffmpeg/libav55/include/libavcodec/avfft.h | 118 + .../ffmpeg/libav55/include/libavcodec/dxva2.h | 88 + .../ffmpeg/libav55/include/libavcodec/vaapi.h | 173 + .../ffmpeg/libav55/include/libavcodec/vda.h | 142 + .../ffmpeg/libav55/include/libavcodec/vdpau.h | 189 + .../ffmpeg/libav55/include/libavcodec/version.h | 127 + .../ffmpeg/libav55/include/libavcodec/xvmc.h | 174 + .../ffmpeg/libav55/include/libavutil/adler32.h | 43 + .../ffmpeg/libav55/include/libavutil/aes.h | 67 + .../ffmpeg/libav55/include/libavutil/attributes.h | 126 + .../ffmpeg/libav55/include/libavutil/audio_fifo.h | 146 + .../libav55/include/libavutil/audioconvert.h | 6 + .../ffmpeg/libav55/include/libavutil/avassert.h | 66 + .../ffmpeg/libav55/include/libavutil/avconfig.h | 6 + .../ffmpeg/libav55/include/libavutil/avstring.h | 226 + .../ffmpeg/libav55/include/libavutil/avutil.h | 284 + .../ffmpeg/libav55/include/libavutil/base64.h | 65 + .../ffmpeg/libav55/include/libavutil/blowfish.h | 76 + .../ffmpeg/libav55/include/libavutil/bswap.h | 111 + .../ffmpeg/libav55/include/libavutil/buffer.h | 267 + .../libav55/include/libavutil/channel_layout.h | 186 + .../ffmpeg/libav55/include/libavutil/common.h | 406 ++ .../ffmpeg/libav55/include/libavutil/cpu.h | 87 + .../ffmpeg/libav55/include/libavutil/crc.h | 74 + .../ffmpeg/libav55/include/libavutil/dict.h | 146 + .../libav55/include/libavutil/downmix_info.h | 114 + .../ffmpeg/libav55/include/libavutil/error.h | 82 + .../ffmpeg/libav55/include/libavutil/eval.h | 113 + .../ffmpeg/libav55/include/libavutil/fifo.h | 131 + .../ffmpeg/libav55/include/libavutil/file.h | 54 + .../ffmpeg/libav55/include/libavutil/frame.h | 552 ++ .../ffmpeg/libav55/include/libavutil/hmac.h | 95 + .../ffmpeg/libav55/include/libavutil/imgutils.h | 138 + .../ffmpeg/libav55/include/libavutil/intfloat.h | 77 + .../libav55/include/libavutil/intreadwrite.h | 549 ++ .../ffmpeg/libav55/include/libavutil/lfg.h | 62 + .../ffmpeg/libav55/include/libavutil/log.h | 262 + .../ffmpeg/libav55/include/libavutil/lzo.h | 66 + .../ffmpeg/libav55/include/libavutil/macros.h | 48 + .../ffmpeg/libav55/include/libavutil/mathematics.h | 111 + .../ffmpeg/libav55/include/libavutil/md5.h | 51 + .../ffmpeg/libav55/include/libavutil/mem.h | 265 + .../libav55/include/libavutil/old_pix_fmts.h | 134 + .../ffmpeg/libav55/include/libavutil/opt.h | 516 ++ .../ffmpeg/libav55/include/libavutil/parseutils.h | 124 + .../ffmpeg/libav55/include/libavutil/pixdesc.h | 276 + .../ffmpeg/libav55/include/libavutil/pixfmt.h | 283 + .../ffmpeg/libav55/include/libavutil/random_seed.h | 44 + .../ffmpeg/libav55/include/libavutil/rational.h | 155 + .../ffmpeg/libav55/include/libavutil/samplefmt.h | 220 + .../ffmpeg/libav55/include/libavutil/sha.h | 76 + .../ffmpeg/libav55/include/libavutil/stereo3d.h | 147 + .../ffmpeg/libav55/include/libavutil/time.h | 39 + .../ffmpeg/libav55/include/libavutil/version.h | 116 + .../ffmpeg/libav55/include/libavutil/xtea.h | 61 + dom/media/platforms/ffmpeg/libav55/moz.build | 29 + dom/media/platforms/ffmpeg/moz.build | 28 + dom/media/platforms/moz.build | 141 + dom/media/platforms/omx/OmxCoreLibLinker.cpp | 113 + dom/media/platforms/omx/OmxCoreLibLinker.h | 36 + dom/media/platforms/omx/OmxDataDecoder.cpp | 1001 ++++ dom/media/platforms/omx/OmxDataDecoder.h | 224 + dom/media/platforms/omx/OmxDecoderModule.cpp | 59 + dom/media/platforms/omx/OmxDecoderModule.h | 33 + dom/media/platforms/omx/OmxFunctionList.h | 13 + dom/media/platforms/omx/OmxPlatformLayer.cpp | 307 ++ dom/media/platforms/omx/OmxPlatformLayer.h | 103 + dom/media/platforms/omx/OmxPromiseLayer.cpp | 355 ++ dom/media/platforms/omx/OmxPromiseLayer.h | 243 + dom/media/platforms/omx/PureOmxPlatformLayer.cpp | 405 ++ dom/media/platforms/omx/PureOmxPlatformLayer.h | 110 + dom/media/platforms/omx/moz.build | 36 + dom/media/platforms/wmf/DXVA2Manager.cpp | 1512 ++++++ dom/media/platforms/wmf/DXVA2Manager.h | 94 + dom/media/platforms/wmf/MFCDMExtra.h | 307 ++ dom/media/platforms/wmf/MFCDMProxy.cpp | 74 + dom/media/platforms/wmf/MFCDMProxy.h | 71 + dom/media/platforms/wmf/MFCDMSession.cpp | 314 ++ dom/media/platforms/wmf/MFCDMSession.h | 93 + .../platforms/wmf/MFContentProtectionManager.cpp | 164 + .../platforms/wmf/MFContentProtectionManager.h | 79 + .../platforms/wmf/MFMediaEngineAudioStream.cpp | 137 + dom/media/platforms/wmf/MFMediaEngineAudioStream.h | 51 + .../platforms/wmf/MFMediaEngineDecoderModule.cpp | 174 + .../platforms/wmf/MFMediaEngineDecoderModule.h | 45 + dom/media/platforms/wmf/MFMediaEngineExtension.cpp | 88 + dom/media/platforms/wmf/MFMediaEngineExtension.h | 49 + dom/media/platforms/wmf/MFMediaEngineExtra.h | 715 +++ dom/media/platforms/wmf/MFMediaEngineNotify.cpp | 32 + dom/media/platforms/wmf/MFMediaEngineNotify.h | 55 + dom/media/platforms/wmf/MFMediaEngineStream.cpp | 596 +++ dom/media/platforms/wmf/MFMediaEngineStream.h | 228 + .../platforms/wmf/MFMediaEngineVideoStream.cpp | 372 ++ dom/media/platforms/wmf/MFMediaEngineVideoStream.h | 107 + dom/media/platforms/wmf/MFMediaSource.cpp | 605 +++ dom/media/platforms/wmf/MFMediaSource.h | 188 + dom/media/platforms/wmf/MFPMPHostWrapper.cpp | 66 + dom/media/platforms/wmf/MFPMPHostWrapper.h | 42 + dom/media/platforms/wmf/MFTDecoder.cpp | 430 ++ dom/media/platforms/wmf/MFTDecoder.h | 132 + dom/media/platforms/wmf/MFTEncoder.cpp | 754 +++ dom/media/platforms/wmf/MFTEncoder.h | 144 + dom/media/platforms/wmf/WMF.h | 198 + dom/media/platforms/wmf/WMFAudioMFTManager.cpp | 315 ++ dom/media/platforms/wmf/WMFAudioMFTManager.h | 69 + dom/media/platforms/wmf/WMFDataEncoderUtils.h | 165 + dom/media/platforms/wmf/WMFDecoderModule.cpp | 454 ++ dom/media/platforms/wmf/WMFDecoderModule.h | 58 + dom/media/platforms/wmf/WMFEncoderModule.cpp | 43 + dom/media/platforms/wmf/WMFEncoderModule.h | 24 + dom/media/platforms/wmf/WMFMediaDataDecoder.cpp | 279 + dom/media/platforms/wmf/WMFMediaDataDecoder.h | 182 + dom/media/platforms/wmf/WMFMediaDataEncoder.h | 337 ++ dom/media/platforms/wmf/WMFUtils.cpp | 632 +++ dom/media/platforms/wmf/WMFUtils.h | 104 + dom/media/platforms/wmf/WMFVideoMFTManager.cpp | 1096 ++++ dom/media/platforms/wmf/WMFVideoMFTManager.h | 132 + .../wmf/gtest/TestCanCreateMFTDecoder.cpp | 21 + dom/media/platforms/wmf/gtest/moz.build | 15 + dom/media/platforms/wmf/moz.build | 85 + dom/media/platforms/wrappers/AudioTrimmer.cpp | 221 + dom/media/platforms/wrappers/AudioTrimmer.h | 56 + .../platforms/wrappers/MediaChangeMonitor.cpp | 951 ++++ dom/media/platforms/wrappers/MediaChangeMonitor.h | 142 + .../platforms/wrappers/MediaDataDecoderProxy.cpp | 149 + .../platforms/wrappers/MediaDataDecoderProxy.h | 64 + 470 files changed, 131023 insertions(+) create mode 100644 dom/media/platforms/AllocationPolicy.cpp create mode 100644 dom/media/platforms/AllocationPolicy.h create mode 100644 dom/media/platforms/MediaCodecsSupport.cpp create mode 100644 dom/media/platforms/MediaCodecsSupport.h create mode 100644 dom/media/platforms/MediaTelemetryConstants.h create mode 100644 dom/media/platforms/PDMFactory.cpp create mode 100644 dom/media/platforms/PDMFactory.h create mode 100644 dom/media/platforms/PEMFactory.cpp create mode 100644 dom/media/platforms/PEMFactory.h create mode 100644 dom/media/platforms/PlatformDecoderModule.cpp create mode 100644 dom/media/platforms/PlatformDecoderModule.h create mode 100644 dom/media/platforms/PlatformEncoderModule.h create mode 100644 dom/media/platforms/ReorderQueue.h create mode 100644 dom/media/platforms/SimpleMap.h create mode 100644 dom/media/platforms/agnostic/AOMDecoder.cpp create mode 100644 dom/media/platforms/agnostic/AOMDecoder.h create mode 100644 dom/media/platforms/agnostic/AgnosticDecoderModule.cpp create mode 100644 dom/media/platforms/agnostic/AgnosticDecoderModule.h create mode 100644 dom/media/platforms/agnostic/BlankDecoderModule.cpp create mode 100644 dom/media/platforms/agnostic/BlankDecoderModule.h create mode 100644 dom/media/platforms/agnostic/DAV1DDecoder.cpp create mode 100644 dom/media/platforms/agnostic/DAV1DDecoder.h create mode 100644 dom/media/platforms/agnostic/DummyMediaDataDecoder.cpp create mode 100644 dom/media/platforms/agnostic/DummyMediaDataDecoder.h create mode 100644 dom/media/platforms/agnostic/NullDecoderModule.cpp create mode 100644 dom/media/platforms/agnostic/OpusDecoder.cpp create mode 100644 dom/media/platforms/agnostic/OpusDecoder.h create mode 100644 dom/media/platforms/agnostic/TheoraDecoder.cpp create mode 100644 dom/media/platforms/agnostic/TheoraDecoder.h create mode 100644 dom/media/platforms/agnostic/VPXDecoder.cpp create mode 100644 dom/media/platforms/agnostic/VPXDecoder.h create mode 100644 dom/media/platforms/agnostic/VorbisDecoder.cpp create mode 100644 dom/media/platforms/agnostic/VorbisDecoder.h create mode 100644 dom/media/platforms/agnostic/WAVDecoder.cpp create mode 100644 dom/media/platforms/agnostic/WAVDecoder.h create mode 100644 dom/media/platforms/agnostic/bytestreams/Adts.cpp create mode 100644 dom/media/platforms/agnostic/bytestreams/Adts.h create mode 100644 dom/media/platforms/agnostic/bytestreams/AnnexB.cpp create mode 100644 dom/media/platforms/agnostic/bytestreams/AnnexB.h create mode 100644 dom/media/platforms/agnostic/bytestreams/H264.cpp create mode 100644 dom/media/platforms/agnostic/bytestreams/H264.h create mode 100644 dom/media/platforms/agnostic/bytestreams/gtest/TestAnnexB.cpp create mode 100644 dom/media/platforms/agnostic/bytestreams/gtest/moz.build create mode 100644 dom/media/platforms/agnostic/bytestreams/moz.build create mode 100644 dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp create mode 100644 dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.h create mode 100644 dom/media/platforms/agnostic/eme/DecryptThroughputLimit.h create mode 100644 dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp create mode 100644 dom/media/platforms/agnostic/eme/EMEDecoderModule.h create mode 100644 dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp create mode 100644 dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h create mode 100644 dom/media/platforms/agnostic/eme/moz.build create mode 100644 dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp create mode 100644 dom/media/platforms/agnostic/gmp/GMPDecoderModule.h create mode 100644 dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp create mode 100644 dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h create mode 100644 dom/media/platforms/agnostic/gmp/moz.build create mode 100644 dom/media/platforms/android/AndroidDataEncoder.cpp create mode 100644 dom/media/platforms/android/AndroidDataEncoder.h create mode 100644 dom/media/platforms/android/AndroidDecoderModule.cpp create mode 100644 dom/media/platforms/android/AndroidDecoderModule.h create mode 100644 dom/media/platforms/android/AndroidEncoderModule.cpp create mode 100644 dom/media/platforms/android/AndroidEncoderModule.h create mode 100644 dom/media/platforms/android/JavaCallbacksSupport.h create mode 100644 dom/media/platforms/android/RemoteDataDecoder.cpp create mode 100644 dom/media/platforms/android/RemoteDataDecoder.h create mode 100644 dom/media/platforms/apple/AppleATDecoder.cpp create mode 100644 dom/media/platforms/apple/AppleATDecoder.h create mode 100644 dom/media/platforms/apple/AppleDecoderModule.cpp create mode 100644 dom/media/platforms/apple/AppleDecoderModule.h create mode 100644 dom/media/platforms/apple/AppleEncoderModule.cpp create mode 100644 dom/media/platforms/apple/AppleEncoderModule.h create mode 100644 dom/media/platforms/apple/AppleUtils.h create mode 100644 dom/media/platforms/apple/AppleVTDecoder.cpp create mode 100644 dom/media/platforms/apple/AppleVTDecoder.h create mode 100644 dom/media/platforms/apple/AppleVTEncoder.cpp create mode 100644 dom/media/platforms/apple/AppleVTEncoder.h create mode 100644 dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp create mode 100644 dom/media/platforms/ffmpeg/FFmpegAudioDecoder.h create mode 100644 dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp create mode 100644 dom/media/platforms/ffmpeg/FFmpegDataDecoder.h create mode 100644 dom/media/platforms/ffmpeg/FFmpegDecoderModule.cpp create mode 100644 dom/media/platforms/ffmpeg/FFmpegDecoderModule.h create mode 100644 dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp create mode 100644 dom/media/platforms/ffmpeg/FFmpegLibWrapper.h create mode 100644 dom/media/platforms/ffmpeg/FFmpegLibs.h create mode 100644 dom/media/platforms/ffmpeg/FFmpegLog.h create mode 100644 dom/media/platforms/ffmpeg/FFmpegRDFTTypes.h create mode 100644 dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp create mode 100644 dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h create mode 100644 dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp create mode 100644 dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h create mode 100644 dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp create mode 100644 dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h create mode 100644 dom/media/platforms/ffmpeg/README_mozilla create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/COPYING.LGPLv2.1 create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavcodec/avcodec.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavcodec/avfft.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavcodec/vaapi.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavcodec/vdpau.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavcodec/version.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/attributes.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/avconfig.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/avutil.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/buffer.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/channel_layout.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/common.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/cpu.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/dict.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/error.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/frame.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/intfloat.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/log.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/macros.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/mathematics.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/mem.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/pixfmt.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/rational.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/samplefmt.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/version.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg57/moz.build create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1 create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/bsf.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/codec.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/codec_desc.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/codec_id.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/codec_par.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/packet.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext_drm.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext_vaapi.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg58/moz.build create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/COPYING.LGPLv2.1 create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/avcodec.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/avfft.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/bsf.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/codec.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/codec_desc.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/codec_id.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/codec_par.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/defs.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/packet.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/vdpau.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavcodec/version.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/attributes.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/avconfig.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/avutil.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/buffer.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/channel_layout.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/common.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/cpu.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/dict.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/error.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/frame.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/hwcontext.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/hwcontext_drm.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/hwcontext_vaapi.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/intfloat.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/log.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/macros.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/mathematics.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/mem.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/pixfmt.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/rational.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/samplefmt.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/include/libavutil/version.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg59/moz.build create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/COPYING.LGPLv2.1 create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avcodec.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avdct.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avfft.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/bsf.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_desc.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_id.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_par.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/defs.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/packet.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/vdpau.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/version.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/version_major.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/attributes.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/avconfig.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/avutil.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/buffer.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/channel_layout.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/common.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/cpu.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/dict.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/error.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/frame.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/hwcontext.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/hwcontext_drm.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/hwcontext_vaapi.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/intfloat.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/log.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/macros.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/mathematics.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/mem.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/pixfmt.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/rational.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/samplefmt.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/version.h create mode 100644 dom/media/platforms/ffmpeg/ffmpeg60/moz.build create mode 100644 dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp create mode 100644 dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.h create mode 100644 dom/media/platforms/ffmpeg/ffvpx/moz.build create mode 100644 dom/media/platforms/ffmpeg/libav53/include/COPYING.LGPLv2.1 create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavcodec/avcodec.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavcodec/avfft.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavcodec/dxva2.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavcodec/old_codec_ids.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavcodec/opt.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavcodec/vaapi.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavcodec/vda.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavcodec/vdpau.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavcodec/version.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavcodec/xvmc.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/adler32.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/aes.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/attributes.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/audio_fifo.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/audioconvert.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/avassert.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/avconfig.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/avstring.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/avutil.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/base64.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/blowfish.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/bprint.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/bswap.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/common.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/cpu.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/crc.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/dict.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/error.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/eval.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/fifo.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/file.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/imgutils.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/intfloat.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/intfloat_readwrite.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/intreadwrite.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/lfg.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/log.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/lzo.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/mathematics.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/md5.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/mem.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/old_pix_fmts.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/opt.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/parseutils.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/pixdesc.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/pixfmt.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/random_seed.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/rational.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/samplefmt.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/sha.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/time.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/timecode.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/timestamp.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/version.h create mode 100644 dom/media/platforms/ffmpeg/libav53/include/libavutil/xtea.h create mode 100644 dom/media/platforms/ffmpeg/libav53/moz.build create mode 100644 dom/media/platforms/ffmpeg/libav54/include/COPYING.LGPLv2.1 create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavcodec/avcodec.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavcodec/avfft.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavcodec/dxva2.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavcodec/old_codec_ids.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavcodec/vaapi.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavcodec/vda.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavcodec/vdpau.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavcodec/version.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavcodec/xvmc.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/adler32.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/aes.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/attributes.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/audio_fifo.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/audioconvert.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/avassert.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/avconfig.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/avstring.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/avutil.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/base64.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/blowfish.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/bswap.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/channel_layout.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/common.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/cpu.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/crc.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/dict.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/error.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/eval.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/fifo.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/file.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/imgutils.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/intfloat.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/intfloat_readwrite.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/intreadwrite.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/lfg.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/log.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/lzo.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/mathematics.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/md5.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/mem.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/old_pix_fmts.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/opt.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/parseutils.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/pixdesc.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/pixfmt.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/random_seed.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/rational.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/samplefmt.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/sha.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/time.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/version.h create mode 100644 dom/media/platforms/ffmpeg/libav54/include/libavutil/xtea.h create mode 100644 dom/media/platforms/ffmpeg/libav54/moz.build create mode 100644 dom/media/platforms/ffmpeg/libav55/include/COPYING.LGPLv2.1 create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavcodec/avcodec.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavcodec/avfft.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavcodec/dxva2.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavcodec/vaapi.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavcodec/vda.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavcodec/vdpau.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavcodec/version.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavcodec/xvmc.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/adler32.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/aes.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/attributes.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/audio_fifo.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/audioconvert.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/avassert.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/avconfig.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/avstring.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/avutil.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/base64.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/blowfish.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/bswap.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/buffer.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/channel_layout.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/common.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/cpu.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/crc.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/dict.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/downmix_info.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/error.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/eval.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/fifo.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/file.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/frame.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/hmac.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/imgutils.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/intfloat.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/intreadwrite.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/lfg.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/log.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/lzo.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/macros.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/mathematics.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/md5.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/mem.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/old_pix_fmts.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/opt.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/parseutils.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/pixdesc.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/pixfmt.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/random_seed.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/rational.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/samplefmt.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/sha.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/stereo3d.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/time.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/version.h create mode 100644 dom/media/platforms/ffmpeg/libav55/include/libavutil/xtea.h create mode 100644 dom/media/platforms/ffmpeg/libav55/moz.build create mode 100644 dom/media/platforms/ffmpeg/moz.build create mode 100644 dom/media/platforms/moz.build create mode 100644 dom/media/platforms/omx/OmxCoreLibLinker.cpp create mode 100644 dom/media/platforms/omx/OmxCoreLibLinker.h create mode 100644 dom/media/platforms/omx/OmxDataDecoder.cpp create mode 100644 dom/media/platforms/omx/OmxDataDecoder.h create mode 100644 dom/media/platforms/omx/OmxDecoderModule.cpp create mode 100644 dom/media/platforms/omx/OmxDecoderModule.h create mode 100644 dom/media/platforms/omx/OmxFunctionList.h create mode 100644 dom/media/platforms/omx/OmxPlatformLayer.cpp create mode 100644 dom/media/platforms/omx/OmxPlatformLayer.h create mode 100644 dom/media/platforms/omx/OmxPromiseLayer.cpp create mode 100644 dom/media/platforms/omx/OmxPromiseLayer.h create mode 100644 dom/media/platforms/omx/PureOmxPlatformLayer.cpp create mode 100644 dom/media/platforms/omx/PureOmxPlatformLayer.h create mode 100644 dom/media/platforms/omx/moz.build create mode 100644 dom/media/platforms/wmf/DXVA2Manager.cpp create mode 100644 dom/media/platforms/wmf/DXVA2Manager.h create mode 100644 dom/media/platforms/wmf/MFCDMExtra.h create mode 100644 dom/media/platforms/wmf/MFCDMProxy.cpp create mode 100644 dom/media/platforms/wmf/MFCDMProxy.h create mode 100644 dom/media/platforms/wmf/MFCDMSession.cpp create mode 100644 dom/media/platforms/wmf/MFCDMSession.h create mode 100644 dom/media/platforms/wmf/MFContentProtectionManager.cpp create mode 100644 dom/media/platforms/wmf/MFContentProtectionManager.h create mode 100644 dom/media/platforms/wmf/MFMediaEngineAudioStream.cpp create mode 100644 dom/media/platforms/wmf/MFMediaEngineAudioStream.h create mode 100644 dom/media/platforms/wmf/MFMediaEngineDecoderModule.cpp create mode 100644 dom/media/platforms/wmf/MFMediaEngineDecoderModule.h create mode 100644 dom/media/platforms/wmf/MFMediaEngineExtension.cpp create mode 100644 dom/media/platforms/wmf/MFMediaEngineExtension.h create mode 100644 dom/media/platforms/wmf/MFMediaEngineExtra.h create mode 100644 dom/media/platforms/wmf/MFMediaEngineNotify.cpp create mode 100644 dom/media/platforms/wmf/MFMediaEngineNotify.h create mode 100644 dom/media/platforms/wmf/MFMediaEngineStream.cpp create mode 100644 dom/media/platforms/wmf/MFMediaEngineStream.h create mode 100644 dom/media/platforms/wmf/MFMediaEngineVideoStream.cpp create mode 100644 dom/media/platforms/wmf/MFMediaEngineVideoStream.h create mode 100644 dom/media/platforms/wmf/MFMediaSource.cpp create mode 100644 dom/media/platforms/wmf/MFMediaSource.h create mode 100644 dom/media/platforms/wmf/MFPMPHostWrapper.cpp create mode 100644 dom/media/platforms/wmf/MFPMPHostWrapper.h create mode 100644 dom/media/platforms/wmf/MFTDecoder.cpp create mode 100644 dom/media/platforms/wmf/MFTDecoder.h create mode 100644 dom/media/platforms/wmf/MFTEncoder.cpp create mode 100644 dom/media/platforms/wmf/MFTEncoder.h create mode 100644 dom/media/platforms/wmf/WMF.h create mode 100644 dom/media/platforms/wmf/WMFAudioMFTManager.cpp create mode 100644 dom/media/platforms/wmf/WMFAudioMFTManager.h create mode 100644 dom/media/platforms/wmf/WMFDataEncoderUtils.h create mode 100644 dom/media/platforms/wmf/WMFDecoderModule.cpp create mode 100644 dom/media/platforms/wmf/WMFDecoderModule.h create mode 100644 dom/media/platforms/wmf/WMFEncoderModule.cpp create mode 100644 dom/media/platforms/wmf/WMFEncoderModule.h create mode 100644 dom/media/platforms/wmf/WMFMediaDataDecoder.cpp create mode 100644 dom/media/platforms/wmf/WMFMediaDataDecoder.h create mode 100644 dom/media/platforms/wmf/WMFMediaDataEncoder.h create mode 100644 dom/media/platforms/wmf/WMFUtils.cpp create mode 100644 dom/media/platforms/wmf/WMFUtils.h create mode 100644 dom/media/platforms/wmf/WMFVideoMFTManager.cpp create mode 100644 dom/media/platforms/wmf/WMFVideoMFTManager.h create mode 100644 dom/media/platforms/wmf/gtest/TestCanCreateMFTDecoder.cpp create mode 100644 dom/media/platforms/wmf/gtest/moz.build create mode 100644 dom/media/platforms/wmf/moz.build create mode 100644 dom/media/platforms/wrappers/AudioTrimmer.cpp create mode 100644 dom/media/platforms/wrappers/AudioTrimmer.h create mode 100644 dom/media/platforms/wrappers/MediaChangeMonitor.cpp create mode 100644 dom/media/platforms/wrappers/MediaChangeMonitor.h create mode 100644 dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp create mode 100644 dom/media/platforms/wrappers/MediaDataDecoderProxy.h (limited to 'dom/media/platforms') diff --git a/dom/media/platforms/AllocationPolicy.cpp b/dom/media/platforms/AllocationPolicy.cpp new file mode 100644 index 0000000000..a56bf1d3a1 --- /dev/null +++ b/dom/media/platforms/AllocationPolicy.cpp @@ -0,0 +1,241 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "AllocationPolicy.h" + +#include "ImageContainer.h" +#include "MediaInfo.h" +#include "PDMFactory.h" +#include "mozilla/ClearOnShutdown.h" +#include "mozilla/SchedulerGroup.h" +#ifdef MOZ_WIDGET_ANDROID +# include "mozilla/jni/Utils.h" +#endif + +namespace mozilla { + +using TrackType = TrackInfo::TrackType; + +class AllocPolicyImpl::AutoDeallocToken : public Token { + public: + explicit AutoDeallocToken(const RefPtr& aPolicy) + : mPolicy(aPolicy) {} + + private: + ~AutoDeallocToken() { mPolicy->Dealloc(); } + + RefPtr mPolicy; +}; + +AllocPolicyImpl::AllocPolicyImpl(int aDecoderLimit) + : mMaxDecoderLimit(aDecoderLimit), + mMonitor("AllocPolicyImpl"), + mDecoderLimit(aDecoderLimit) {} +AllocPolicyImpl::~AllocPolicyImpl() { RejectAll(); } + +auto AllocPolicyImpl::Alloc() -> RefPtr { + ReentrantMonitorAutoEnter mon(mMonitor); + // No decoder limit set. + if (mDecoderLimit < 0) { + return Promise::CreateAndResolve(new Token(), __func__); + } + + RefPtr p = new PromisePrivate(__func__); + mPromises.push(p); + ResolvePromise(mon); + return p; +} + +void AllocPolicyImpl::Dealloc() { + ReentrantMonitorAutoEnter mon(mMonitor); + ++mDecoderLimit; + ResolvePromise(mon); +} + +void AllocPolicyImpl::ResolvePromise(ReentrantMonitorAutoEnter& aProofOfLock) { + MOZ_ASSERT(mDecoderLimit >= 0); + + if (mDecoderLimit > 0 && !mPromises.empty()) { + --mDecoderLimit; + RefPtr p = std::move(mPromises.front()); + mPromises.pop(); + p->Resolve(new AutoDeallocToken(this), __func__); + } +} + +void AllocPolicyImpl::RejectAll() { + ReentrantMonitorAutoEnter mon(mMonitor); + while (!mPromises.empty()) { + RefPtr p = std::move(mPromises.front()); + mPromises.pop(); + p->Reject(true, __func__); + } +} + +static int32_t MediaDecoderLimitDefault() { +#ifdef MOZ_WIDGET_ANDROID + if (jni::GetAPIVersion() < 18) { + // Older Android versions have broken support for multiple simultaneous + // decoders, see bug 1278574. + return 1; + } +#endif + // Otherwise, set no decoder limit. + return -1; +} + +StaticMutex GlobalAllocPolicy::sMutex; + +NotNull GlobalAllocPolicy::Instance(TrackType aTrack) { + StaticMutexAutoLock lock(sMutex); + if (aTrack == TrackType::kAudioTrack) { + static RefPtr sAudioPolicy = []() { + SchedulerGroup::Dispatch( + TaskCategory::Other, + NS_NewRunnableFunction( + "GlobalAllocPolicy::GlobalAllocPolicy:Audio", []() { + ClearOnShutdown(&sAudioPolicy, + ShutdownPhase::XPCOMShutdownThreads); + })); + return new AllocPolicyImpl(MediaDecoderLimitDefault()); + }(); + return WrapNotNull(sAudioPolicy.get()); + } + static RefPtr sVideoPolicy = []() { + SchedulerGroup::Dispatch( + TaskCategory::Other, + NS_NewRunnableFunction( + "GlobalAllocPolicy::GlobalAllocPolicy:Audio", []() { + ClearOnShutdown(&sVideoPolicy, + ShutdownPhase::XPCOMShutdownThreads); + })); + return new AllocPolicyImpl(MediaDecoderLimitDefault()); + }(); + return WrapNotNull(sVideoPolicy.get()); +} + +class SingleAllocPolicy::AutoDeallocCombinedToken : public Token { + public: + AutoDeallocCombinedToken(already_AddRefed aSingleAllocPolicyToken, + already_AddRefed aGlobalAllocPolicyToken) + : mSingleToken(aSingleAllocPolicyToken), + mGlobalToken(aGlobalAllocPolicyToken) {} + + private: + // Release tokens allocated from GlobalAllocPolicy and LocalAllocPolicy + // and process next token request if any. + ~AutoDeallocCombinedToken() = default; + const RefPtr mSingleToken; + const RefPtr mGlobalToken; +}; + +auto SingleAllocPolicy::Alloc() -> RefPtr { + MOZ_DIAGNOSTIC_ASSERT(MaxDecoderLimit() == 1, + "We can only handle at most one token out at a time."); + RefPtr self = this; + return AllocPolicyImpl::Alloc()->Then( + mOwnerThread, __func__, + [self](RefPtr aToken) { + RefPtr localToken = std::move(aToken); + RefPtr p = self->mPendingPromise.Ensure(__func__); + GlobalAllocPolicy::Instance(self->mTrack) + ->Alloc() + ->Then( + self->mOwnerThread, __func__, + [self, localToken = std::move(localToken)]( + RefPtr aToken) mutable { + self->mTokenRequest.Complete(); + RefPtr combinedToken = new AutoDeallocCombinedToken( + localToken.forget(), aToken.forget()); + self->mPendingPromise.Resolve(combinedToken, __func__); + }, + [self]() { + self->mTokenRequest.Complete(); + self->mPendingPromise.Reject(true, __func__); + }) + ->Track(self->mTokenRequest); + return p; + }, + []() { return Promise::CreateAndReject(true, __func__); }); +} + +SingleAllocPolicy::~SingleAllocPolicy() { + mPendingPromise.RejectIfExists(true, __func__); + mTokenRequest.DisconnectIfExists(); +} + +void SingleAllocPolicy::Cancel() { + MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); + mPendingPromise.RejectIfExists(true, __func__); + mTokenRequest.DisconnectIfExists(); + RejectAll(); +} + +AllocationWrapper::AllocationWrapper( + already_AddRefed aDecoder, already_AddRefed aToken) + : mDecoder(aDecoder), mToken(aToken) { + DecoderDoctorLogger::LogConstructionAndBase( + "AllocationWrapper", this, static_cast(this)); + DecoderDoctorLogger::LinkParentAndChild("AllocationWrapper", this, "decoder", + mDecoder.get()); +} + +AllocationWrapper::~AllocationWrapper() { + DecoderDoctorLogger::LogDestruction("AllocationWrapper", this); +} + +RefPtr AllocationWrapper::Shutdown() { + RefPtr decoder = std::move(mDecoder); + RefPtr token = std::move(mToken); + return decoder->Shutdown()->Then( + GetCurrentSerialEventTarget(), __func__, + [token]() { return ShutdownPromise::CreateAndResolve(true, __func__); }); +} +/* static */ RefPtr +AllocationWrapper::CreateDecoder(const CreateDecoderParams& aParams, + AllocPolicy* aPolicy) { + RefPtr p = + (aPolicy ? aPolicy : GlobalAllocPolicy::Instance(aParams.mType)) + ->Alloc() + ->Then( + GetCurrentSerialEventTarget(), __func__, + [params = + CreateDecoderParamsForAsync(aParams)](RefPtr aToken) { + // result may not always be updated by + // PDMFactory::CreateDecoder either when the creation + // succeeded or failed, as such it must be initialized to a + // fatal error by default. + MediaResult result = + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + nsPrintfCString("error creating %s decoder", + TrackTypeToStr(params.mType))); + RefPtr pdm = new PDMFactory(); + RefPtr p = + pdm->CreateDecoder(params)->Then( + GetCurrentSerialEventTarget(), __func__, + [aToken](RefPtr&& aDecoder) mutable { + RefPtr wrapper = + new AllocationWrapper(aDecoder.forget(), + aToken.forget()); + return AllocateDecoderPromise::CreateAndResolve( + wrapper, __func__); + }, + [](const MediaResult& aError) { + return AllocateDecoderPromise::CreateAndReject( + aError, __func__); + }); + return p; + }, + []() { + return AllocateDecoderPromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + "Allocation policy expired"), + __func__); + }); + return p; +} + +} // namespace mozilla diff --git a/dom/media/platforms/AllocationPolicy.h b/dom/media/platforms/AllocationPolicy.h new file mode 100644 index 0000000000..a53f923483 --- /dev/null +++ b/dom/media/platforms/AllocationPolicy.h @@ -0,0 +1,183 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef AllocationPolicy_h_ +#define AllocationPolicy_h_ + +#include + +#include "MediaInfo.h" +#include "PlatformDecoderModule.h" +#include "TimeUnits.h" +#include "mozilla/MozPromise.h" +#include "mozilla/NotNull.h" +#include "mozilla/ReentrantMonitor.h" +#include "mozilla/StaticMutex.h" + +namespace mozilla { + +/** + * Before calling PDMFactory::CreateDecoder(), Alloc() must be called on the + * policy to get a token object as a permission to create a decoder. The + * token should stay alive until Shutdown() is called on the decoder. The + * destructor of the token will restore the decoder count so it is available + * for next calls of Alloc(). + */ +class AllocPolicy { + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AllocPolicy) + + public: + class Token { + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Token) + protected: + virtual ~Token() = default; + }; + using Promise = MozPromise, bool, true>; + + // Acquire a token for decoder creation. Thread-safe. + virtual RefPtr Alloc() = 0; + + protected: + virtual ~AllocPolicy() = default; +}; + +/** + * This is a singleton which controls the number of decoders that can be created + * concurrently. + * Instance() will return the TrackType global AllocPolicy. + * Instance() will always return a non-null value. + */ +class GlobalAllocPolicy { + public: + // Get the singleton for the given track type. Thread-safe. + static NotNull Instance(TrackInfo::TrackType aTrack); + + private: + // Protect access to Instance(). + static StaticMutex sMutex MOZ_UNANNOTATED; +}; + +/** This the actual base implementation underneath all AllocPolicy objects and + * control how many decoders can be created concurrently. + * Alloc() must be called to get a token object as a permission to perform an + * action. The token should stay alive until Shutdown() is called on the + * decoder. The destructor of the token will restore the decoder count so it is + * available for next calls of Alloc(). + **/ +class AllocPolicyImpl : public AllocPolicy { + public: + explicit AllocPolicyImpl(int aDecoderLimit); + RefPtr Alloc() override; + + protected: + virtual ~AllocPolicyImpl(); + void RejectAll(); + int MaxDecoderLimit() const { return mMaxDecoderLimit; } + + private: + class AutoDeallocToken; + using PromisePrivate = Promise::Private; + // Called by the destructor of TokenImpl to restore the decoder limit. + void Dealloc(); + // Decrement the decoder limit and resolve a promise if available. + void ResolvePromise(ReentrantMonitorAutoEnter& aProofOfLock); + + const int mMaxDecoderLimit; + ReentrantMonitor mMonitor MOZ_UNANNOTATED; + // The number of decoders available for creation. + int mDecoderLimit; + // Requests to acquire tokens. + std::queue> mPromises; +}; + +/** + * This class allows to track and serialise a single decoder allocation at a + * time + */ +class SingleAllocPolicy : public AllocPolicyImpl { + using TrackType = TrackInfo::TrackType; + + public: + SingleAllocPolicy(TrackType aTrack, TaskQueue* aOwnerThread) + : AllocPolicyImpl(1), mTrack(aTrack), mOwnerThread(aOwnerThread) {} + + RefPtr Alloc() override; + + // Cancel the request to GlobalAllocPolicy and reject the current token + // request. Note this must happen before mOwnerThread->BeginShutdown(). + void Cancel(); + + private: + class AutoDeallocCombinedToken; + virtual ~SingleAllocPolicy(); + + const TrackType mTrack; + RefPtr mOwnerThread; + MozPromiseHolder mPendingPromise; + MozPromiseRequestHolder mTokenRequest; +}; + +class AllocationWrapper final : public MediaDataDecoder { + using Token = AllocPolicy::Token; + + public: + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AllocationWrapper, final); + + AllocationWrapper(already_AddRefed aDecoder, + already_AddRefed aToken); + + RefPtr Init() override { return mDecoder->Init(); } + RefPtr Decode(MediaRawData* aSample) override { + return mDecoder->Decode(aSample); + } + bool CanDecodeBatch() const override { return mDecoder->CanDecodeBatch(); } + RefPtr DecodeBatch( + nsTArray>&& aSamples) override { + return mDecoder->DecodeBatch(std::move(aSamples)); + } + RefPtr Drain() override { return mDecoder->Drain(); } + RefPtr Flush() override { return mDecoder->Flush(); } + bool IsHardwareAccelerated(nsACString& aFailureReason) const override { + return mDecoder->IsHardwareAccelerated(aFailureReason); + } + nsCString GetDescriptionName() const override { + return mDecoder->GetDescriptionName(); + } + nsCString GetProcessName() const override { + return mDecoder->GetProcessName(); + } + nsCString GetCodecName() const override { return mDecoder->GetCodecName(); } + void SetSeekThreshold(const media::TimeUnit& aTime) override { + mDecoder->SetSeekThreshold(aTime); + } + bool SupportDecoderRecycling() const override { + return mDecoder->SupportDecoderRecycling(); + } + RefPtr Shutdown() override; + ConversionRequired NeedsConversion() const override { + return mDecoder->NeedsConversion(); + } + + typedef MozPromise, MediaResult, + /* IsExclusive = */ true> + AllocateDecoderPromise; + // Will create a decoder has soon as one can be created according to the + // AllocPolicy (or GlobalAllocPolicy if aPolicy is null) + // Warning: all aParams members must be valid until the promise has been + // resolved, as some contains raw pointers to objects. + static RefPtr CreateDecoder( + const CreateDecoderParams& aParams, AllocPolicy* aPolicy = nullptr); + + private: + ~AllocationWrapper(); + + RefPtr mDecoder; + RefPtr mToken; +}; + +} // namespace mozilla + +#endif diff --git a/dom/media/platforms/MediaCodecsSupport.cpp b/dom/media/platforms/MediaCodecsSupport.cpp new file mode 100644 index 0000000000..8377765c1c --- /dev/null +++ b/dom/media/platforms/MediaCodecsSupport.cpp @@ -0,0 +1,206 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include + +#include "MediaCodecsSupport.h" +#include "PlatformDecoderModule.h" +#include "mozilla/AppShutdown.h" +#include "mozilla/gfx/gfxVars.h" +#include "nsTHashMap.h" + +using MediaCodecsSupport = mozilla::media::MediaCodecsSupport; + +namespace mozilla::media { + +static StaticAutoPtr sInstance; +static StaticMutex sInitMutex; +static StaticMutex sUpdateMutex; + +#define CODEC_SUPPORT_LOG(msg, ...) \ + MOZ_LOG(sPDMLog, LogLevel::Debug, ("MediaCodecsSupport, " msg, ##__VA_ARGS__)) + +void MCSInfo::AddSupport(const MediaCodecsSupported& aSupport) { + StaticMutexAutoLock lock(sUpdateMutex); + MCSInfo* instance = GetInstance(); + if (!instance) { + CODEC_SUPPORT_LOG("Can't add codec support without a MCSInfo instance!"); + return; + } + instance->mSupport += aSupport; +} + +MediaCodecsSupported MCSInfo::GetSupport() { + StaticMutexAutoLock lock(sUpdateMutex); + MCSInfo* instance = GetInstance(); + if (!instance) { + CODEC_SUPPORT_LOG("Can't get codec support without a MCSInfo instance!"); + return MediaCodecsSupported{}; + } + return instance->mSupport; +} + +void MCSInfo::ResetSupport() { + StaticMutexAutoLock lock(sUpdateMutex); + MCSInfo* instance = GetInstance(); + if (!instance) { + CODEC_SUPPORT_LOG("Can't reset codec support without a MCSInfo instance!"); + return; + } + instance->mSupport.clear(); +} + +DecodeSupportSet MCSInfo::GetDecodeSupportSet( + const MediaCodec& aCodec, const MediaCodecsSupported& aSupported) { + DecodeSupportSet support; + const auto supportInfo = GetCodecDefinition(aCodec); + if (aSupported.contains(supportInfo.swDecodeSupport)) { + support += DecodeSupport::SoftwareDecode; + } + if (aSupported.contains(supportInfo.hwDecodeSupport)) { + support += DecodeSupport::HardwareDecode; + } + return support; +} + +MediaCodecsSupported MCSInfo::GetDecodeMediaCodecsSupported( + const MediaCodec& aCodec, const DecodeSupportSet& aSupportSet) { + MediaCodecsSupported support; + const auto supportInfo = GetCodecDefinition(aCodec); + if (aSupportSet.contains(DecodeSupport::SoftwareDecode)) { + support += supportInfo.swDecodeSupport; + } + if (aSupportSet.contains(DecodeSupport::HardwareDecode)) { + support += supportInfo.hwDecodeSupport; + } + return support; +} + +void MCSInfo::GetMediaCodecsSupportedString( + nsCString& aSupportString, const MediaCodecsSupported& aSupportedCodecs) { + CodecDefinition supportInfo; + aSupportString = ""_ns; + MCSInfo* instance = GetInstance(); + if (!instance) { + CODEC_SUPPORT_LOG("Can't get codec support string w/o a MCSInfo instance!"); + return; + } + for (const auto& it : aSupportedCodecs) { + if (!instance->mHashTableMCS->Get(it, &supportInfo)) { + CODEC_SUPPORT_LOG("Can't find string for MediaCodecsSupported enum: %d", + static_cast(it)); + aSupportString.Append("Unknown codec entry found!\n"_ns); + continue; + } + // Get codec name string and append SW/HW support info + aSupportString.Append(supportInfo.commonName); + if (it == supportInfo.swDecodeSupport) { + aSupportString.Append(" SW"_ns); + } + if (it == supportInfo.hwDecodeSupport) { + aSupportString.Append(" HW"_ns); + } + aSupportString.Append("\n"_ns); + } + // Remove any trailing newline characters + if (!aSupportString.IsEmpty()) { + aSupportString.Truncate(aSupportString.Length() - 1); + } +} + +MCSInfo* MCSInfo::GetInstance() { + StaticMutexAutoLock lock(sInitMutex); + if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) { + CODEC_SUPPORT_LOG("In XPCOM shutdown - not returning MCSInfo instance!"); + return nullptr; + } + if (!sInstance) { + sInstance = new MCSInfo(); + } + return sInstance.get(); +} + +MCSInfo::MCSInfo() { + // Initialize hash tables + mHashTableMCS.reset(new nsTHashMap()); + mHashTableCodec.reset(new nsTHashMap()); + + for (const auto& it : GetAllCodecDefinitions()) { + // Insert MediaCodecsSupport values as keys + mHashTableMCS->InsertOrUpdate(it.swDecodeSupport, it); + mHashTableMCS->InsertOrUpdate(it.hwDecodeSupport, it); + // Insert codec enum values as keys + mHashTableCodec->InsertOrUpdate(it.codec, it); + } + + GetMainThreadSerialEventTarget()->Dispatch( + NS_NewRunnableFunction("MCSInfo::MCSInfo", [&] { + // Ensure hash tables freed on shutdown + RunOnShutdown( + [&] { + mHashTableMCS.reset(); + mHashTableString.reset(); + mHashTableCodec.reset(); + sInstance = nullptr; + }, + ShutdownPhase::XPCOMShutdown); + })); +} + +CodecDefinition MCSInfo::GetCodecDefinition(const MediaCodec& aCodec) { + CodecDefinition info; + MCSInfo* instance = GetInstance(); + if (!instance) { + CODEC_SUPPORT_LOG("Can't get codec definition without a MCSInfo instance!"); + } else if (!instance->mHashTableCodec->Get(aCodec, &info)) { + CODEC_SUPPORT_LOG("Could not find codec definition for codec enum: %d!", + static_cast(aCodec)); + } + return info; +} + +std::array MCSInfo::GetAllCodecDefinitions() { + static constexpr std::array codecDefinitions = { + {{MediaCodec::H264, "H264", "video/avc", + MediaCodecsSupport::H264SoftwareDecode, + MediaCodecsSupport::H264HardwareDecode}, + {MediaCodec::VP9, "VP9", "video/vp9", + MediaCodecsSupport::VP9SoftwareDecode, + MediaCodecsSupport::VP9HardwareDecode}, + {MediaCodec::VP8, "VP8", "video/vp8", + MediaCodecsSupport::VP8SoftwareDecode, + MediaCodecsSupport::VP8HardwareDecode}, + {MediaCodec::AV1, "AV1", "video/av1", + MediaCodecsSupport::AV1SoftwareDecode, + MediaCodecsSupport::AV1HardwareDecode}, + {MediaCodec::Theora, "Theora", "video/theora", + MediaCodecsSupport::TheoraSoftwareDecode, + MediaCodecsSupport::TheoraHardwareDecode}, + {MediaCodec::AAC, "AAC", "audio/mp4a-latm", + MediaCodecsSupport::AACSoftwareDecode, + MediaCodecsSupport::AACHardwareDecode}, + {MediaCodec::MP3, "MP3", "audio/mpeg", + MediaCodecsSupport::MP3SoftwareDecode, + MediaCodecsSupport::MP3HardwareDecode}, + {MediaCodec::Opus, "Opus", "audio/opus", + MediaCodecsSupport::OpusSoftwareDecode, + MediaCodecsSupport::OpusHardwareDecode}, + {MediaCodec::Vorbis, "Vorbis", "audio/vorbis", + MediaCodecsSupport::VorbisSoftwareDecode, + MediaCodecsSupport::VorbisHardwareDecode}, + {MediaCodec::FLAC, "FLAC", "audio/flac", + MediaCodecsSupport::FLACSoftwareDecode, + MediaCodecsSupport::FLACHardwareDecode}, + {MediaCodec::Wave, "Wave", "audio/x-wav", + MediaCodecsSupport::WaveSoftwareDecode, + MediaCodecsSupport::WaveHardwareDecode}, + {MediaCodec::SENTINEL, "Undefined codec name", + "Undefined MIME type string", MediaCodecsSupport::SENTINEL, + MediaCodecsSupport::SENTINEL}}}; + return codecDefinitions; +} +} // namespace mozilla::media + +#undef CODEC_SUPPORT_LOG diff --git a/dom/media/platforms/MediaCodecsSupport.h b/dom/media/platforms/MediaCodecsSupport.h new file mode 100644 index 0000000000..ae2fdd63a8 --- /dev/null +++ b/dom/media/platforms/MediaCodecsSupport.h @@ -0,0 +1,194 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef DOM_MEDIA_PLATFORMS_MEDIACODECSSUPPORT_H_ +#define DOM_MEDIA_PLATFORMS_MEDIACODECSSUPPORT_H_ +#include + +#include "mozilla/Atomics.h" +#include "mozilla/ClearOnShutdown.h" +#include "mozilla/EnumSet.h" +#include "mozilla/StaticMutex.h" +#include "nsString.h" +#include "nsTHashMap.h" +#include "nsThreadUtils.h" + +namespace mozilla::media { +// List of codecs we support, used in the below macros +// to generate MediaCodec and MediaCodecSupports enums. +#define CODEC_LIST \ + X(H264) \ + X(VP8) \ + X(VP9) \ + X(AV1) \ + X(Theora) \ + X(AAC) \ + X(FLAC) \ + X(MP3) \ + X(Opus) \ + X(Vorbis) \ + X(Wave) + +// Generate MediaCodec enum with the names of each codec we support. +// Example: MediaCodec::H264 +enum class MediaCodec : int { +#define X(name) name, + CODEC_LIST +#undef X + SENTINEL +}; + +// Helper macros used to create codec-specific SW/HW decode enums below. +#define SW_DECODE(codec) codec##SoftwareDecode +#define HW_DECODE(codec) codec##HardwareDecode + +// Generate the MediaCodecsSupport enum, containing +// codec-specific SW/HW decode/encode information. +// Entries for HW audio decode/encode should never be set as we +// don't support HW audio decode/encode, but they are included +// for debug purposes / check for erroneous PDM return values. +// Example: MediaCodecsSupport::AACSoftwareDecode +enum class MediaCodecsSupport : int { +#define X(name) SW_DECODE(name), HW_DECODE(name), + CODEC_LIST +#undef X + SENTINEL +}; +#undef SW_DECODE +#undef HW_DECODE +#undef CODEC_LIST // end of macros! + +// Enumset containing per-codec SW/HW support +using MediaCodecsSupported = EnumSet; + +// Codec-agnostic SW/HW decode support information. +enum class DecodeSupport : int { + Unsupported = 0, + SoftwareDecode, + HardwareDecode, +}; +using DecodeSupportSet = EnumSet; + +// CodecDefinition stores information needed to convert / index +// codec support information between types. See: GetAllCodecDefinitions() +struct CodecDefinition { + MediaCodec codec = MediaCodec::SENTINEL; + const char* commonName = "Undefined codec name"; + const char* mimeTypeString = "Undefined MIME type string"; + MediaCodecsSupport swDecodeSupport = MediaCodecsSupport::SENTINEL; + MediaCodecsSupport hwDecodeSupport = MediaCodecsSupport::SENTINEL; +}; + +// Singleton class used to collect, manage, and report codec support data. +class MCSInfo final { + public: + // Add codec support information to our aggregated list of supported codecs. + // Incoming support info is merged with the current support info. + // This is because different PDMs may report different codec support + // information, so merging their results allows us to maintain a + // cumulative support list without overwriting any existing data. + static void AddSupport(const MediaCodecsSupported& aSupport); + + // Return a cumulative list of codec support information. + // Each call to AddSupport adds to or updates this list. + // This support information can be used to create user-readable strings + // to report codec support information in about:support. + static MediaCodecsSupported GetSupport(); + + // Reset codec support information saved from calls to AddSupport(). + static void ResetSupport(); + + // Query a MediaCodecsSupported EnumSet for codec-specific SW/HW support enums + // and return general support information as stored in a DecodeSupportSet. + // + // Example input: + // + // aCodec: MediaCodec::H264 + // aDecode: MediaCodecsSupport { + // MediaCodecsSupport::AACSoftwareDecode + // MediaCodecsSupport::H264HardwareDecode, + // MediaCodecsSupport::H264SoftwareDecode, + // MediaCodecsSupport::VP8SoftwareDecode, + // } + // + // Example output: + // + // DecodeSupportSet { + // DecodeSupport::SoftwareDecode, + // DecodeSupport::HardwareDecode + // } + // + static DecodeSupportSet GetDecodeSupportSet( + const MediaCodec& aCodec, const MediaCodecsSupported& aSupported); + + // Return codec-specific SW/HW support enums for a given codec. + // The DecodeSupportSet argument is used which codec-specific SW/HW + // support values are returned, if any. + // + // Example input: + // aCodec: MediaCodec::VP8 + // aSupportSet: DecodeSupportSet {DecodeSupport::SoftwareDecode} + // + // Example output: + // MediaCodecsSupported {MediaCodecsSupport::VP8SoftwareDecode} + // + static MediaCodecsSupported GetDecodeMediaCodecsSupported( + const MediaCodec& aCodec, const DecodeSupportSet& aSupportSet); + + // Generate a plaintext description for the SW/HW support information + // contained in a MediaCodecsSupported EnumSet. + // + // Example input: + // MediaCodecsSupported { + // MediaCodecsSupport::H264SoftwareDecode, + // MediaCodecsSupport::H264HardwareDecode, + // MediaCodecsSupport::VP8SoftwareDecode + // } + // + // Example output (returned via argument aCodecString) + // + // "SW H264 decode\n + // HW H264 decode\n + // SW VP8 decode"_ns + // + static void GetMediaCodecsSupportedString( + nsCString& aSupportString, const MediaCodecsSupported& aSupportedCodecs); + + // Returns array of hardcoded codec definitions used to generate hashtables + // that convert between types + static std::array GetAllCodecDefinitions(); + + MCSInfo(MCSInfo const&) = delete; + void operator=(MCSInfo const&) = delete; + ~MCSInfo() = default; + + private: + MCSInfo(); + static MCSInfo* GetInstance(); + + // Returns a codec definition by MIME type name ("media/vp9") + // or "common" name ("VP9") + static CodecDefinition GetCodecDefinition(const MediaCodec& aCodec); + + UniquePtr> mHashTableMCS; + UniquePtr> mHashTableString; + UniquePtr> mHashTableCodec; + MediaCodecsSupported mSupport; +}; +} // namespace mozilla::media + +namespace mozilla { +// Used for IPDL serialization. +// The 'value' has to be the biggest enum from MediaCodecsSupport. +template +struct MaxEnumValue; +template <> +struct MaxEnumValue { + static constexpr unsigned int value = + static_cast(media::MediaCodecsSupport::SENTINEL); +}; +} // namespace mozilla + +#endif /* MediaCodecsSupport_h_ */ diff --git a/dom/media/platforms/MediaTelemetryConstants.h b/dom/media/platforms/MediaTelemetryConstants.h new file mode 100644 index 0000000000..d22f310e12 --- /dev/null +++ b/dom/media/platforms/MediaTelemetryConstants.h @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef dom_media_platforms_MediaTelemetryConstants_h___ +#define dom_media_platforms_MediaTelemetryConstants_h___ + +namespace mozilla { +namespace media { + +enum class MediaDecoderBackend : uint32_t { + WMFSoftware = 0, + WMFDXVA2D3D9 = 1, + WMFDXVA2D3D11 = 2 +}; + +} // namespace media +} // namespace mozilla + +#endif // dom_media_platforms_MediaTelemetryConstants_h___ diff --git a/dom/media/platforms/PDMFactory.cpp b/dom/media/platforms/PDMFactory.cpp new file mode 100644 index 0000000000..49d9e835f7 --- /dev/null +++ b/dom/media/platforms/PDMFactory.cpp @@ -0,0 +1,904 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "PDMFactory.h" + +#ifdef MOZ_AV1 +# include "AOMDecoder.h" +#endif +#include "AgnosticDecoderModule.h" +#include "AudioTrimmer.h" +#include "BlankDecoderModule.h" +#include "DecoderDoctorDiagnostics.h" +#include "EMEDecoderModule.h" +#include "GMPDecoderModule.h" +#include "H264.h" +#include "MP4Decoder.h" +#include "MediaChangeMonitor.h" +#include "MediaInfo.h" +#include "OpusDecoder.h" +#include "TheoraDecoder.h" +#include "VPXDecoder.h" +#include "VideoUtils.h" +#include "VorbisDecoder.h" +#include "WAVDecoder.h" +#include "mozilla/ClearOnShutdown.h" +#include "mozilla/RemoteDecodeUtils.h" +#include "mozilla/RemoteDecoderManagerChild.h" +#include "mozilla/RemoteDecoderModule.h" +#include "mozilla/SharedThreadPool.h" +#include "mozilla/StaticPrefs_media.h" +#include "mozilla/SyncRunnable.h" +#include "mozilla/TaskQueue.h" +#include "mozilla/gfx/gfxVars.h" +#include "nsIXULRuntime.h" // for BrowserTabsRemoteAutostart +#include "nsPrintfCString.h" + +#include "mozilla/ipc/UtilityAudioDecoderParent.h" + +#ifdef XP_WIN +# include "WMFDecoderModule.h" +# include "mozilla/WindowsVersion.h" +# ifdef MOZ_WMF_MEDIA_ENGINE +# include "MFMediaEngineDecoderModule.h" +# endif +# ifdef MOZ_WMF_CDM +# include "mozilla/CDMProxy.h" +# endif +#endif +#ifdef MOZ_FFVPX +# include "FFVPXRuntimeLinker.h" +#endif +#ifdef MOZ_FFMPEG +# include "FFmpegRuntimeLinker.h" +#endif +#ifdef MOZ_APPLEMEDIA +# include "AppleDecoderModule.h" +#endif +#ifdef MOZ_WIDGET_ANDROID +# include "AndroidDecoderModule.h" +#endif +#ifdef MOZ_OMX +# include "OmxDecoderModule.h" +#endif + +#include + +using DecodeSupport = mozilla::media::DecodeSupport; +using DecodeSupportSet = mozilla::media::DecodeSupportSet; +using MediaCodec = mozilla::media::MediaCodec; +using MediaCodecsSupport = mozilla::media::MediaCodecsSupport; +using MediaCodecsSupported = mozilla::media::MediaCodecsSupported; +using MCSInfo = mozilla::media::MCSInfo; + +namespace mozilla { + +#define PDM_INIT_LOG(msg, ...) \ + MOZ_LOG(sPDMLog, LogLevel::Debug, ("PDMInitializer, " msg, ##__VA_ARGS__)) + +extern already_AddRefed CreateNullDecoderModule(); + +class PDMInitializer final { + public: + // This function should only be executed ONCE per process. + static void InitPDMs(); + + // Return true if we've finished PDMs initialization. + static bool HasInitializedPDMs(); + + private: + static void InitGpuPDMs() { +#ifdef XP_WIN + if (!IsWin7AndPre2000Compatible()) { + WMFDecoderModule::Init(); + } +#endif + } + + static void InitRddPDMs() { +#ifdef XP_WIN + if (!IsWin7AndPre2000Compatible()) { + WMFDecoderModule::Init(); + } +#endif +#ifdef MOZ_APPLEMEDIA + AppleDecoderModule::Init(); +#endif +#ifdef MOZ_FFVPX + FFVPXRuntimeLinker::Init(); +#endif +#ifdef MOZ_FFMPEG + if (StaticPrefs::media_rdd_ffmpeg_enabled()) { + FFmpegRuntimeLinker::Init(); + } +#endif + } + + static void InitUtilityPDMs() { + const ipc::SandboxingKind kind = GetCurrentSandboxingKind(); +#ifdef XP_WIN + if (!IsWin7AndPre2000Compatible() && + kind == ipc::SandboxingKind::UTILITY_AUDIO_DECODING_WMF) { + WMFDecoderModule::Init(); + } +# ifdef MOZ_WMF_MEDIA_ENGINE + if (IsWin10OrLater() && StaticPrefs::media_wmf_media_engine_enabled() && + kind == ipc::SandboxingKind::MF_MEDIA_ENGINE_CDM) { + MFMediaEngineDecoderModule::Init(); + } +# endif +#endif +#ifdef MOZ_APPLEMEDIA + if (kind == ipc::SandboxingKind::UTILITY_AUDIO_DECODING_APPLE_MEDIA) { + AppleDecoderModule::Init(); + } +#endif +#ifdef MOZ_FFVPX + if (kind == ipc::SandboxingKind::GENERIC_UTILITY) { + FFVPXRuntimeLinker::Init(); + } +#endif +#ifdef MOZ_FFMPEG + if (StaticPrefs::media_utility_ffmpeg_enabled() && + kind == ipc::SandboxingKind::GENERIC_UTILITY) { + FFmpegRuntimeLinker::Init(); + } +#endif + } + + static void InitContentPDMs() { +#ifdef XP_WIN + if (!IsWin7AndPre2000Compatible()) { +# ifdef MOZ_WMF + if (!StaticPrefs::media_rdd_process_enabled() || + !StaticPrefs::media_rdd_wmf_enabled() || + !StaticPrefs::media_utility_process_enabled() || + !StaticPrefs::media_utility_wmf_enabled()) { + WMFDecoderModule::Init(); + } +# endif + } +#endif +#ifdef MOZ_APPLEMEDIA + AppleDecoderModule::Init(); +#endif +#ifdef MOZ_OMX + OmxDecoderModule::Init(); +#endif +#ifdef MOZ_FFVPX + FFVPXRuntimeLinker::Init(); +#endif +#ifdef MOZ_FFMPEG + FFmpegRuntimeLinker::Init(); +#endif + RemoteDecoderManagerChild::Init(); + } + + static void InitDefaultPDMs() { +#ifdef XP_WIN + if (!IsWin7AndPre2000Compatible()) { + WMFDecoderModule::Init(); + } +#endif +#ifdef MOZ_APPLEMEDIA + AppleDecoderModule::Init(); +#endif +#ifdef MOZ_OMX + OmxDecoderModule::Init(); +#endif +#ifdef MOZ_FFVPX + FFVPXRuntimeLinker::Init(); +#endif +#ifdef MOZ_FFMPEG + FFmpegRuntimeLinker::Init(); +#endif + } + + static bool sHasInitializedPDMs; + static StaticMutex sMonitor MOZ_UNANNOTATED; +}; + +bool PDMInitializer::sHasInitializedPDMs = false; +StaticMutex PDMInitializer::sMonitor; + +/* static */ +void PDMInitializer::InitPDMs() { + StaticMutexAutoLock mon(sMonitor); + MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread()); + MOZ_ASSERT(!sHasInitializedPDMs); + if (XRE_IsGPUProcess()) { + PDM_INIT_LOG("Init PDMs in GPU process"); + InitGpuPDMs(); + } else if (XRE_IsRDDProcess()) { + PDM_INIT_LOG("Init PDMs in RDD process"); + InitRddPDMs(); + } else if (XRE_IsUtilityProcess()) { + PDM_INIT_LOG("Init PDMs in Utility process"); + InitUtilityPDMs(); + } else if (XRE_IsContentProcess()) { + PDM_INIT_LOG("Init PDMs in Content process"); + InitContentPDMs(); + } else { + MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess(), + "PDMFactory is only usable in the " + "Parent/GPU/RDD/Utility/Content process"); + PDM_INIT_LOG("Init PDMs in Chrome process"); + InitDefaultPDMs(); + } + sHasInitializedPDMs = true; +} + +/* static */ +bool PDMInitializer::HasInitializedPDMs() { + StaticMutexAutoLock mon(sMonitor); + return sHasInitializedPDMs; +} + +class SupportChecker { + public: + enum class Reason : uint8_t { + kSupported, + kVideoFormatNotSupported, + kAudioFormatNotSupported, + kUnknown, + }; + + struct CheckResult { + explicit CheckResult(Reason aReason, + MediaResult aResult = MediaResult(NS_OK)) + : mReason(aReason), mMediaResult(std::move(aResult)) {} + CheckResult(const CheckResult& aOther) = default; + CheckResult(CheckResult&& aOther) = default; + CheckResult& operator=(const CheckResult& aOther) = default; + CheckResult& operator=(CheckResult&& aOther) = default; + + Reason mReason; + MediaResult mMediaResult; + }; + + template + void AddToCheckList(Func&& aChecker) { + mCheckerList.AppendElement(std::forward(aChecker)); + } + + void AddMediaFormatChecker(const TrackInfo& aTrackConfig) { + if (aTrackConfig.IsVideo()) { + auto mimeType = aTrackConfig.GetAsVideoInfo()->mMimeType; + RefPtr extraData = + aTrackConfig.GetAsVideoInfo()->mExtraData; + AddToCheckList([mimeType, extraData]() { + if (MP4Decoder::IsH264(mimeType)) { + SPSData spsdata; + // WMF H.264 Video Decoder and Apple ATDecoder + // do not support YUV444 format. + // For consistency, all decoders should be checked. + if (H264::DecodeSPSFromExtraData(extraData, spsdata) && + (spsdata.profile_idc == 244 /* Hi444PP */ || + spsdata.chroma_format_idc == PDMFactory::kYUV444)) { + return CheckResult( + SupportChecker::Reason::kVideoFormatNotSupported, + MediaResult( + NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL("Decoder may not have the capability " + "to handle the requested video format " + "with YUV444 chroma subsampling."))); + } + } + return CheckResult(SupportChecker::Reason::kSupported); + }); + } + } + + SupportChecker::CheckResult Check() { + for (auto& checker : mCheckerList) { + auto result = checker(); + if (result.mReason != SupportChecker::Reason::kSupported) { + return result; + } + } + return CheckResult(SupportChecker::Reason::kSupported); + } + + void Clear() { mCheckerList.Clear(); } + + private: + nsTArray> mCheckerList; +}; // SupportChecker + +PDMFactory::PDMFactory() { + EnsureInit(); + CreatePDMs(); + CreateNullPDM(); +} + +PDMFactory::~PDMFactory() = default; + +/* static */ +void PDMFactory::EnsureInit() { + if (PDMInitializer::HasInitializedPDMs()) { + return; + } + auto initalization = []() { + MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread()); + if (!PDMInitializer::HasInitializedPDMs()) { + // Ensure that all system variables are initialized. + gfx::gfxVars::Initialize(); + // Prime the preferences system from the main thread. + Unused << BrowserTabsRemoteAutostart(); + PDMInitializer::InitPDMs(); + } + }; + // If on the main thread, then initialize PDMs. Otherwise, do a sync-dispatch + // to main thread. + if (NS_IsMainThread()) { + initalization(); + return; + } + nsCOMPtr mainTarget = GetMainThreadSerialEventTarget(); + nsCOMPtr runnable = NS_NewRunnableFunction( + "PDMFactory::EnsureInit", std::move(initalization)); + SyncRunnable::DispatchToThread(mainTarget, runnable); +} + +RefPtr PDMFactory::CreateDecoder( + const CreateDecoderParams& aParams) { + if (aParams.mUseNullDecoder.mUse) { + MOZ_ASSERT(mNullPDM); + return CreateDecoderWithPDM(mNullPDM, aParams); + } + bool isEncrypted = mEMEPDM && aParams.mConfig.mCrypto.IsEncrypted(); + + if (isEncrypted) { + return CreateDecoderWithPDM(mEMEPDM, aParams); + } + + return CheckAndMaybeCreateDecoder(CreateDecoderParamsForAsync(aParams), 0); +} + +RefPtr +PDMFactory::CheckAndMaybeCreateDecoder(CreateDecoderParamsForAsync&& aParams, + uint32_t aIndex, + Maybe aEarlierError) { + uint32_t i = aIndex; + auto params = SupportDecoderParams(aParams); + for (; i < mCurrentPDMs.Length(); i++) { + if (mCurrentPDMs[i]->Supports(params, nullptr /* diagnostic */) == + media::DecodeSupport::Unsupported) { + continue; + } + RefPtr p = + CreateDecoderWithPDM(mCurrentPDMs[i], aParams) + ->Then( + GetCurrentSerialEventTarget(), __func__, + [](RefPtr&& aDecoder) { + return PlatformDecoderModule::CreateDecoderPromise:: + CreateAndResolve(std::move(aDecoder), __func__); + }, + [self = RefPtr{this}, i, params = std::move(aParams)]( + const MediaResult& aError) mutable { + // Try the next PDM. + return self->CheckAndMaybeCreateDecoder(std::move(params), + i + 1, Some(aError)); + }); + return p; + } + if (aEarlierError) { + return PlatformDecoderModule::CreateDecoderPromise::CreateAndReject( + std::move(*aEarlierError), __func__); + } + return PlatformDecoderModule::CreateDecoderPromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + nsPrintfCString("Error no decoder found for %s", + aParams.mConfig->mMimeType.get()) + .get()), + __func__); +} + +RefPtr +PDMFactory::CreateDecoderWithPDM(PlatformDecoderModule* aPDM, + const CreateDecoderParams& aParams) { + MOZ_ASSERT(aPDM); + MediaResult result = NS_OK; + + SupportChecker supportChecker; + const TrackInfo& config = aParams.mConfig; + supportChecker.AddMediaFormatChecker(config); + + auto checkResult = supportChecker.Check(); + if (checkResult.mReason != SupportChecker::Reason::kSupported) { + if (checkResult.mReason == + SupportChecker::Reason::kVideoFormatNotSupported) { + result = checkResult.mMediaResult; + } else if (checkResult.mReason == + SupportChecker::Reason::kAudioFormatNotSupported) { + result = checkResult.mMediaResult; + } + return PlatformDecoderModule::CreateDecoderPromise::CreateAndReject( + result, __func__); + } + + if (config.IsAudio()) { + RefPtr p; + p = aPDM->AsyncCreateDecoder(aParams)->Then( + GetCurrentSerialEventTarget(), __func__, + [params = CreateDecoderParamsForAsync(aParams)]( + RefPtr&& aDecoder) { + RefPtr decoder = std::move(aDecoder); + if (!params.mNoWrapper.mDontUseWrapper) { + decoder = + new AudioTrimmer(decoder.forget(), CreateDecoderParams(params)); + } + return PlatformDecoderModule::CreateDecoderPromise::CreateAndResolve( + decoder, __func__); + }, + [](const MediaResult& aError) { + return PlatformDecoderModule::CreateDecoderPromise::CreateAndReject( + aError, __func__); + }); + return p; + } + + if (!config.IsVideo()) { + return PlatformDecoderModule::CreateDecoderPromise::CreateAndReject( + MediaResult( + NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL( + "Decoder configuration error, expected audio or video.")), + __func__); + } + + if ((MP4Decoder::IsH264(config.mMimeType) || +#ifdef MOZ_AV1 + AOMDecoder::IsAV1(config.mMimeType) || +#endif + VPXDecoder::IsVPX(config.mMimeType)) && + !aParams.mUseNullDecoder.mUse && !aParams.mNoWrapper.mDontUseWrapper) { + return MediaChangeMonitor::Create(this, aParams); + } + return aPDM->AsyncCreateDecoder(aParams); +} + +DecodeSupportSet PDMFactory::SupportsMimeType( + const nsACString& aMimeType) const { + UniquePtr trackInfo = CreateTrackInfoWithMIMEType(aMimeType); + if (!trackInfo) { + return DecodeSupport::Unsupported; + } + return Supports(SupportDecoderParams(*trackInfo), nullptr); +} + +DecodeSupportSet PDMFactory::Supports( + const SupportDecoderParams& aParams, + DecoderDoctorDiagnostics* aDiagnostics) const { + if (mEMEPDM) { + return mEMEPDM->Supports(aParams, aDiagnostics); + } + + RefPtr current = + GetDecoderModule(aParams, aDiagnostics); + + if (!current) { + return DecodeSupport::Unsupported; + } + + // We have a PDM - check for + return SW/HW support info + return current->Supports(aParams, aDiagnostics); +} + +void PDMFactory::CreatePDMs() { + if (StaticPrefs::media_use_blank_decoder()) { + CreateAndStartupPDM(); + // The Blank PDM SupportsMimeType reports true for all codecs; the creation + // of its decoder is infallible. As such it will be used for all media, we + // can stop creating more PDM from this point. + return; + } + + if (XRE_IsGPUProcess()) { + CreateGpuPDMs(); + } else if (XRE_IsRDDProcess()) { + CreateRddPDMs(); + } else if (XRE_IsUtilityProcess()) { + CreateUtilityPDMs(); + } else if (XRE_IsContentProcess()) { + CreateContentPDMs(); + } else { + MOZ_DIAGNOSTIC_ASSERT( + XRE_IsParentProcess(), + "PDMFactory is only usable in the Parent/GPU/RDD/Content process"); + CreateDefaultPDMs(); + } +} + +void PDMFactory::CreateGpuPDMs() { +#ifdef XP_WIN + if (StaticPrefs::media_wmf_enabled() && !IsWin7AndPre2000Compatible()) { + CreateAndStartupPDM(); + } +#endif +} + +#if defined(MOZ_FFMPEG) +static DecoderDoctorDiagnostics::Flags GetFailureFlagBasedOnFFmpegStatus( + const FFmpegRuntimeLinker::LinkStatus& aStatus) { + switch (aStatus) { + case FFmpegRuntimeLinker::LinkStatus_INVALID_FFMPEG_CANDIDATE: + case FFmpegRuntimeLinker::LinkStatus_UNUSABLE_LIBAV57: + case FFmpegRuntimeLinker::LinkStatus_INVALID_LIBAV_CANDIDATE: + case FFmpegRuntimeLinker::LinkStatus_OBSOLETE_FFMPEG: + case FFmpegRuntimeLinker::LinkStatus_OBSOLETE_LIBAV: + case FFmpegRuntimeLinker::LinkStatus_INVALID_CANDIDATE: + return DecoderDoctorDiagnostics::Flags::LibAVCodecUnsupported; + default: + MOZ_DIAGNOSTIC_ASSERT( + aStatus == FFmpegRuntimeLinker::LinkStatus_NOT_FOUND, + "Only call this method when linker fails."); + return DecoderDoctorDiagnostics::Flags::FFmpegNotFound; + } +} +#endif + +void PDMFactory::CreateRddPDMs() { +#ifdef XP_WIN + if (StaticPrefs::media_wmf_enabled() && + StaticPrefs::media_rdd_wmf_enabled()) { + CreateAndStartupPDM(); + } +#endif +#ifdef MOZ_APPLEMEDIA + if (StaticPrefs::media_rdd_applemedia_enabled()) { + CreateAndStartupPDM(); + } +#endif +#ifdef MOZ_FFVPX + if (StaticPrefs::media_ffvpx_enabled() && + StaticPrefs::media_rdd_ffvpx_enabled()) { + CreateAndStartupPDM(); + } +#endif +#ifdef MOZ_FFMPEG + if (StaticPrefs::media_ffmpeg_enabled() && + StaticPrefs::media_rdd_ffmpeg_enabled() && + !CreateAndStartupPDM()) { + mFailureFlags += GetFailureFlagBasedOnFFmpegStatus( + FFmpegRuntimeLinker::LinkStatusCode()); + } +#endif + CreateAndStartupPDM(); +} + +void PDMFactory::CreateUtilityPDMs() { + const ipc::SandboxingKind aKind = GetCurrentSandboxingKind(); +#ifdef XP_WIN + if (StaticPrefs::media_wmf_enabled() && + StaticPrefs::media_utility_wmf_enabled() && + aKind == ipc::SandboxingKind::UTILITY_AUDIO_DECODING_WMF) { + CreateAndStartupPDM(); + } +#endif +#ifdef MOZ_APPLEMEDIA + if (StaticPrefs::media_utility_applemedia_enabled() && + aKind == ipc::SandboxingKind::UTILITY_AUDIO_DECODING_APPLE_MEDIA) { + CreateAndStartupPDM(); + } +#endif + if (aKind == ipc::SandboxingKind::GENERIC_UTILITY) { +#ifdef MOZ_FFVPX + if (StaticPrefs::media_ffvpx_enabled() && + StaticPrefs::media_utility_ffvpx_enabled()) { + CreateAndStartupPDM(); + } +#endif +#ifdef MOZ_FFMPEG + if (StaticPrefs::media_ffmpeg_enabled() && + StaticPrefs::media_utility_ffmpeg_enabled() && + !CreateAndStartupPDM()) { + mFailureFlags += GetFailureFlagBasedOnFFmpegStatus( + FFmpegRuntimeLinker::LinkStatusCode()); + } +#endif +#ifdef MOZ_WIDGET_ANDROID + if (StaticPrefs::media_utility_android_media_codec_enabled()) { + StartupPDM(AndroidDecoderModule::Create(), + StaticPrefs::media_android_media_codec_preferred()); + } +#endif + CreateAndStartupPDM(); + } +#ifdef MOZ_WMF_MEDIA_ENGINE + if (aKind == ipc::SandboxingKind::MF_MEDIA_ENGINE_CDM) { + if (IsWin10OrLater() && StaticPrefs::media_wmf_media_engine_enabled()) { + CreateAndStartupPDM(); + } + } +#endif +} + +void PDMFactory::CreateContentPDMs() { + if (StaticPrefs::media_gpu_process_decoder()) { + CreateAndStartupPDM(RemoteDecodeIn::GpuProcess); + } + + if (StaticPrefs::media_rdd_process_enabled()) { + CreateAndStartupPDM(RemoteDecodeIn::RddProcess); + } + + if (StaticPrefs::media_utility_process_enabled()) { +#ifdef MOZ_APPLEMEDIA + CreateAndStartupPDM( + RemoteDecodeIn::UtilityProcess_AppleMedia); +#endif +#ifdef XP_WIN + CreateAndStartupPDM( + RemoteDecodeIn::UtilityProcess_WMF); +#endif + // WMF and AppleMedia should be created before Generic because the order + // affects what decoder module would be chose first. + CreateAndStartupPDM( + RemoteDecodeIn::UtilityProcess_Generic); + } +#ifdef MOZ_WMF_MEDIA_ENGINE + if (StaticPrefs::media_wmf_media_engine_enabled()) { + CreateAndStartupPDM( + RemoteDecodeIn::UtilityProcess_MFMediaEngineCDM); + } +#endif + +#ifdef XP_WIN + if (StaticPrefs::media_wmf_enabled() && !IsWin7AndPre2000Compatible()) { +# ifdef MOZ_WMF + if (!StaticPrefs::media_rdd_process_enabled() || + !StaticPrefs::media_rdd_wmf_enabled()) { + if (!CreateAndStartupPDM()) { + mFailureFlags += DecoderDoctorDiagnostics::Flags::WMFFailedToLoad; + } + } +# endif + } else if (StaticPrefs::media_decoder_doctor_wmf_disabled_is_failure()) { + mFailureFlags += DecoderDoctorDiagnostics::Flags::WMFFailedToLoad; + } +#endif + +#ifdef MOZ_APPLEMEDIA + CreateAndStartupPDM(); +#endif +#ifdef MOZ_OMX + if (StaticPrefs::media_omx_enabled()) { + CreateAndStartupPDM(); + } +#endif +#ifdef MOZ_FFVPX + if (StaticPrefs::media_ffvpx_enabled()) { + CreateAndStartupPDM(); + } +#endif +#ifdef MOZ_FFMPEG + if (StaticPrefs::media_ffmpeg_enabled() && + !CreateAndStartupPDM()) { + mFailureFlags += GetFailureFlagBasedOnFFmpegStatus( + FFmpegRuntimeLinker::LinkStatusCode()); + } +#endif +#ifdef MOZ_WIDGET_ANDROID + if (StaticPrefs::media_android_media_codec_enabled()) { + StartupPDM(AndroidDecoderModule::Create(), + StaticPrefs::media_android_media_codec_preferred()); + } +#endif + + CreateAndStartupPDM(); + + if (StaticPrefs::media_gmp_decoder_enabled() && + !StartupPDM(GMPDecoderModule::Create(), + StaticPrefs::media_gmp_decoder_preferred())) { + mFailureFlags += DecoderDoctorDiagnostics::Flags::GMPPDMFailedToStartup; + } +} + +void PDMFactory::CreateDefaultPDMs() { +#ifdef XP_WIN + if (StaticPrefs::media_wmf_enabled() && !IsWin7AndPre2000Compatible()) { + if (!CreateAndStartupPDM()) { + mFailureFlags += DecoderDoctorDiagnostics::Flags::WMFFailedToLoad; + } + } else if (StaticPrefs::media_decoder_doctor_wmf_disabled_is_failure()) { + mFailureFlags += DecoderDoctorDiagnostics::Flags::WMFFailedToLoad; + } +#endif + +#ifdef MOZ_APPLEMEDIA + CreateAndStartupPDM(); +#endif +#ifdef MOZ_OMX + if (StaticPrefs::media_omx_enabled()) { + CreateAndStartupPDM(); + } +#endif +#ifdef MOZ_FFVPX + if (StaticPrefs::media_ffvpx_enabled()) { + CreateAndStartupPDM(); + } +#endif +#ifdef MOZ_FFMPEG + if (StaticPrefs::media_ffmpeg_enabled() && + !CreateAndStartupPDM()) { + mFailureFlags += GetFailureFlagBasedOnFFmpegStatus( + FFmpegRuntimeLinker::LinkStatusCode()); + } +#endif +#ifdef MOZ_WIDGET_ANDROID + if (StaticPrefs::media_android_media_codec_enabled()) { + StartupPDM(AndroidDecoderModule::Create(), + StaticPrefs::media_android_media_codec_preferred()); + } +#endif + + CreateAndStartupPDM(); + + if (StaticPrefs::media_gmp_decoder_enabled() && + !StartupPDM(GMPDecoderModule::Create(), + StaticPrefs::media_gmp_decoder_preferred())) { + mFailureFlags += DecoderDoctorDiagnostics::Flags::GMPPDMFailedToStartup; + } +} + +void PDMFactory::CreateNullPDM() { + mNullPDM = CreateNullDecoderModule(); + MOZ_ASSERT(mNullPDM && NS_SUCCEEDED(mNullPDM->Startup())); +} + +bool PDMFactory::StartupPDM(already_AddRefed aPDM, + bool aInsertAtBeginning) { + RefPtr pdm = aPDM; + if (pdm && NS_SUCCEEDED(pdm->Startup())) { + if (aInsertAtBeginning) { + mCurrentPDMs.InsertElementAt(0, pdm); + } else { + mCurrentPDMs.AppendElement(pdm); + } + return true; + } + return false; +} + +already_AddRefed PDMFactory::GetDecoderModule( + const SupportDecoderParams& aParams, + DecoderDoctorDiagnostics* aDiagnostics) const { + if (aDiagnostics) { + // If libraries failed to load, the following loop over mCurrentPDMs + // will not even try to use them. So we record failures now. + aDiagnostics->SetFailureFlags(mFailureFlags); + } + + RefPtr pdm; + for (const auto& current : mCurrentPDMs) { + if (current->Supports(aParams, aDiagnostics) != + media::DecodeSupport::Unsupported) { + pdm = current; + break; + } + } + return pdm.forget(); +} + +void PDMFactory::SetCDMProxy(CDMProxy* aProxy) { + MOZ_ASSERT(aProxy); + +#ifdef MOZ_WIDGET_ANDROID + if (IsWidevineKeySystem(aProxy->KeySystem())) { + mEMEPDM = AndroidDecoderModule::Create(aProxy); + return; + } +#endif +#ifdef MOZ_WMF_CDM + if (IsPlayReadyKeySystemAndSupported(aProxy->KeySystem())) { + mEMEPDM = RemoteDecoderModule::Create( + RemoteDecodeIn::UtilityProcess_MFMediaEngineCDM); + return; + } +#endif + auto m = MakeRefPtr(); + mEMEPDM = MakeRefPtr(aProxy, m); +} + +/* static */ +media::MediaCodecsSupported PDMFactory::Supported(bool aForceRefresh) { + MOZ_ASSERT(NS_IsMainThread()); + + static auto calculate = []() { + auto pdm = MakeRefPtr(); + MediaCodecsSupported supported; + // H264 and AAC depends on external framework that must be dynamically + // loaded. + // We currently only ship a single PDM per platform able to decode AAC or + // H264. As such we can assert that being able to create a H264 or AAC + // decoder indicates that with WMF on Windows or FFmpeg on Unixes is + // available. + // This logic will have to be revisited if a PDM supporting either codec + // will be added in addition to the WMF and FFmpeg PDM (such as OpenH264) + for (const auto& cd : MCSInfo::GetAllCodecDefinitions()) { + supported += MCSInfo::GetDecodeMediaCodecsSupported( + cd.codec, pdm->SupportsMimeType(nsCString(cd.mimeTypeString))); + } + return supported; + }; + + static MediaCodecsSupported supported = calculate(); + if (aForceRefresh) { + supported = calculate(); + } + + return supported; +} + +/* static */ +DecodeSupportSet PDMFactory::SupportsMimeType( + const nsACString& aMimeType, const MediaCodecsSupported& aSupported, + RemoteDecodeIn aLocation) { + const TrackSupportSet supports = + RemoteDecoderManagerChild::GetTrackSupport(aLocation); + + if (supports.contains(TrackSupport::Video)) { + if (MP4Decoder::IsH264(aMimeType)) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::H264, aSupported); + } + if (VPXDecoder::IsVP9(aMimeType)) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::VP9, aSupported); + } + if (VPXDecoder::IsVP8(aMimeType)) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::VP8, aSupported); + } +#ifdef MOZ_AV1 + if (AOMDecoder::IsAV1(aMimeType)) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::AV1, aSupported); + } +#endif + if (TheoraDecoder::IsTheora(aMimeType)) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::Theora, aSupported); + } + } + + if (supports.contains(TrackSupport::Audio)) { + if (MP4Decoder::IsAAC(aMimeType)) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::AAC, aSupported); + } + if (aMimeType.EqualsLiteral("audio/mpeg")) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::MP3, aSupported); + } + if (OpusDataDecoder::IsOpus(aMimeType)) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::Opus, aSupported); + } + if (VorbisDataDecoder::IsVorbis(aMimeType)) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::Vorbis, aSupported); + } + if (aMimeType.EqualsLiteral("audio/flac")) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::FLAC, aSupported); + } + if (WaveDataDecoder::IsWave(aMimeType)) { + return MCSInfo::GetDecodeSupportSet(MediaCodec::Wave, aSupported); + } + } + return DecodeSupport::Unsupported; +} + +/* static */ +bool PDMFactory::AllDecodersAreRemote() { + return StaticPrefs::media_rdd_process_enabled() && +#if defined(MOZ_FFVPX) + StaticPrefs::media_rdd_ffvpx_enabled() && +#endif + StaticPrefs::media_rdd_opus_enabled() && + StaticPrefs::media_rdd_theora_enabled() && + StaticPrefs::media_rdd_vorbis_enabled() && + StaticPrefs::media_rdd_vpx_enabled() && +#if defined(MOZ_WMF) + StaticPrefs::media_rdd_wmf_enabled() && +#endif + StaticPrefs::media_rdd_wav_enabled(); +} + +#undef PDM_INIT_LOG +} // namespace mozilla diff --git a/dom/media/platforms/PDMFactory.h b/dom/media/platforms/PDMFactory.h new file mode 100644 index 0000000000..c56c11c506 --- /dev/null +++ b/dom/media/platforms/PDMFactory.h @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#if !defined(PDMFactory_h_) +# define PDMFactory_h_ + +# include "DecoderDoctorDiagnostics.h" +# include "MediaCodecsSupport.h" +# include "PlatformDecoderModule.h" +# include "mozilla/AlreadyAddRefed.h" +# include "mozilla/EnumSet.h" +# include "mozilla/MozPromise.h" +# include "mozilla/RefPtr.h" +# include "mozilla/ipc/UtilityProcessSandboxing.h" +# include "nsISupports.h" +# include "nsStringFwd.h" +# include "nsTArray.h" +# include + +namespace mozilla { + +class CDMProxy; +class MediaDataDecoder; +class MediaResult; +class StaticMutex; +struct CreateDecoderParams; +struct CreateDecoderParamsForAsync; +struct SupportDecoderParams; +enum class RemoteDecodeIn; + +using PDMCreateDecoderPromise = PlatformDecoderModule::CreateDecoderPromise; + +class PDMFactory final { + public: + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PDMFactory) + + PDMFactory(); + + // Factory method that creates the appropriate PlatformDecoderModule for + // the platform we're running on. + RefPtr CreateDecoder( + const CreateDecoderParams& aParams); + + media::DecodeSupportSet SupportsMimeType(const nsACString& aMimeType) const; + media::DecodeSupportSet Supports( + const SupportDecoderParams& aParams, + DecoderDoctorDiagnostics* aDiagnostics) const; + + // Creates a PlatformDecoderModule that uses a CDMProxy to decrypt or + // decrypt-and-decode EME encrypted content. If the CDM only decrypts and + // does not decode, we create a PDM and use that to create MediaDataDecoders + // that we use on on aTaskQueue to decode the decrypted stream. + // This is called on the decode task queue. + void SetCDMProxy(CDMProxy* aProxy); + + static constexpr int kYUV400 = 0; + static constexpr int kYUV420 = 1; + static constexpr int kYUV422 = 2; + static constexpr int kYUV444 = 3; + + static media::MediaCodecsSupported Supported(bool aForceRefresh = false); + static media::DecodeSupportSet SupportsMimeType( + const nsACString& aMimeType, + const media::MediaCodecsSupported& aSupported, RemoteDecodeIn aLocation); + + static bool AllDecodersAreRemote(); + + private: + virtual ~PDMFactory(); + + void CreatePDMs(); + void CreateNullPDM(); + void CreateGpuPDMs(); + void CreateRddPDMs(); + void CreateUtilityPDMs(); + void CreateContentPDMs(); + void CreateDefaultPDMs(); + + template + bool CreateAndStartupPDM(ARGS&&... aArgs) { + return StartupPDM(DECODER_MODULE::Create(std::forward(aArgs)...)); + } + + // Startup the provided PDM and add it to our list if successful. + bool StartupPDM(already_AddRefed aPDM, + bool aInsertAtBeginning = false); + // Returns the first PDM in our list supporting the mimetype. + already_AddRefed GetDecoderModule( + const SupportDecoderParams& aParams, + DecoderDoctorDiagnostics* aDiagnostics) const; + + RefPtr CreateDecoderWithPDM( + PlatformDecoderModule* aPDM, const CreateDecoderParams& aParams); + RefPtr CheckAndMaybeCreateDecoder( + CreateDecoderParamsForAsync&& aParams, uint32_t aIndex, + Maybe aEarlierError = Nothing()); + + nsTArray> mCurrentPDMs; + RefPtr mEMEPDM; + RefPtr mNullPDM; + + DecoderDoctorDiagnostics::FlagsSet mFailureFlags; + + friend class RemoteVideoDecoderParent; + static void EnsureInit(); +}; + +} // namespace mozilla + +#endif /* PDMFactory_h_ */ diff --git a/dom/media/platforms/PEMFactory.cpp b/dom/media/platforms/PEMFactory.cpp new file mode 100644 index 0000000000..40adf268fe --- /dev/null +++ b/dom/media/platforms/PEMFactory.cpp @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "PEMFactory.h" + +#ifdef MOZ_APPLEMEDIA +# include "AppleEncoderModule.h" +#endif + +#ifdef MOZ_WIDGET_ANDROID +# include "AndroidEncoderModule.h" +#endif + +#ifdef XP_WIN +# include "WMFEncoderModule.h" +#endif + +namespace mozilla { + +LazyLogModule sPEMLog("PlatformEncoderModule"); + +PEMFactory::PEMFactory() { +#ifdef MOZ_APPLEMEDIA + RefPtr m(new AppleEncoderModule()); + mModules.AppendElement(m); +#endif + +#ifdef MOZ_WIDGET_ANDROID + mModules.AppendElement(new AndroidEncoderModule()); +#endif + +#ifdef XP_WIN + mModules.AppendElement(new WMFEncoderModule()); +#endif +} + +bool PEMFactory::SupportsMimeType(const nsACString& aMimeType) const { + for (auto m : mModules) { + if (m->SupportsMimeType(aMimeType)) { + return true; + } + } + return false; +} + +already_AddRefed PEMFactory::CreateEncoder( + const CreateEncoderParams& aParams, const bool aHardwareNotAllowed) { + const TrackInfo& info = aParams.mConfig; + RefPtr m = FindPEM(info); + if (!m) { + return nullptr; + } + + return info.IsVideo() ? m->CreateVideoEncoder(aParams, aHardwareNotAllowed) + : nullptr; +} + +already_AddRefed PEMFactory::FindPEM( + const TrackInfo& aTrackInfo) const { + RefPtr found; + for (auto m : mModules) { + if (m->SupportsMimeType(aTrackInfo.mMimeType)) { + found = m; + break; + } + } + + return found.forget(); +} + +} // namespace mozilla diff --git a/dom/media/platforms/PEMFactory.h b/dom/media/platforms/PEMFactory.h new file mode 100644 index 0000000000..fdc922ba4b --- /dev/null +++ b/dom/media/platforms/PEMFactory.h @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#if !defined(PEMFactory_h_) +# define PEMFactory_h_ + +# include "PlatformEncoderModule.h" + +namespace mozilla { + +class PEMFactory final { + public: + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PEMFactory) + + PEMFactory(); + + // Factory method that creates the appropriate PlatformEncoderModule for + // the platform we're running on. Caller is responsible for deleting this + // instance. It's expected that there will be multiple + // PlatformEncoderModules alive at the same time. + already_AddRefed CreateEncoder( + const CreateEncoderParams& aParams, const bool aHardwareNotAllowed); + + bool SupportsMimeType(const nsACString& aMimeType) const; + + private: + virtual ~PEMFactory() = default; + // Returns the first PEM in our list supporting the mimetype. + already_AddRefed FindPEM( + const TrackInfo& aTrackInfo) const; + + nsTArray> mModules; +}; + +} // namespace mozilla + +#endif /* PEMFactory_h_ */ diff --git a/dom/media/platforms/PlatformDecoderModule.cpp b/dom/media/platforms/PlatformDecoderModule.cpp new file mode 100644 index 0000000000..ceff8ca2ed --- /dev/null +++ b/dom/media/platforms/PlatformDecoderModule.cpp @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "PlatformDecoderModule.h" + +#include "ImageContainer.h" +#include "nsPrintfCString.h" + +namespace mozilla { + +CreateDecoderParamsForAsync::CreateDecoderParamsForAsync( + const CreateDecoderParams& aParams) + : mConfig(aParams.mConfig.Clone()), + mImageContainer(aParams.mImageContainer), + mKnowsCompositor(aParams.mKnowsCompositor), + mCrashHelper(aParams.mCrashHelper), + mUseNullDecoder(aParams.mUseNullDecoder), + mNoWrapper(aParams.mNoWrapper), + mType(aParams.mType), + mOnWaitingForKeyEvent(aParams.mOnWaitingForKeyEvent), + mOptions(aParams.mOptions), + mRate(aParams.mRate), + mMediaEngineId(aParams.mMediaEngineId), + mTrackingId(aParams.mTrackingId) {} + +CreateDecoderParamsForAsync::CreateDecoderParamsForAsync( + CreateDecoderParamsForAsync&& aParams) = default; + +RefPtr +PlatformDecoderModule::AsyncCreateDecoder(const CreateDecoderParams& aParams) { + RefPtr decoder; + MediaResult result = NS_OK; + if (aParams.mConfig.IsAudio()) { + decoder = CreateAudioDecoder(CreateDecoderParams{aParams, &result}); + } else if (aParams.mConfig.IsVideo()) { + decoder = CreateVideoDecoder(CreateDecoderParams{aParams, &result}); + } + if (!decoder) { + if (NS_FAILED(result)) { + return CreateDecoderPromise::CreateAndReject(result, __func__); + } + return CreateDecoderPromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + nsPrintfCString("Error creating decoder for %s", + aParams.mConfig.mMimeType.get()) + .get()), + __func__); + } + return CreateDecoderPromise::CreateAndResolve(decoder, __func__); +} + +} // namespace mozilla diff --git a/dom/media/platforms/PlatformDecoderModule.h b/dom/media/platforms/PlatformDecoderModule.h new file mode 100644 index 0000000000..a230428748 --- /dev/null +++ b/dom/media/platforms/PlatformDecoderModule.h @@ -0,0 +1,567 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#if !defined(PlatformDecoderModule_h_) +# define PlatformDecoderModule_h_ + +# include + +# include "DecoderDoctorLogger.h" +# include "GMPCrashHelper.h" +# include "MediaCodecsSupport.h" +# include "MediaEventSource.h" +# include "MediaInfo.h" +# include "MediaResult.h" +# include "mozilla/EnumSet.h" +# include "mozilla/EnumTypeTraits.h" +# include "mozilla/MozPromise.h" +# include "mozilla/RefPtr.h" +# include "mozilla/TaskQueue.h" +# include "mozilla/layers/KnowsCompositor.h" +# include "mozilla/layers/LayersTypes.h" +# include "mozilla/ipc/UtilityAudioDecoder.h" +# include "nsTArray.h" +# include "PerformanceRecorder.h" + +namespace mozilla { +class TrackInfo; +class AudioInfo; +class VideoInfo; +class MediaRawData; +class DecoderDoctorDiagnostics; + +namespace layers { +class ImageContainer; +} // namespace layers + +class MediaDataDecoder; +class RemoteDecoderModule; +class CDMProxy; + +static LazyLogModule sPDMLog("PlatformDecoderModule"); + +namespace media { + +enum class Option { + Default, + LowLatency, + HardwareDecoderNotAllowed, + FullH264Parsing, + ErrorIfNoInitializationData, // By default frames delivered before + // initialization data are dropped. Pass this + // option to raise an error if frames are + // delivered before initialization data. + DefaultPlaybackDeviceMono, // Currently only used by Opus on RDD to avoid + // initialization of audio backends on RDD + + SENTINEL // one past the last valid value +}; +using OptionSet = EnumSet