blob: 8d609fe9d67df16ac05d5c3c6d39dbe04b690237 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/* 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 WebrtcMediaDataDecoderCodec_h__
#define WebrtcMediaDataDecoderCodec_h__
#include "MediaConduitInterface.h"
#include "MediaInfo.h"
#include "MediaResult.h"
#include "PlatformDecoderModule.h"
#include "VideoConduit.h"
#include "WebrtcImageBuffer.h"
#include "webrtc/common_video/include/video_frame_buffer.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
namespace webrtc {
class DecodedImageCallback;
}
namespace mozilla {
namespace layers {
class Image;
class ImageContainer;
} // namespace layers
class PDMFactory;
class SharedThreadPool;
class TaskQueue;
class WebrtcMediaDataDecoder : public WebrtcVideoDecoder {
public:
explicit WebrtcMediaDataDecoder(nsACString& aCodecMimeType);
// Implement VideoDecoder interface.
uint64_t PluginID() const override { return 0; }
int32_t InitDecode(const webrtc::VideoCodec* codecSettings,
int32_t numberOfCores) override;
int32_t Decode(const webrtc::EncodedImage& inputImage, bool missingFrames,
const webrtc::RTPFragmentationHeader* fragmentation,
const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL,
int64_t renderTimeMs = -1) override;
int32_t RegisterDecodeCompleteCallback(
webrtc::DecodedImageCallback* callback) override;
int32_t Release() override;
private:
~WebrtcMediaDataDecoder();
void QueueFrame(MediaRawData* aFrame);
bool OnTaskQueue() const;
int32_t CreateDecoder();
const RefPtr<SharedThreadPool> mThreadPool;
const RefPtr<TaskQueue> mTaskQueue;
const RefPtr<layers::ImageContainer> mImageContainer;
const RefPtr<PDMFactory> mFactory;
RefPtr<MediaDataDecoder> mDecoder;
webrtc::DecodedImageCallback* mCallback = nullptr;
VideoInfo mInfo;
TrackInfo::TrackType mTrackType;
bool mNeedKeyframe = true;
MozPromiseRequestHolder<MediaDataDecoder::DecodePromise> mDecodeRequest;
MediaResult mError = NS_OK;
MediaDataDecoder::DecodedData mResults;
const nsCString mCodecType;
};
} // namespace mozilla
#endif // WebrtcMediaDataDecoderCodec_h__
|