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 |
(...skipping 13 matching lines...) Expand all Loading... |
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 |
32 class RTPSenderVideo { | 32 class RTPSenderVideo { |
33 public: | 33 public: |
34 RTPSenderVideo(Clock* clock, RTPSenderInterface* rtpSender); | 34 RTPSenderVideo(Clock* clock, RTPSenderInterface* rtp_sender); |
35 virtual ~RTPSenderVideo(); | 35 virtual ~RTPSenderVideo(); |
36 | 36 |
37 virtual RtpVideoCodecTypes VideoCodecType() const; | 37 virtual RtpVideoCodecTypes VideoCodecType() const; |
38 | 38 |
39 size_t FECPacketOverhead() const; | 39 size_t FECPacketOverhead() const; |
40 | 40 |
41 static RtpUtility::Payload* CreateVideoPayload( | 41 static RtpUtility::Payload* CreateVideoPayload( |
42 const char payloadName[RTP_PAYLOAD_NAME_SIZE], | 42 const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
43 const int8_t payloadType); | 43 int8_t payload_type); |
44 | 44 |
45 int32_t SendVideo(const RtpVideoCodecTypes videoType, | 45 int32_t SendVideo(RtpVideoCodecTypes video_type, |
46 const FrameType frameType, | 46 FrameType frame_type, |
47 const int8_t payloadType, | 47 int8_t payload_type, |
48 const uint32_t captureTimeStamp, | 48 uint32_t capture_timestamp, |
49 int64_t capture_time_ms, | 49 int64_t capture_time_ms, |
50 const uint8_t* payloadData, | 50 const uint8_t* payload_data, |
51 const size_t payloadSize, | 51 size_t payload_size, |
52 const RTPFragmentationHeader* fragmentation, | 52 const RTPFragmentationHeader* fragmentation, |
53 const RTPVideoHeader* video_header); | 53 const RTPVideoHeader* video_header); |
54 | 54 |
55 int32_t SendRTPIntraRequest(); | 55 int32_t SendRTPIntraRequest(); |
56 | 56 |
57 void SetVideoCodecType(RtpVideoCodecTypes type); | 57 void SetVideoCodecType(RtpVideoCodecTypes type); |
58 | 58 |
59 // FEC | 59 // FEC |
60 void SetGenericFECStatus(const bool enable, | 60 void SetGenericFECStatus(bool enable, |
61 const uint8_t payloadTypeRED, | 61 uint8_t payload_type_red, |
62 const uint8_t payloadTypeFEC); | 62 uint8_t payload_type_fec); |
63 | 63 |
64 void GenericFECStatus(bool* enable, | 64 void GenericFECStatus(bool* enable, |
65 uint8_t* payloadTypeRED, | 65 uint8_t* payload_type_red, |
66 uint8_t* payloadTypeFEC) const; | 66 uint8_t* payload_type_fec) 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 uint32_t VideoBitrateSent() const; | 71 uint32_t VideoBitrateSent() const; |
72 uint32_t FecOverheadRate() const; | 72 uint32_t FecOverheadRate() const; |
73 | 73 |
74 int SelectiveRetransmissions() const; | 74 int SelectiveRetransmissions() const; |
75 void SetSelectiveRetransmissions(uint8_t settings); | 75 void SetSelectiveRetransmissions(uint8_t settings); |
76 | 76 |
77 private: | 77 private: |
78 void SendVideoPacket(uint8_t* dataBuffer, | 78 void SendVideoPacket(uint8_t* data_buffer, |
79 const size_t payloadLength, | 79 size_t payload_length, |
80 const size_t rtpHeaderLength, | 80 size_t rtp_header_length, |
81 uint16_t seq_num, | 81 uint16_t seq_num, |
82 const uint32_t capture_timestamp, | 82 uint32_t capture_timestamp, |
83 int64_t capture_time_ms, | 83 int64_t capture_time_ms, |
84 StorageType storage); | 84 StorageType storage); |
85 | 85 |
86 void SendVideoPacketAsRed(uint8_t* dataBuffer, | 86 void SendVideoPacketAsRed(uint8_t* data_buffer, |
87 const size_t payloadLength, | 87 size_t payload_length, |
88 const size_t rtpHeaderLength, | 88 size_t rtp_header_length, |
89 uint16_t video_seq_num, | 89 uint16_t video_seq_num, |
90 const uint32_t capture_timestamp, | 90 uint32_t capture_timestamp, |
91 int64_t capture_time_ms, | 91 int64_t capture_time_ms, |
92 StorageType media_packet_storage, | 92 StorageType media_packet_storage, |
93 bool protect); | 93 bool protect); |
94 | 94 |
95 RTPSenderInterface& _rtpSender; | 95 RTPSenderInterface* const rtp_sender_; |
96 Clock* const clock_; | 96 Clock* const clock_; |
97 | 97 |
98 // Should never be held when calling out of this class. | 98 // Should never be held when calling out of this class. |
99 rtc::CriticalSection crit_; | 99 rtc::CriticalSection crit_; |
100 | 100 |
101 RtpVideoCodecTypes _videoType; | 101 RtpVideoCodecTypes video_type_ = kRtpVideoGeneric; |
102 int32_t _retransmissionSettings GUARDED_BY(crit_); | 102 int32_t retransmission_settings_ GUARDED_BY(crit_) = kRetransmitBaseLayer; |
103 | 103 |
104 // FEC | 104 // FEC |
105 ForwardErrorCorrection fec_; | 105 ForwardErrorCorrection fec_; |
106 bool fec_enabled_ GUARDED_BY(crit_); | 106 bool fec_enabled_ GUARDED_BY(crit_) = false; |
107 int8_t red_payload_type_ GUARDED_BY(crit_); | 107 int8_t red_payload_type_ GUARDED_BY(crit_) = 0; |
108 int8_t fec_payload_type_ GUARDED_BY(crit_); | 108 int8_t fec_payload_type_ GUARDED_BY(crit_) = 0; |
109 FecProtectionParams delta_fec_params_ GUARDED_BY(crit_); | 109 FecProtectionParams delta_fec_params_ GUARDED_BY(crit_) = FecProtectionParams{ |
110 FecProtectionParams key_fec_params_ GUARDED_BY(crit_); | 110 0, 1, kFecMaskRandom}; |
| 111 FecProtectionParams key_fec_params_ GUARDED_BY(crit_) = FecProtectionParams{ |
| 112 0, 1, kFecMaskRandom}; |
111 ProducerFec producer_fec_ GUARDED_BY(crit_); | 113 ProducerFec producer_fec_ GUARDED_BY(crit_); |
112 | 114 |
113 rtc::CriticalSection stats_crit_; | 115 rtc::CriticalSection stats_crit_; |
114 // Bitrate used for FEC payload, RED headers, RTP headers for FEC packets | 116 // Bitrate used for FEC payload, RED headers, RTP headers for FEC packets |
115 // and any padding overhead. | 117 // and any padding overhead. |
116 RateStatistics fec_bitrate_ GUARDED_BY(stats_crit_); | 118 RateStatistics fec_bitrate_ GUARDED_BY(stats_crit_); |
117 // Bitrate used for video payload and RTP headers. | 119 // Bitrate used for video payload and RTP headers. |
118 RateStatistics video_bitrate_ GUARDED_BY(stats_crit_); | 120 RateStatistics video_bitrate_ GUARDED_BY(stats_crit_); |
119 OneTimeEvent first_frame_sent_; | 121 OneTimeEvent first_frame_sent_; |
120 }; | 122 }; |
| 123 |
121 } // namespace webrtc | 124 } // namespace webrtc |
122 | 125 |
123 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ | 126 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_VIDEO_H_ |
OLD | NEW |