media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef WEBRTC_GONK
michael@0 6 #pragma error WebrtcOMXH264VideoCodec works only on B2G.
michael@0 7 #endif
michael@0 8
michael@0 9 #ifndef WEBRTC_OMX_H264_CODEC_H_
michael@0 10 #define WEBRTC_OMX_H264_CODEC_H_
michael@0 11
michael@0 12 #include "AudioConduit.h"
michael@0 13 #include "VideoConduit.h"
michael@0 14
michael@0 15 namespace android {
michael@0 16 class OMXVideoEncoder;
michael@0 17 }
michael@0 18
michael@0 19 namespace mozilla {
michael@0 20
michael@0 21 class WebrtcOMXDecoder;
michael@0 22 class OMXOutputDrain;
michael@0 23
michael@0 24 class WebrtcOMXH264VideoEncoder : public WebrtcVideoEncoder
michael@0 25 {
michael@0 26 public:
michael@0 27 WebrtcOMXH264VideoEncoder();
michael@0 28
michael@0 29 virtual ~WebrtcOMXH264VideoEncoder();
michael@0 30
michael@0 31 // Implement VideoEncoder interface.
michael@0 32 virtual int32_t InitEncode(const webrtc::VideoCodec* aCodecSettings,
michael@0 33 int32_t aNumOfCores,
michael@0 34 uint32_t aMaxPayloadSize) MOZ_OVERRIDE;
michael@0 35
michael@0 36 virtual int32_t Encode(const webrtc::I420VideoFrame& aInputImage,
michael@0 37 const webrtc::CodecSpecificInfo* aCodecSpecificInfo,
michael@0 38 const std::vector<webrtc::VideoFrameType>* aFrameTypes) MOZ_OVERRIDE;
michael@0 39
michael@0 40 virtual int32_t RegisterEncodeCompleteCallback(webrtc::EncodedImageCallback* aCallback) MOZ_OVERRIDE;
michael@0 41
michael@0 42 virtual int32_t Release() MOZ_OVERRIDE;
michael@0 43
michael@0 44 virtual int32_t SetChannelParameters(uint32_t aPacketLossRate,
michael@0 45 int aRoundTripTimeMs) MOZ_OVERRIDE;
michael@0 46
michael@0 47 virtual int32_t SetRates(uint32_t aBitRate, uint32_t aFrameRate) MOZ_OVERRIDE;
michael@0 48
michael@0 49 private:
michael@0 50 RefPtr<android::OMXVideoEncoder> mOMX;
michael@0 51 webrtc::EncodedImageCallback* mCallback;
michael@0 52 RefPtr<OMXOutputDrain> mOutputDrain;
michael@0 53 uint32_t mWidth;
michael@0 54 uint32_t mHeight;
michael@0 55 uint32_t mFrameRate;
michael@0 56 bool mOMXConfigured;
michael@0 57 webrtc::EncodedImage mEncodedImage;
michael@0 58 };
michael@0 59
michael@0 60 class WebrtcOMXH264VideoDecoder : public WebrtcVideoDecoder
michael@0 61 {
michael@0 62 public:
michael@0 63 WebrtcOMXH264VideoDecoder();
michael@0 64
michael@0 65 virtual ~WebrtcOMXH264VideoDecoder();
michael@0 66
michael@0 67 // Implement VideoDecoder interface.
michael@0 68 virtual int32_t InitDecode(const webrtc::VideoCodec* aCodecSettings,
michael@0 69 int32_t aNumOfCores) MOZ_OVERRIDE;
michael@0 70 virtual int32_t Decode(const webrtc::EncodedImage& aInputImage,
michael@0 71 bool aMissingFrames,
michael@0 72 const webrtc::RTPFragmentationHeader* aFragmentation,
michael@0 73 const webrtc::CodecSpecificInfo* aCodecSpecificInfo = nullptr,
michael@0 74 int64_t aRenderTimeMs = -1) MOZ_OVERRIDE;
michael@0 75 virtual int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* callback) MOZ_OVERRIDE;
michael@0 76
michael@0 77 virtual int32_t Release() MOZ_OVERRIDE;
michael@0 78
michael@0 79 virtual int32_t Reset() MOZ_OVERRIDE;
michael@0 80
michael@0 81 private:
michael@0 82 webrtc::DecodedImageCallback* mCallback;
michael@0 83 RefPtr<WebrtcOMXDecoder> mOMX;
michael@0 84 };
michael@0 85
michael@0 86 }
michael@0 87
michael@0 88 #endif // WEBRTC_OMX_H264_CODEC_H_

mercurial