1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 #ifndef include_dom_media_ipc_RemoteDecoderModule_h
7 #define include_dom_media_ipc_RemoteDecoderModule_h
8 #include "PlatformDecoderModule.h"
9 
10 #include "mozilla/StaticMutex.h"
11 
12 namespace mozilla {
13 
14 // A PDM implementation that creates a RemoteMediaDataDecoder (a
15 // MediaDataDecoder) that proxies to a RemoteVideoDecoderChild.
16 // A decoder child will talk to its respective decoder parent
17 // (RemoteVideoDecoderParent) on the RDD process.
18 class RemoteDecoderModule : public PlatformDecoderModule {
19  public:
20   RemoteDecoderModule();
21 
22   bool SupportsMimeType(const nsACString& aMimeType,
23                         DecoderDoctorDiagnostics* aDiagnostics) const override;
24 
25   already_AddRefed<MediaDataDecoder> CreateVideoDecoder(
26       const CreateDecoderParams& aParams) override;
27 
28   already_AddRefed<MediaDataDecoder> CreateAudioDecoder(
29       const CreateDecoderParams& aParams) override;
30 
31  protected:
32   void LaunchRDDProcessIfNeeded();
33 
34  private:
35   RefPtr<nsIThread> mManagerThread;
36   static StaticMutex sLaunchMonitor;
37 };
38 
39 }  // namespace mozilla
40 
41 #endif  // include_dom_media_ipc_RemoteDecoderModule_h
42