Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/MediaDataDecoderProxy.h
Line
Count
Source (jump to first uncovered line)
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(MediaDataDecoderProxy_h_)
8
#define MediaDataDecoderProxy_h_
9
10
#include "PlatformDecoderModule.h"
11
#include "mozilla/Atomics.h"
12
#include "mozilla/RefPtr.h"
13
#include "nsThreadUtils.h"
14
#include "nscore.h"
15
16
namespace mozilla {
17
18
DDLoggedTypeDeclNameAndBase(MediaDataDecoderProxy, MediaDataDecoder);
19
20
class MediaDataDecoderProxy
21
  : public MediaDataDecoder
22
  , public DecoderDoctorLifeLogger<MediaDataDecoderProxy>
23
{
24
public:
25
  explicit MediaDataDecoderProxy(already_AddRefed<AbstractThread> aProxyThread)
26
    : mProxyThread(aProxyThread)
27
#if defined(DEBUG)
28
    , mIsShutdown(false)
29
#endif
30
0
  {
31
0
  }
32
33
  explicit MediaDataDecoderProxy(
34
    already_AddRefed<MediaDataDecoder> aProxyDecoder)
35
    : mProxyDecoder(aProxyDecoder)
36
#if defined(DEBUG)
37
    , mIsShutdown(false)
38
#endif
39
0
  {
40
0
    DDLINKCHILD("proxy decoder", mProxyDecoder.get());
41
0
  }
42
43
  void SetProxyTarget(MediaDataDecoder* aProxyDecoder)
44
0
  {
45
0
    MOZ_ASSERT(aProxyDecoder);
46
0
    mProxyDecoder = aProxyDecoder;
47
0
    DDLINKCHILD("proxy decoder", aProxyDecoder);
48
0
  }
49
50
  RefPtr<InitPromise> Init() override;
51
  RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
52
  RefPtr<DecodePromise> Drain() override;
53
  RefPtr<FlushPromise> Flush() override;
54
  RefPtr<ShutdownPromise> Shutdown() override;
55
  nsCString GetDescriptionName() const override;
56
  bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
57
  void SetSeekThreshold(const media::TimeUnit& aTime) override;
58
  bool SupportDecoderRecycling() const override;
59
  ConversionRequired NeedsConversion() const override;
60
61
private:
62
  RefPtr<MediaDataDecoder> mProxyDecoder;
63
  RefPtr<AbstractThread> mProxyThread;
64
65
#if defined(DEBUG)
66
  Atomic<bool> mIsShutdown;
67
#endif
68
};
69
70
} // namespace mozilla
71
72
#endif // MediaDataDecoderProxy_h_