2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-01-24 17:16:59 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_VIDEO_H_
|
|
|
|
|
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_VIDEO_H_
|
|
|
|
|
|
|
|
|
|
#include "rtp_rtcp_defines.h"
|
|
|
|
|
#include "rtp_utility.h"
|
|
|
|
|
|
|
|
|
|
#include "typedefs.h"
|
|
|
|
|
|
|
|
|
|
#include "overuse_detector.h"
|
|
|
|
|
#include "remote_rate_control.h"
|
|
|
|
|
#include "Bitrate.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
class ReceiverFEC;
|
2011-09-20 13:52:04 +00:00
|
|
|
class ModuleRtpRtcpImpl;
|
2012-01-19 15:53:59 +00:00
|
|
|
class CriticalSectionWrapper;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
class RTPReceiverVideo
|
|
|
|
|
{
|
|
|
|
|
public:
|
2012-01-30 09:03:37 +00:00
|
|
|
RTPReceiverVideo();
|
2012-01-19 15:53:59 +00:00
|
|
|
RTPReceiverVideo(const WebRtc_Word32 id, ModuleRtpRtcpImpl* owner);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
virtual ~RTPReceiverVideo();
|
|
|
|
|
|
|
|
|
|
virtual void ChangeUniqueId(const WebRtc_Word32 id);
|
|
|
|
|
|
|
|
|
|
WebRtc_Word32 Init();
|
|
|
|
|
|
2011-10-13 15:19:55 +00:00
|
|
|
WebRtc_Word32 RegisterIncomingVideoCallback(
|
|
|
|
|
RtpVideoFeedback* incomingMessagesCallback);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-10-13 15:19:55 +00:00
|
|
|
void UpdateBandwidthManagement(const WebRtc_UWord32 bitrateBps,
|
2011-07-07 08:21:25 +00:00
|
|
|
const WebRtc_UWord8 fractionLost,
|
2011-10-13 15:19:55 +00:00
|
|
|
const WebRtc_UWord16 roundTripTimeMs);
|
|
|
|
|
|
|
|
|
|
ModuleRTPUtility::Payload* RegisterReceiveVideoPayload(
|
2012-01-24 17:16:59 +00:00
|
|
|
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
2011-10-13 15:19:55 +00:00
|
|
|
const WebRtc_Word8 payloadType,
|
|
|
|
|
const WebRtc_UWord32 maxRate);
|
|
|
|
|
|
|
|
|
|
WebRtc_Word32 ParseVideoCodecSpecific(
|
|
|
|
|
WebRtcRTPHeader* rtpHeader,
|
|
|
|
|
const WebRtc_UWord8* payloadData,
|
|
|
|
|
const WebRtc_UWord16 payloadDataLength,
|
|
|
|
|
const RtpVideoCodecTypes videoType,
|
|
|
|
|
const bool isRED,
|
|
|
|
|
const WebRtc_UWord8* incomingRtpPacket,
|
2011-12-01 15:42:31 +00:00
|
|
|
const WebRtc_UWord16 incomingRtpPacketSize,
|
|
|
|
|
const WebRtc_Word64 nowMS);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-01-30 09:03:37 +00:00
|
|
|
virtual WebRtc_Word32 ReceiveRecoveredPacketCallback(
|
2011-10-13 15:19:55 +00:00
|
|
|
WebRtcRTPHeader* rtpHeader,
|
|
|
|
|
const WebRtc_UWord8* payloadData,
|
|
|
|
|
const WebRtc_UWord16 payloadDataLength);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
void SetPacketOverHead(WebRtc_UWord16 packetOverHead);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void ResetOverUseDetector();
|
|
|
|
|
|
|
|
|
|
WebRtc_UWord16 EstimateBandwidth( const WebRtc_UWord16 bufferLength);
|
|
|
|
|
|
2011-10-13 15:19:55 +00:00
|
|
|
virtual WebRtc_Word32 CallbackOfReceivedPayloadData(
|
|
|
|
|
const WebRtc_UWord8* payloadData,
|
|
|
|
|
const WebRtc_UWord16 payloadSize,
|
|
|
|
|
const WebRtcRTPHeader* rtpHeader) = 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
virtual WebRtc_UWord32 TimeStamp() const = 0;
|
|
|
|
|
virtual WebRtc_UWord16 SequenceNumber() const = 0;
|
|
|
|
|
|
2011-10-13 15:19:55 +00:00
|
|
|
virtual WebRtc_UWord32 PayloadTypeToPayload(
|
|
|
|
|
const WebRtc_UWord8 payloadType,
|
|
|
|
|
ModuleRTPUtility::Payload*& payload) const = 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-10-13 15:19:55 +00:00
|
|
|
virtual bool RetransmitOfOldPacket(
|
|
|
|
|
const WebRtc_UWord16 sequenceNumber,
|
|
|
|
|
const WebRtc_UWord32 rtpTimeStamp) const = 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
virtual WebRtc_Word8 REDPayloadType() const = 0;
|
|
|
|
|
|
|
|
|
|
WebRtc_Word32 SetCodecType(const RtpVideoCodecTypes videoType,
|
2011-10-13 15:19:55 +00:00
|
|
|
WebRtcRTPHeader* rtpHeader) const;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-10-13 15:19:55 +00:00
|
|
|
WebRtc_Word32 ParseVideoCodecSpecificSwitch(
|
|
|
|
|
WebRtcRTPHeader* rtpHeader,
|
|
|
|
|
const WebRtc_UWord8* payloadData,
|
|
|
|
|
const WebRtc_UWord16 payloadDataLength,
|
|
|
|
|
const RtpVideoCodecTypes videoType);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
WebRtc_Word32 ReceiveGenericCodec(WebRtcRTPHeader *rtpHeader,
|
2011-10-13 15:19:55 +00:00
|
|
|
const WebRtc_UWord8* payloadData,
|
|
|
|
|
const WebRtc_UWord16 payloadDataLength);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
WebRtc_Word32 ReceiveVp8Codec(WebRtcRTPHeader *rtpHeader,
|
2011-10-13 15:19:55 +00:00
|
|
|
const WebRtc_UWord8* payloadData,
|
|
|
|
|
const WebRtc_UWord16 payloadDataLength);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
WebRtc_Word32 BuildRTPheader(const WebRtcRTPHeader* rtpHeader,
|
2011-10-13 15:19:55 +00:00
|
|
|
WebRtc_UWord8* dataBuffer) const;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
WebRtc_Word32 _id;
|
2012-01-30 09:03:37 +00:00
|
|
|
ModuleRtpRtcpImpl* _rtpRtcp;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-12-13 19:17:27 +00:00
|
|
|
CriticalSectionWrapper* _criticalSectionFeedback;
|
2011-09-20 13:52:04 +00:00
|
|
|
RtpVideoFeedback* _cbVideoFeedback;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-12-13 19:17:27 +00:00
|
|
|
CriticalSectionWrapper* _criticalSectionReceiverVideo;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
// bandwidth
|
2011-10-13 15:19:55 +00:00
|
|
|
bool _completeFrame;
|
2011-07-07 08:21:25 +00:00
|
|
|
WebRtc_UWord32 _packetStartTimeMs;
|
|
|
|
|
WebRtc_UWord16 _receivedBW[BW_HISTORY_SIZE];
|
|
|
|
|
WebRtc_UWord16 _estimatedBW;
|
|
|
|
|
|
|
|
|
|
// FEC
|
2011-10-13 15:19:55 +00:00
|
|
|
bool _currentFecFrameDecoded;
|
|
|
|
|
ReceiverFEC* _receiveFEC;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
// BWE
|
2011-10-13 15:19:55 +00:00
|
|
|
OverUseDetector _overUseDetector;
|
|
|
|
|
BitRateStats _videoBitRate;
|
2011-07-07 08:21:25 +00:00
|
|
|
WebRtc_Word64 _lastBitRateChange;
|
|
|
|
|
WebRtc_UWord16 _packetOverHead;
|
|
|
|
|
};
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_VIDEO_H_
|