blob: ccb54c692b0a5d45bdf798c52fceebb5152163ac (
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
|
/* 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 "common_video/include/video_frame_buffer.h"
#include "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:
WebrtcMediaDataDecoder(nsACString& aCodecMimeType, TrackingId aTrackingId);
bool Configure(const webrtc::VideoDecoder::Settings& settings) override;
int32_t Decode(const webrtc::EncodedImage& inputImage, bool missingFrames,
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;
bool mDisabledHardwareAcceleration = false;
const TrackingId mTrackingId;
};
} // namespace mozilla
#endif // WebrtcMediaDataDecoderCodec_h__
|