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_
|
|
|
|
|
|
2013-02-05 15:12:39 +00:00
|
|
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/bitrate.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
|
|
|
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
|
|
|
|
#include "webrtc/typedefs.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2012-01-19 15:53:59 +00:00
|
|
|
class CriticalSectionWrapper;
|
2012-12-14 09:57:37 +00:00
|
|
|
class ModuleRtpRtcpImpl;
|
|
|
|
|
class ReceiverFEC;
|
2013-07-16 19:25:04 +00:00
|
|
|
class RTPReceiver;
|
|
|
|
|
class RTPPayloadRegistry;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-12-18 15:40:53 +00:00
|
|
|
class RTPReceiverVideo : public RTPReceiverStrategy {
|
2012-04-27 05:25:53 +00:00
|
|
|
public:
|
2013-07-16 19:25:04 +00:00
|
|
|
RTPReceiverVideo(const int32_t id,
|
|
|
|
|
const RTPPayloadRegistry* rtp_payload_registry,
|
|
|
|
|
RtpData* data_callback);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-04-27 05:25:53 +00:00
|
|
|
virtual ~RTPReceiverVideo();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-07-31 15:17:19 +00:00
|
|
|
virtual int32_t ParseRtpPacket(
|
2012-12-18 15:40:53 +00:00
|
|
|
WebRtcRTPHeader* rtp_header,
|
2013-07-16 19:25:04 +00:00
|
|
|
const ModuleRTPUtility::PayloadUnion& specific_payload,
|
|
|
|
|
const bool is_red,
|
2013-04-08 11:08:41 +00:00
|
|
|
const uint8_t* packet,
|
2013-07-16 19:25:04 +00:00
|
|
|
const uint16_t packet_length,
|
|
|
|
|
const int64_t timestamp,
|
2013-07-31 15:17:19 +00:00
|
|
|
const bool is_first_packet) OVERRIDE;
|
2012-12-18 15:40:53 +00:00
|
|
|
|
2013-07-31 15:17:19 +00:00
|
|
|
virtual int32_t GetFrequencyHz() const OVERRIDE;
|
2012-12-18 15:40:53 +00:00
|
|
|
|
2013-07-31 15:17:19 +00:00
|
|
|
virtual RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const
|
|
|
|
|
OVERRIDE;
|
2012-12-18 15:40:53 +00:00
|
|
|
|
2013-07-31 15:17:19 +00:00
|
|
|
virtual bool ShouldReportCsrcChanges(uint8_t payload_type) const OVERRIDE;
|
2013-01-22 12:31:01 +00:00
|
|
|
|
2013-07-31 15:17:19 +00:00
|
|
|
virtual int32_t OnNewPayloadTypeCreated(
|
2013-02-05 15:12:39 +00:00
|
|
|
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
|
2013-07-16 19:25:04 +00:00
|
|
|
const int8_t payload_type,
|
2013-07-31 15:17:19 +00:00
|
|
|
const uint32_t frequency) OVERRIDE;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-07-31 15:17:19 +00:00
|
|
|
virtual int32_t InvokeOnInitializeDecoder(
|
2012-12-18 15:40:53 +00:00
|
|
|
RtpFeedback* callback,
|
2013-07-16 19:25:04 +00:00
|
|
|
const int32_t id,
|
|
|
|
|
const int8_t payload_type,
|
2013-02-05 15:12:39 +00:00
|
|
|
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
|
2013-07-31 15:17:19 +00:00
|
|
|
const ModuleRTPUtility::PayloadUnion& specific_payload) const OVERRIDE;
|
2013-07-16 19:25:04 +00:00
|
|
|
|
|
|
|
|
virtual int32_t ReceiveRecoveredPacketCallback(
|
|
|
|
|
WebRtcRTPHeader* rtp_header,
|
|
|
|
|
const uint8_t* payload_data,
|
|
|
|
|
const uint16_t payload_data_length);
|
2011-10-13 15:19:55 +00:00
|
|
|
|
2013-04-08 11:08:41 +00:00
|
|
|
void SetPacketOverHead(uint16_t packet_over_head);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-04-27 05:25:53 +00:00
|
|
|
protected:
|
2013-07-16 19:25:04 +00:00
|
|
|
int32_t SetCodecType(const RtpVideoCodecTypes video_type,
|
|
|
|
|
WebRtcRTPHeader* rtp_header) const;
|
|
|
|
|
|
2013-04-08 11:08:41 +00:00
|
|
|
int32_t ParseVideoCodecSpecificSwitch(
|
2013-02-05 15:12:39 +00:00
|
|
|
WebRtcRTPHeader* rtp_header,
|
2013-04-08 11:08:41 +00:00
|
|
|
const uint8_t* payload_data,
|
2013-07-16 19:25:04 +00:00
|
|
|
const uint16_t payload_data_length,
|
|
|
|
|
const RtpVideoCodecTypes video_type,
|
|
|
|
|
const bool is_first_packet);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-04-08 11:08:41 +00:00
|
|
|
int32_t ReceiveGenericCodec(WebRtcRTPHeader* rtp_header,
|
|
|
|
|
const uint8_t* payload_data,
|
2013-07-16 19:25:04 +00:00
|
|
|
const uint16_t payload_data_length);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-04-08 11:08:41 +00:00
|
|
|
int32_t ReceiveVp8Codec(WebRtcRTPHeader* rtp_header,
|
|
|
|
|
const uint8_t* payload_data,
|
2013-07-16 19:25:04 +00:00
|
|
|
const uint16_t payload_data_length);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-04-08 11:08:41 +00:00
|
|
|
int32_t BuildRTPheader(const WebRtcRTPHeader* rtp_header,
|
|
|
|
|
uint8_t* data_buffer) const;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-04-27 05:25:53 +00:00
|
|
|
private:
|
2013-04-08 11:08:41 +00:00
|
|
|
int32_t ParseVideoCodecSpecific(
|
2013-02-05 15:12:39 +00:00
|
|
|
WebRtcRTPHeader* rtp_header,
|
2013-04-08 11:08:41 +00:00
|
|
|
const uint8_t* payload_data,
|
2013-07-16 19:25:04 +00:00
|
|
|
const uint16_t payload_data_length,
|
|
|
|
|
const RtpVideoCodecTypes video_type,
|
|
|
|
|
const bool is_red,
|
2013-04-08 11:08:41 +00:00
|
|
|
const uint8_t* incoming_rtp_packet,
|
2013-07-16 19:25:04 +00:00
|
|
|
const uint16_t incoming_rtp_packet_size,
|
|
|
|
|
const int64_t now_ms,
|
|
|
|
|
const bool is_first_packet);
|
2012-12-18 15:40:53 +00:00
|
|
|
|
2013-04-08 11:08:41 +00:00
|
|
|
int32_t id_;
|
2013-07-16 19:25:04 +00:00
|
|
|
const RTPPayloadRegistry* rtp_rtp_payload_registry_;
|
|
|
|
|
|
|
|
|
|
CriticalSectionWrapper* critical_section_receiver_video_;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-04-27 05:25:53 +00:00
|
|
|
// FEC
|
2013-07-16 19:25:04 +00:00
|
|
|
bool current_fec_frame_decoded_;
|
2013-02-05 15:12:39 +00:00
|
|
|
ReceiverFEC* receive_fec_;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
2013-02-05 15:12:39 +00:00
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_VIDEO_H_
|