2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-02-09 13:14:04 +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_SENDER_VIDEO_H_
|
|
|
|
|
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_
|
|
|
|
|
|
2012-01-20 06:59:06 +00:00
|
|
|
#include <list>
|
|
|
|
|
|
2016-04-14 03:05:31 -07:00
|
|
|
#include "webrtc/base/criticalsection.h"
|
2016-04-07 15:36:45 -07:00
|
|
|
#include "webrtc/base/onetimeevent.h"
|
2015-04-14 21:28:08 +02:00
|
|
|
#include "webrtc/base/thread_annotations.h"
|
2013-05-29 14:27:38 +00:00
|
|
|
#include "webrtc/common_types.h"
|
2015-11-04 08:31:52 +01:00
|
|
|
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
2013-05-29 14:27:38 +00:00
|
|
|
#include "webrtc/modules/rtp_rtcp/source/bitrate.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/producer_fec.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/rtp_sender.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/video_codec_information.h"
|
|
|
|
|
#include "webrtc/typedefs.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2012-01-20 06:59:06 +00:00
|
|
|
|
2014-09-12 11:05:55 +00:00
|
|
|
class RTPSenderVideo {
|
|
|
|
|
public:
|
|
|
|
|
RTPSenderVideo(Clock* clock, RTPSenderInterface* rtpSender);
|
|
|
|
|
virtual ~RTPSenderVideo();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2014-09-12 11:05:55 +00:00
|
|
|
virtual RtpVideoCodecTypes VideoCodecType() const;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
size_t FECPacketOverhead() const;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-04-14 21:28:08 +02:00
|
|
|
static RtpUtility::Payload* CreateVideoPayload(
|
|
|
|
|
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
2016-02-16 17:59:27 +01:00
|
|
|
const int8_t payloadType);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2014-09-12 11:05:55 +00:00
|
|
|
int32_t SendVideo(const RtpVideoCodecTypes videoType,
|
|
|
|
|
const FrameType frameType,
|
2013-04-08 11:08:41 +00:00
|
|
|
const int8_t payloadType,
|
|
|
|
|
const uint32_t captureTimeStamp,
|
|
|
|
|
int64_t capture_time_ms,
|
|
|
|
|
const uint8_t* payloadData,
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
const size_t payloadSize,
|
2013-04-08 11:08:41 +00:00
|
|
|
const RTPFragmentationHeader* fragmentation,
|
2016-02-08 15:00:16 +01:00
|
|
|
const RTPVideoHeader* video_header);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2014-09-12 11:05:55 +00:00
|
|
|
int32_t SendRTPIntraRequest();
|
|
|
|
|
|
|
|
|
|
void SetVideoCodecType(RtpVideoCodecTypes type);
|
|
|
|
|
|
|
|
|
|
// FEC
|
2015-04-14 21:28:08 +02:00
|
|
|
void SetGenericFECStatus(const bool enable,
|
|
|
|
|
const uint8_t payloadTypeRED,
|
|
|
|
|
const uint8_t payloadTypeFEC);
|
2014-09-12 11:05:55 +00:00
|
|
|
|
2015-12-15 02:54:47 -08:00
|
|
|
void GenericFECStatus(bool* enable,
|
|
|
|
|
uint8_t* payloadTypeRED,
|
|
|
|
|
uint8_t* payloadTypeFEC) const;
|
2014-09-12 11:05:55 +00:00
|
|
|
|
2015-04-14 21:28:08 +02:00
|
|
|
void SetFecParameters(const FecProtectionParams* delta_params,
|
|
|
|
|
const FecProtectionParams* key_params);
|
2014-09-12 11:05:55 +00:00
|
|
|
|
|
|
|
|
void ProcessBitrate();
|
|
|
|
|
|
|
|
|
|
uint32_t VideoBitrateSent() const;
|
|
|
|
|
uint32_t FecOverheadRate() const;
|
|
|
|
|
|
|
|
|
|
int SelectiveRetransmissions() const;
|
2015-04-14 21:28:08 +02:00
|
|
|
void SetSelectiveRetransmissions(uint8_t settings);
|
|
|
|
|
|
2015-12-10 02:39:40 -08:00
|
|
|
private:
|
2015-04-14 21:28:08 +02:00
|
|
|
void SendVideoPacket(uint8_t* dataBuffer,
|
|
|
|
|
const size_t payloadLength,
|
|
|
|
|
const size_t rtpHeaderLength,
|
|
|
|
|
uint16_t seq_num,
|
|
|
|
|
const uint32_t capture_timestamp,
|
|
|
|
|
int64_t capture_time_ms,
|
|
|
|
|
StorageType storage);
|
|
|
|
|
|
|
|
|
|
void SendVideoPacketAsRed(uint8_t* dataBuffer,
|
|
|
|
|
const size_t payloadLength,
|
|
|
|
|
const size_t rtpHeaderLength,
|
|
|
|
|
uint16_t video_seq_num,
|
|
|
|
|
const uint32_t capture_timestamp,
|
|
|
|
|
int64_t capture_time_ms,
|
|
|
|
|
StorageType media_packet_storage,
|
|
|
|
|
bool protect);
|
|
|
|
|
|
2014-09-12 11:05:55 +00:00
|
|
|
RTPSenderInterface& _rtpSender;
|
|
|
|
|
|
2015-04-14 21:28:08 +02:00
|
|
|
// Should never be held when calling out of this class.
|
2016-04-14 03:05:31 -07:00
|
|
|
const rtc::CriticalSection crit_;
|
2015-04-14 21:28:08 +02:00
|
|
|
|
2014-09-12 11:05:55 +00:00
|
|
|
RtpVideoCodecTypes _videoType;
|
2015-04-14 21:28:08 +02:00
|
|
|
int32_t _retransmissionSettings GUARDED_BY(crit_);
|
2014-09-12 11:05:55 +00:00
|
|
|
|
|
|
|
|
// FEC
|
2015-12-08 09:10:43 +01:00
|
|
|
ForwardErrorCorrection fec_;
|
|
|
|
|
bool fec_enabled_ GUARDED_BY(crit_);
|
|
|
|
|
int8_t red_payload_type_ GUARDED_BY(crit_);
|
|
|
|
|
int8_t fec_payload_type_ GUARDED_BY(crit_);
|
2015-04-14 21:28:08 +02:00
|
|
|
FecProtectionParams delta_fec_params_ GUARDED_BY(crit_);
|
|
|
|
|
FecProtectionParams key_fec_params_ GUARDED_BY(crit_);
|
|
|
|
|
ProducerFec producer_fec_ GUARDED_BY(crit_);
|
2014-09-12 11:05:55 +00:00
|
|
|
|
|
|
|
|
// Bitrate used for FEC payload, RED headers, RTP headers for FEC packets
|
|
|
|
|
// and any padding overhead.
|
|
|
|
|
Bitrate _fecOverheadRate;
|
|
|
|
|
// Bitrate used for video payload and RTP headers
|
|
|
|
|
Bitrate _videoBitrate;
|
2016-04-07 15:36:45 -07:00
|
|
|
OneTimeEvent first_frame_sent_;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
2013-07-03 15:12:26 +00:00
|
|
|
} // namespace webrtc
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2014-09-12 11:05:55 +00:00
|
|
|
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_
|