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 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h" |
12 | 12 |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 #include <string.h> | 14 #include <string.h> |
15 | 15 |
16 #include <memory> | |
17 #include <vector> | 16 #include <vector> |
18 | 17 |
19 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
20 #include "webrtc/base/logging.h" | 19 #include "webrtc/base/logging.h" |
21 #include "webrtc/base/trace_event.h" | 20 #include "webrtc/base/trace_event.h" |
22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
23 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 22 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
24 #include "webrtc/modules/rtp_rtcp/source/producer_fec.h" | 23 #include "webrtc/modules/rtp_rtcp/source/producer_fec.h" |
25 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h" | 24 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h" |
26 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 104 } |
106 | 105 |
107 void RTPSenderVideo::SendVideoPacketAsRed(uint8_t* data_buffer, | 106 void RTPSenderVideo::SendVideoPacketAsRed(uint8_t* data_buffer, |
108 const size_t payload_length, | 107 const size_t payload_length, |
109 const size_t rtp_header_length, | 108 const size_t rtp_header_length, |
110 uint16_t media_seq_num, | 109 uint16_t media_seq_num, |
111 const uint32_t capture_timestamp, | 110 const uint32_t capture_timestamp, |
112 int64_t capture_time_ms, | 111 int64_t capture_time_ms, |
113 StorageType media_packet_storage, | 112 StorageType media_packet_storage, |
114 bool protect) { | 113 bool protect) { |
115 std::unique_ptr<RedPacket> red_packet; | 114 rtc::scoped_ptr<RedPacket> red_packet; |
116 std::vector<RedPacket*> fec_packets; | 115 std::vector<RedPacket*> fec_packets; |
117 StorageType fec_storage = kDontRetransmit; | 116 StorageType fec_storage = kDontRetransmit; |
118 uint16_t next_fec_sequence_number = 0; | 117 uint16_t next_fec_sequence_number = 0; |
119 { | 118 { |
120 // Only protect while creating RED and FEC packets, not when sending. | 119 // Only protect while creating RED and FEC packets, not when sending. |
121 rtc::CritScope cs(&crit_); | 120 rtc::CritScope cs(&crit_); |
122 red_packet.reset(producer_fec_.BuildRedPacket( | 121 red_packet.reset(producer_fec_.BuildRedPacket( |
123 data_buffer, payload_length, rtp_header_length, red_payload_type_)); | 122 data_buffer, payload_length, rtp_header_length, red_payload_type_)); |
124 if (protect) { | 123 if (protect) { |
125 producer_fec_.AddRtpPacketAndGenerateFec(data_buffer, payload_length, | 124 producer_fec_.AddRtpPacketAndGenerateFec(data_buffer, payload_length, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 const uint32_t captureTimeStamp, | 217 const uint32_t captureTimeStamp, |
219 int64_t capture_time_ms, | 218 int64_t capture_time_ms, |
220 const uint8_t* payloadData, | 219 const uint8_t* payloadData, |
221 const size_t payloadSize, | 220 const size_t payloadSize, |
222 const RTPFragmentationHeader* fragmentation, | 221 const RTPFragmentationHeader* fragmentation, |
223 const RTPVideoHeader* video_header) { | 222 const RTPVideoHeader* video_header) { |
224 if (payloadSize == 0) { | 223 if (payloadSize == 0) { |
225 return -1; | 224 return -1; |
226 } | 225 } |
227 | 226 |
228 std::unique_ptr<RtpPacketizer> packetizer(RtpPacketizer::Create( | 227 rtc::scoped_ptr<RtpPacketizer> packetizer(RtpPacketizer::Create( |
229 videoType, _rtpSender.MaxDataPayloadLength(), | 228 videoType, _rtpSender.MaxDataPayloadLength(), |
230 video_header ? &(video_header->codecHeader) : nullptr, frameType)); | 229 video_header ? &(video_header->codecHeader) : nullptr, frameType)); |
231 | 230 |
232 StorageType storage; | 231 StorageType storage; |
233 bool fec_enabled; | 232 bool fec_enabled; |
234 bool first_frame = first_frame_sent_(); | 233 bool first_frame = first_frame_sent_(); |
235 { | 234 { |
236 rtc::CritScope cs(&crit_); | 235 rtc::CritScope cs(&crit_); |
237 FecProtectionParams* fec_params = | 236 FecProtectionParams* fec_params = |
238 frameType == kVideoFrameKey ? &key_fec_params_ : &delta_fec_params_; | 237 frameType == kVideoFrameKey ? &key_fec_params_ : &delta_fec_params_; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 rtc::CritScope cs(&crit_); | 346 rtc::CritScope cs(&crit_); |
348 return _retransmissionSettings; | 347 return _retransmissionSettings; |
349 } | 348 } |
350 | 349 |
351 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 350 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
352 rtc::CritScope cs(&crit_); | 351 rtc::CritScope cs(&crit_); |
353 _retransmissionSettings = settings; | 352 _retransmissionSettings = settings; |
354 } | 353 } |
355 | 354 |
356 } // namespace webrtc | 355 } // namespace webrtc |
OLD | NEW |