summaryrefslogtreecommitdiffstats
path: root/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.h')
-rw-r--r--media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.h114
1 files changed, 114 insertions, 0 deletions
diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.h b/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.h
new file mode 100644
index 000000000..9d7e900fe
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.h
@@ -0,0 +1,114 @@
+/* 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 WebrtcMediaCodecVP8VideoCodec_h__
+#define WebrtcMediaCodecVP8VideoCodec_h__
+
+#include "mozilla/Mutex.h"
+#include "nsThreadUtils.h"
+#include "nsAutoPtr.h"
+
+#include "MediaConduitInterface.h"
+#include "AudioConduit.h"
+#include "VideoConduit.h"
+
+namespace mozilla {
+
+struct EncodedFrame {
+ uint32_t width_;
+ uint32_t height_;
+ uint32_t timeStamp_;
+ uint64_t decode_timestamp_;
+};
+
+class WebrtcAndroidMediaCodec;
+
+class WebrtcMediaCodecVP8VideoEncoder : public WebrtcVideoEncoder {
+public:
+ WebrtcMediaCodecVP8VideoEncoder();
+
+ virtual ~WebrtcMediaCodecVP8VideoEncoder() override;
+
+ // Implement VideoEncoder interface.
+ virtual uint64_t PluginID() const override { return 0; }
+
+ virtual int32_t InitEncode(const webrtc::VideoCodec* codecSettings,
+ int32_t numberOfCores,
+ size_t maxPayloadSize) override;
+
+ virtual int32_t Encode(const webrtc::I420VideoFrame& inputImage,
+ const webrtc::CodecSpecificInfo* codecSpecificInfo,
+ const std::vector<webrtc::VideoFrameType>* frame_types) override;
+
+ virtual int32_t RegisterEncodeCompleteCallback(webrtc::EncodedImageCallback* callback) override;
+
+ virtual int32_t Release() override;
+
+ virtual int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) override;
+
+ virtual int32_t SetRates(uint32_t newBitRate, uint32_t frameRate) override;
+
+private:
+ int32_t VerifyAndAllocate(const uint32_t minimumSize);
+ bool ResetInputBuffers();
+ bool ResetOutputBuffers();
+
+ size_t mMaxPayloadSize;
+ uint32_t mTimestamp;
+ webrtc::EncodedImage mEncodedImage;
+ webrtc::EncodedImageCallback* mCallback;
+ uint32_t mFrameWidth;
+ uint32_t mFrameHeight;
+
+ WebrtcAndroidMediaCodec* mMediaCodecEncoder;
+
+ jobjectArray mInputBuffers;
+ jobjectArray mOutputBuffers;
+};
+
+class WebrtcMediaCodecVP8VideoDecoder : public WebrtcVideoDecoder {
+public:
+ WebrtcMediaCodecVP8VideoDecoder();
+
+ virtual ~WebrtcMediaCodecVP8VideoDecoder() override;
+
+ // Implement VideoDecoder interface.
+ virtual uint64_t PluginID() const override { return 0; }
+
+ virtual int32_t InitDecode(const webrtc::VideoCodec* codecSettings,
+ int32_t numberOfCores) override;
+
+ virtual int32_t Decode(const webrtc::EncodedImage& inputImage,
+ bool missingFrames,
+ const webrtc::RTPFragmentationHeader* fragmentation,
+ const webrtc::CodecSpecificInfo*
+ codecSpecificInfo = NULL,
+ int64_t renderTimeMs = -1) override;
+
+ virtual int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* callback) override;
+
+ virtual int32_t Release() override;
+
+ virtual int32_t Reset() override;
+
+private:
+ void DecodeFrame(EncodedFrame* frame);
+ void RunCallback();
+ bool ResetInputBuffers();
+ bool ResetOutputBuffers();
+
+ webrtc::DecodedImageCallback* mCallback;
+
+ uint32_t mFrameWidth;
+ uint32_t mFrameHeight;
+
+ WebrtcAndroidMediaCodec* mMediaCodecDecoder;
+ jobjectArray mInputBuffers;
+ jobjectArray mOutputBuffers;
+
+};
+
+}
+
+#endif // WebrtcMediaCodecVP8VideoCodec_h__