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 #include <memory> | 15 #include <memory> |
16 #include <vector> | |
16 | 17 |
17 #include "webrtc/base/criticalsection.h" | 18 #include "webrtc/base/criticalsection.h" |
18 #include "webrtc/base/onetimeevent.h" | 19 #include "webrtc/base/onetimeevent.h" |
19 #include "webrtc/base/rate_statistics.h" | 20 #include "webrtc/base/rate_statistics.h" |
20 #include "webrtc/base/sequenced_task_checker.h" | 21 #include "webrtc/base/sequenced_task_checker.h" |
21 #include "webrtc/base/thread_annotations.h" | 22 #include "webrtc/base/thread_annotations.h" |
22 #include "webrtc/common_types.h" | 23 #include "webrtc/common_types.h" |
24 #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h" | |
23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
24 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" | |
25 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" | 26 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
26 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" |
27 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
28 #include "webrtc/modules/rtp_rtcp/source/ulpfec_generator.h" | 29 #include "webrtc/modules/rtp_rtcp/source/ulpfec_generator.h" |
29 #include "webrtc/modules/rtp_rtcp/source/video_codec_information.h" | 30 #include "webrtc/modules/rtp_rtcp/source/video_codec_information.h" |
30 #include "webrtc/typedefs.h" | 31 #include "webrtc/typedefs.h" |
31 | 32 |
32 namespace webrtc { | 33 namespace webrtc { |
33 class RtpPacketToSend; | 34 class RtpPacketToSend; |
34 | 35 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 uint32_t VideoBitrateSent() const; | 70 uint32_t VideoBitrateSent() const; |
70 uint32_t FecOverheadRate() const; | 71 uint32_t FecOverheadRate() const; |
71 | 72 |
72 int SelectiveRetransmissions() const; | 73 int SelectiveRetransmissions() const; |
73 void SetSelectiveRetransmissions(uint8_t settings); | 74 void SetSelectiveRetransmissions(uint8_t settings); |
74 | 75 |
75 private: | 76 private: |
76 void SendVideoPacket(std::unique_ptr<RtpPacketToSend> packet, | 77 void SendVideoPacket(std::unique_ptr<RtpPacketToSend> packet, |
77 StorageType storage); | 78 StorageType storage); |
78 | 79 |
79 void SendVideoPacketAsRed(std::unique_ptr<RtpPacketToSend> media_packet, | 80 void SendVideoPacketAsRedMaybeWithUlpfec( |
80 StorageType media_packet_storage, | 81 std::unique_ptr<RtpPacketToSend> media_packet, |
81 bool protect); | 82 StorageType media_packet_storage, |
83 bool protect_media_packet); | |
danilchap
2016/11/09 11:19:07
the name of this variable become longer each patch
brandtr
2016/11/09 15:16:25
Not anymore! :)
| |
84 | |
85 // TODO(brandtr): Remove the FlexFEC functions when FlexfecSender has been | |
86 // moved to PacedSender. | |
87 void SendVideoPacketWithFlexfec(std::unique_ptr<RtpPacketToSend> media_packet, | |
88 StorageType media_packet_storage, | |
89 bool protect_media_packet); | |
82 | 90 |
83 bool red_enabled() const EXCLUSIVE_LOCKS_REQUIRED(crit_) { | 91 bool red_enabled() const EXCLUSIVE_LOCKS_REQUIRED(crit_) { |
84 return red_payload_type_ >= 0; | 92 return red_payload_type_ >= 0; |
85 } | 93 } |
86 | 94 |
87 bool ulpfec_enabled() const EXCLUSIVE_LOCKS_REQUIRED(crit_) { | 95 bool ulpfec_enabled() const EXCLUSIVE_LOCKS_REQUIRED(crit_) { |
88 return ulpfec_payload_type_ >= 0; | 96 return ulpfec_payload_type_ >= 0; |
89 } | 97 } |
90 | 98 |
99 bool flexfec_enabled() const { return flexfec_sender_ != nullptr; } | |
100 | |
91 RTPSender* const rtp_sender_; | 101 RTPSender* const rtp_sender_; |
92 Clock* const clock_; | 102 Clock* const clock_; |
93 | 103 |
94 // Should never be held when calling out of this class. | 104 // Should never be held when calling out of this class. |
95 rtc::CriticalSection crit_; | 105 rtc::CriticalSection crit_; |
96 rtc::SequencedTaskChecker encoder_checker_; | 106 rtc::SequencedTaskChecker encoder_checker_; |
97 | 107 |
98 RtpVideoCodecTypes video_type_; | 108 RtpVideoCodecTypes video_type_; |
99 int32_t retransmission_settings_ GUARDED_BY(crit_); | 109 int32_t retransmission_settings_ GUARDED_BY(crit_); |
100 VideoRotation last_rotation_ GUARDED_BY(encoder_checker_); | 110 VideoRotation last_rotation_ GUARDED_BY(encoder_checker_); |
101 | 111 |
102 // RED/ULPFEC. | 112 // RED/ULPFEC. |
103 int red_payload_type_ GUARDED_BY(crit_); | 113 int red_payload_type_ GUARDED_BY(crit_); |
104 int ulpfec_payload_type_ GUARDED_BY(crit_); | 114 int ulpfec_payload_type_ GUARDED_BY(crit_); |
115 UlpfecGenerator ulpfec_generator_ GUARDED_BY(crit_); | |
116 | |
117 // FlexFEC. | |
118 FlexfecSender* const flexfec_sender_; | |
119 | |
120 // FEC parameters, applicable to either ULPFEC or FlexFEC. | |
105 FecProtectionParams delta_fec_params_ GUARDED_BY(crit_); | 121 FecProtectionParams delta_fec_params_ GUARDED_BY(crit_); |
106 FecProtectionParams key_fec_params_ GUARDED_BY(crit_); | 122 FecProtectionParams key_fec_params_ GUARDED_BY(crit_); |
107 UlpfecGenerator ulpfec_generator_ GUARDED_BY(crit_); | |
108 | 123 |
109 rtc::CriticalSection stats_crit_; | 124 rtc::CriticalSection stats_crit_; |
110 // Bitrate used for FEC payload, RED headers, RTP headers for FEC packets | 125 // Bitrate used for FEC payload, RED headers, RTP headers for FEC packets |
111 // and any padding overhead. | 126 // and any padding overhead. |
112 RateStatistics fec_bitrate_ GUARDED_BY(stats_crit_); | 127 RateStatistics fec_bitrate_ GUARDED_BY(stats_crit_); |
113 // Bitrate used for video payload and RTP headers. | 128 // Bitrate used for video payload and RTP headers. |
114 RateStatistics video_bitrate_ GUARDED_BY(stats_crit_); | 129 RateStatistics video_bitrate_ GUARDED_BY(stats_crit_); |
115 OneTimeEvent first_frame_sent_; | 130 OneTimeEvent first_frame_sent_; |
116 }; | 131 }; |
117 | 132 |
118 } // namespace webrtc | 133 } // namespace webrtc |
119 | 134 |
120 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ | 135 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ |
OLD | NEW |