tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GMPDecoderModule.h (2241B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #if !defined(GMPDecoderModule_h_)
      8 #  define GMPDecoderModule_h_
      9 
     10 #  include "PlatformDecoderModule.h"
     11 #  include "mozilla/Maybe.h"
     12 
     13 // The special NodeId we use when doing unencrypted decoding using the GMP's
     14 // decoder. This ensures that each GMP MediaDataDecoder we create doesn't
     15 // require spinning up a new process, but instead we run all instances of
     16 // GMP decoders in the one process, to reduce overhead.
     17 //
     18 // Note: GMP storage is isolated by NodeId, and non persistent for this
     19 // special NodeId, and the only way a GMP can communicate with the outside
     20 // world is through the EME GMP APIs, and we never run EME with this NodeID
     21 // (because NodeIds are random strings which can't contain the '-' character),
     22 // so there's no way a malicious GMP can harvest, store, and then report any
     23 // privacy sensitive data about what users are watching.
     24 #  define SHARED_GMP_DECODING_NODE_ID "gmp-shared-decoding"_ns
     25 
     26 namespace mozilla {
     27 
     28 class GMPDecoderModule : public PlatformDecoderModule {
     29  const char* Name() const override { return "GMP"; }
     30  template <typename T, typename... Args>
     31  friend already_AddRefed<T> MakeAndAddRef(Args&&...);
     32 
     33 public:
     34  static already_AddRefed<PlatformDecoderModule> Create();
     35 
     36  // Decode thread.
     37  already_AddRefed<MediaDataDecoder> CreateVideoDecoder(
     38      const CreateDecoderParams& aParams) override;
     39 
     40  // Decode thread.
     41  already_AddRefed<MediaDataDecoder> CreateAudioDecoder(
     42      const CreateDecoderParams& aParams) override;
     43 
     44  media::DecodeSupportSet SupportsMimeType(
     45      const nsACString& aMimeType,
     46      DecoderDoctorDiagnostics* aDiagnostics) const override;
     47 
     48  static media::DecodeSupportSet SupportsMimeType(
     49      const nsACString& aMimeType, const nsACString& aApi,
     50      const Maybe<nsCString>& aKeySystem);
     51 
     52 private:
     53  GMPDecoderModule() = default;
     54  virtual ~GMPDecoderModule() = default;
     55 };
     56 
     57 }  // namespace mozilla
     58 
     59 #endif  // GMPDecoderModule_h_