Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 SendVideoPacketAsRed(std::unique_ptr<RtpPacketToSend> media_packet, |
| 80 StorageType media_packet_storage, | 81 StorageType media_packet_storage, |
| 81 bool protect); | 82 bool protect_packet); |
| 82 | 83 |
| 83 bool red_enabled() const EXCLUSIVE_LOCKS_REQUIRED(crit_) { | 84 bool red_enabled() const EXCLUSIVE_LOCKS_REQUIRED(crit_) { |
| 84 return red_payload_type_ >= 0; | 85 return red_payload_type_ >= 0; |
| 85 } | 86 } |
| 86 | 87 |
| 87 bool ulpfec_enabled() const EXCLUSIVE_LOCKS_REQUIRED(crit_) { | 88 bool ulpfec_enabled() const EXCLUSIVE_LOCKS_REQUIRED(crit_) { |
| 88 return ulpfec_payload_type_ >= 0; | 89 return ulpfec_payload_type_ >= 0; |
| 89 } | 90 } |
| 90 | 91 |
| 92 // TODO(brandtr): Remove these when FlexfecSender has been moved to | |
| 93 // PacedSender. | |
| 94 bool flexfec_enabled() const { return flexfec_sender_ != nullptr; } | |
| 95 std::vector<std::unique_ptr<RtpPacketToSend>> GetFlexfecPackets( | |
|
danilchap
2016/11/08 11:45:08
this function do more than get fec packets.
May be
brandtr
2016/11/09 10:40:00
I merged it into one function, because then the co
| |
| 96 const RtpPacketToSend& media_packet); | |
| 97 void SendFlexfecPackets( | |
| 98 std::vector<std::unique_ptr<RtpPacketToSend>>* fec_packets); | |
| 99 | |
| 91 RTPSender* const rtp_sender_; | 100 RTPSender* const rtp_sender_; |
| 92 Clock* const clock_; | 101 Clock* const clock_; |
| 93 | 102 |
| 94 // Should never be held when calling out of this class. | 103 // Should never be held when calling out of this class. |
| 95 rtc::CriticalSection crit_; | 104 rtc::CriticalSection crit_; |
| 96 rtc::SequencedTaskChecker encoder_checker_; | 105 rtc::SequencedTaskChecker encoder_checker_; |
| 97 | 106 |
| 98 RtpVideoCodecTypes video_type_; | 107 RtpVideoCodecTypes video_type_; |
| 99 int32_t retransmission_settings_ GUARDED_BY(crit_); | 108 int32_t retransmission_settings_ GUARDED_BY(crit_); |
| 100 VideoRotation last_rotation_ GUARDED_BY(encoder_checker_); | 109 VideoRotation last_rotation_ GUARDED_BY(encoder_checker_); |
| 101 | 110 |
| 102 // RED/ULPFEC. | 111 // RED/ULPFEC. |
| 103 int red_payload_type_ GUARDED_BY(crit_); | 112 int red_payload_type_ GUARDED_BY(crit_); |
| 104 int ulpfec_payload_type_ GUARDED_BY(crit_); | 113 int ulpfec_payload_type_ GUARDED_BY(crit_); |
| 114 UlpfecGenerator ulpfec_generator_ GUARDED_BY(crit_); | |
| 115 | |
| 116 // FlexFEC. | |
| 117 FlexfecSender* const flexfec_sender_; | |
| 118 | |
| 119 // FEC parameters, applicable to either ULPFEC or FlexFEC. | |
| 105 FecProtectionParams delta_fec_params_ GUARDED_BY(crit_); | 120 FecProtectionParams delta_fec_params_ GUARDED_BY(crit_); |
| 106 FecProtectionParams key_fec_params_ GUARDED_BY(crit_); | 121 FecProtectionParams key_fec_params_ GUARDED_BY(crit_); |
| 107 UlpfecGenerator ulpfec_generator_ GUARDED_BY(crit_); | |
| 108 | 122 |
| 109 rtc::CriticalSection stats_crit_; | 123 rtc::CriticalSection stats_crit_; |
| 110 // Bitrate used for FEC payload, RED headers, RTP headers for FEC packets | 124 // Bitrate used for FEC payload, RED headers, RTP headers for FEC packets |
| 111 // and any padding overhead. | 125 // and any padding overhead. |
| 112 RateStatistics fec_bitrate_ GUARDED_BY(stats_crit_); | 126 RateStatistics fec_bitrate_ GUARDED_BY(stats_crit_); |
| 113 // Bitrate used for video payload and RTP headers. | 127 // Bitrate used for video payload and RTP headers. |
| 114 RateStatistics video_bitrate_ GUARDED_BY(stats_crit_); | 128 RateStatistics video_bitrate_ GUARDED_BY(stats_crit_); |
| 115 OneTimeEvent first_frame_sent_; | 129 OneTimeEvent first_frame_sent_; |
| 116 }; | 130 }; |
| 117 | 131 |
| 118 } // namespace webrtc | 132 } // namespace webrtc |
| 119 | 133 |
| 120 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ | 134 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ |
| OLD | NEW |