diff -r 000000000000 -r 6474c204b198 media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,88 @@ +/* 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 WEBRTC_GONK +#pragma error WebrtcOMXH264VideoCodec works only on B2G. +#endif + +#ifndef WEBRTC_OMX_H264_CODEC_H_ +#define WEBRTC_OMX_H264_CODEC_H_ + +#include "AudioConduit.h" +#include "VideoConduit.h" + +namespace android { + class OMXVideoEncoder; +} + +namespace mozilla { + +class WebrtcOMXDecoder; +class OMXOutputDrain; + +class WebrtcOMXH264VideoEncoder : public WebrtcVideoEncoder +{ +public: + WebrtcOMXH264VideoEncoder(); + + virtual ~WebrtcOMXH264VideoEncoder(); + + // Implement VideoEncoder interface. + virtual int32_t InitEncode(const webrtc::VideoCodec* aCodecSettings, + int32_t aNumOfCores, + uint32_t aMaxPayloadSize) MOZ_OVERRIDE; + + virtual int32_t Encode(const webrtc::I420VideoFrame& aInputImage, + const webrtc::CodecSpecificInfo* aCodecSpecificInfo, + const std::vector* aFrameTypes) MOZ_OVERRIDE; + + virtual int32_t RegisterEncodeCompleteCallback(webrtc::EncodedImageCallback* aCallback) MOZ_OVERRIDE; + + virtual int32_t Release() MOZ_OVERRIDE; + + virtual int32_t SetChannelParameters(uint32_t aPacketLossRate, + int aRoundTripTimeMs) MOZ_OVERRIDE; + + virtual int32_t SetRates(uint32_t aBitRate, uint32_t aFrameRate) MOZ_OVERRIDE; + +private: + RefPtr mOMX; + webrtc::EncodedImageCallback* mCallback; + RefPtr mOutputDrain; + uint32_t mWidth; + uint32_t mHeight; + uint32_t mFrameRate; + bool mOMXConfigured; + webrtc::EncodedImage mEncodedImage; +}; + +class WebrtcOMXH264VideoDecoder : public WebrtcVideoDecoder +{ +public: + WebrtcOMXH264VideoDecoder(); + + virtual ~WebrtcOMXH264VideoDecoder(); + + // Implement VideoDecoder interface. + virtual int32_t InitDecode(const webrtc::VideoCodec* aCodecSettings, + int32_t aNumOfCores) MOZ_OVERRIDE; + virtual int32_t Decode(const webrtc::EncodedImage& aInputImage, + bool aMissingFrames, + const webrtc::RTPFragmentationHeader* aFragmentation, + const webrtc::CodecSpecificInfo* aCodecSpecificInfo = nullptr, + int64_t aRenderTimeMs = -1) MOZ_OVERRIDE; + virtual int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* callback) MOZ_OVERRIDE; + + virtual int32_t Release() MOZ_OVERRIDE; + + virtual int32_t Reset() MOZ_OVERRIDE; + +private: + webrtc::DecodedImageCallback* mCallback; + RefPtr mOMX; +}; + +} + +#endif // WEBRTC_OMX_H264_CODEC_H_