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