/* 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 MEDIA_CONDUIT_ABSTRACTION_ #define MEDIA_CONDUIT_ABSTRACTION_ #include "nsISupportsImpl.h" #include "nsXPCOM.h" #include "nsDOMNavigationTiming.h" #include "mozilla/RefPtr.h" #include "CodecConfig.h" #include "VideoTypes.h" #include "MediaConduitErrors.h" #include "ImageContainer.h" #include "webrtc/common_types.h" namespace webrtc { class I420VideoFrame; } #include namespace mozilla { /** * Abstract Interface for transporting RTP packets - audio/vidoeo * The consumers of this interface are responsible for passing in * the RTPfied media packets */ class TransportInterface { protected: virtual ~TransportInterface() {} public: /** * RTP Transport Function to be implemented by concrete transport implementation * @param data : RTP Packet (audio/video) to be transported * @param len : Length of the media packet * @result : NS_OK on success, NS_ERROR_FAILURE otherwise */ virtual nsresult SendRtpPacket(const void* data, int len) = 0; /** * RTCP Transport Function to be implemented by concrete transport implementation * @param data : RTCP Packet to be transported * @param len : Length of the RTCP packet * @result : NS_OK on success, NS_ERROR_FAILURE otherwise */ virtual nsresult SendRtcpPacket(const void* data, int len) = 0; NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TransportInterface) }; /** * This class wraps image object for VideoRenderer::RenderVideoFrame() * callback implementation to use for rendering. */ class ImageHandle { public: explicit ImageHandle(layers::Image* image) : mImage(image) {} const RefPtr& GetImage() const { return mImage; } private: RefPtr mImage; }; /** * 1. Abstract renderer for video data * 2. This class acts as abstract interface between the video-engine and * video-engine agnostic renderer implementation. * 3. Concrete implementation of this interface is responsible for * processing and/or rendering the obtained raw video frame to appropriate * output , say,