/* 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 "mozilla/RefCounted.h" #include "mozilla/UniquePtr.h" #include "RtpSourceObserver.h" #include "RtcpEventObserver.h" #include "CodecConfig.h" #include "VideoTypes.h" #include "MediaConduitErrors.h" #include "jsapi/RTCStatsReport.h" #include "ImageContainer.h" #include "webrtc/call/call.h" #include "webrtc/common_types.h" #include "webrtc/common_types.h" #include "webrtc/api/video/video_frame_buffer.h" #include "webrtc/logging/rtc_event_log/rtc_event_log.h" #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" #include "webrtc/modules/audio_device/include/fake_audio_device.h" #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/voice_engine/include/voe_base.h" #include #include namespace webrtc { class VideoFrame; } namespace mozilla { enum class MediaSessionConduitLocalDirection : int { kSend, kRecv }; class VideoSessionConduit; class AudioSessionConduit; class RtpRtcpConfig; using RtpExtList = std::vector; /** * 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 uint8_t* data, size_t 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 uint8_t* data, size_t len) = 0; NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TransportInterface) }; /** * 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,