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_RemoteAudioDecoderChild_h
7 #define include_dom_media_ipc_RemoteAudioDecoderChild_h
8 #include "RemoteDecoderChild.h"
9 #include "RemoteDecoderParent.h"
10 
11 namespace mozilla {
12 
13 using mozilla::ipc::IPCResult;
14 
15 class RemoteAudioDecoderChild final : public RemoteDecoderChild {
16  public:
17   explicit RemoteAudioDecoderChild();
18 
19   MOZ_IS_CLASS_INIT
20   MediaResult InitIPDL(const AudioInfo& aAudioInfo,
21                        const CreateDecoderParams::OptionSet& aOptions);
22 
23   MediaResult ProcessOutput(DecodedOutputIPDL&& aDecodedData) override;
24 };
25 
26 class RemoteAudioDecoderParent final : public RemoteDecoderParent {
27  public:
28   RemoteAudioDecoderParent(RemoteDecoderManagerParent* aParent,
29                            const AudioInfo& aAudioInfo,
30                            const CreateDecoderParams::OptionSet& aOptions,
31                            nsISerialEventTarget* aManagerThread,
32                            TaskQueue* aDecodeTaskQueue);
33 
34  protected:
35   IPCResult RecvConstruct(ConstructResolver&& aResolver) override;
36   MediaResult ProcessDecodedData(MediaDataDecoder::DecodedData&& aData,
37                                  DecodedOutputIPDL& aDecodedData) override;
38 
39  private:
40   // Can only be accessed from the manager thread
41   // Note: we can't keep a reference to the original AudioInfo here
42   // because unlike in typical MediaDataDecoder situations, we're being
43   // passed a deserialized AudioInfo from RecvPRemoteDecoderConstructor
44   // which is destroyed when RecvPRemoteDecoderConstructor returns.
45   const AudioInfo mAudioInfo;
46   const CreateDecoderParams::OptionSet mOptions;
47 };
48 
49 }  // namespace mozilla
50 
51 #endif  // include_dom_media_ipc_RemoteAudioDecoderChild_h
52