| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ |
| 13 | 13 |
| 14 #include <list> | 14 #include <list> |
| 15 | 15 |
| 16 #include "webrtc/base/criticalsection.h" | 16 #include "webrtc/base/criticalsection.h" |
| 17 #include "webrtc/base/onetimeevent.h" | 17 #include "webrtc/base/onetimeevent.h" |
| 18 #include "webrtc/base/rate_statistics.h" |
| 18 #include "webrtc/base/thread_annotations.h" | 19 #include "webrtc/base/thread_annotations.h" |
| 19 #include "webrtc/common_types.h" | 20 #include "webrtc/common_types.h" |
| 20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 21 #include "webrtc/modules/rtp_rtcp/source/bitrate.h" | |
| 22 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" | 22 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" |
| 23 #include "webrtc/modules/rtp_rtcp/source/producer_fec.h" | 23 #include "webrtc/modules/rtp_rtcp/source/producer_fec.h" |
| 24 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" | 24 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
| 25 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" |
| 26 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 26 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 27 #include "webrtc/modules/rtp_rtcp/source/video_codec_information.h" | 27 #include "webrtc/modules/rtp_rtcp/source/video_codec_information.h" |
| 28 #include "webrtc/typedefs.h" | 28 #include "webrtc/typedefs.h" |
| 29 | 29 |
| 30 namespace webrtc { | 30 namespace webrtc { |
| 31 | 31 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 61 const uint8_t payloadTypeRED, | 61 const uint8_t payloadTypeRED, |
| 62 const uint8_t payloadTypeFEC); | 62 const uint8_t payloadTypeFEC); |
| 63 | 63 |
| 64 void GenericFECStatus(bool* enable, | 64 void GenericFECStatus(bool* enable, |
| 65 uint8_t* payloadTypeRED, | 65 uint8_t* payloadTypeRED, |
| 66 uint8_t* payloadTypeFEC) const; | 66 uint8_t* payloadTypeFEC) const; |
| 67 | 67 |
| 68 void SetFecParameters(const FecProtectionParams* delta_params, | 68 void SetFecParameters(const FecProtectionParams* delta_params, |
| 69 const FecProtectionParams* key_params); | 69 const FecProtectionParams* key_params); |
| 70 | 70 |
| 71 void ProcessBitrate(); | |
| 72 | |
| 73 uint32_t VideoBitrateSent() const; | 71 uint32_t VideoBitrateSent() const; |
| 74 uint32_t FecOverheadRate() const; | 72 uint32_t FecOverheadRate() const; |
| 75 | 73 |
| 76 int SelectiveRetransmissions() const; | 74 int SelectiveRetransmissions() const; |
| 77 void SetSelectiveRetransmissions(uint8_t settings); | 75 void SetSelectiveRetransmissions(uint8_t settings); |
| 78 | 76 |
| 79 private: | 77 private: |
| 80 void SendVideoPacket(uint8_t* dataBuffer, | 78 void SendVideoPacket(uint8_t* dataBuffer, |
| 81 const size_t payloadLength, | 79 const size_t payloadLength, |
| 82 const size_t rtpHeaderLength, | 80 const size_t rtpHeaderLength, |
| 83 uint16_t seq_num, | 81 uint16_t seq_num, |
| 84 const uint32_t capture_timestamp, | 82 const uint32_t capture_timestamp, |
| 85 int64_t capture_time_ms, | 83 int64_t capture_time_ms, |
| 86 StorageType storage); | 84 StorageType storage); |
| 87 | 85 |
| 88 void SendVideoPacketAsRed(uint8_t* dataBuffer, | 86 void SendVideoPacketAsRed(uint8_t* dataBuffer, |
| 89 const size_t payloadLength, | 87 const size_t payloadLength, |
| 90 const size_t rtpHeaderLength, | 88 const size_t rtpHeaderLength, |
| 91 uint16_t video_seq_num, | 89 uint16_t video_seq_num, |
| 92 const uint32_t capture_timestamp, | 90 const uint32_t capture_timestamp, |
| 93 int64_t capture_time_ms, | 91 int64_t capture_time_ms, |
| 94 StorageType media_packet_storage, | 92 StorageType media_packet_storage, |
| 95 bool protect); | 93 bool protect); |
| 96 | 94 |
| 97 RTPSenderInterface& _rtpSender; | 95 RTPSenderInterface& _rtpSender; |
| 96 Clock* const clock_; |
| 98 | 97 |
| 99 // Should never be held when calling out of this class. | 98 // Should never be held when calling out of this class. |
| 100 const rtc::CriticalSection crit_; | 99 rtc::CriticalSection crit_; |
| 101 | 100 |
| 102 RtpVideoCodecTypes _videoType; | 101 RtpVideoCodecTypes _videoType; |
| 103 int32_t _retransmissionSettings GUARDED_BY(crit_); | 102 int32_t _retransmissionSettings GUARDED_BY(crit_); |
| 104 | 103 |
| 105 // FEC | 104 // FEC |
| 106 ForwardErrorCorrection fec_; | 105 ForwardErrorCorrection fec_; |
| 107 bool fec_enabled_ GUARDED_BY(crit_); | 106 bool fec_enabled_ GUARDED_BY(crit_); |
| 108 int8_t red_payload_type_ GUARDED_BY(crit_); | 107 int8_t red_payload_type_ GUARDED_BY(crit_); |
| 109 int8_t fec_payload_type_ GUARDED_BY(crit_); | 108 int8_t fec_payload_type_ GUARDED_BY(crit_); |
| 110 FecProtectionParams delta_fec_params_ GUARDED_BY(crit_); | 109 FecProtectionParams delta_fec_params_ GUARDED_BY(crit_); |
| 111 FecProtectionParams key_fec_params_ GUARDED_BY(crit_); | 110 FecProtectionParams key_fec_params_ GUARDED_BY(crit_); |
| 112 ProducerFec producer_fec_ GUARDED_BY(crit_); | 111 ProducerFec producer_fec_ GUARDED_BY(crit_); |
| 113 | 112 |
| 113 rtc::CriticalSection stats_crit_; |
| 114 // Bitrate used for FEC payload, RED headers, RTP headers for FEC packets | 114 // Bitrate used for FEC payload, RED headers, RTP headers for FEC packets |
| 115 // and any padding overhead. | 115 // and any padding overhead. |
| 116 Bitrate _fecOverheadRate; | 116 RateStatistics fec_bitrate_ GUARDED_BY(stats_crit_); |
| 117 // Bitrate used for video payload and RTP headers | 117 // Bitrate used for video payload and RTP headers. |
| 118 Bitrate _videoBitrate; | 118 RateStatistics video_bitrate_ GUARDED_BY(stats_crit_); |
| 119 OneTimeEvent first_frame_sent_; | 119 OneTimeEvent first_frame_sent_; |
| 120 }; | 120 }; |
| 121 } // namespace webrtc | 121 } // namespace webrtc |
| 122 | 122 |
| 123 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ | 123 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ |
| OLD | NEW |