| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 struct RtpPacket { | 32 struct RtpPacket { |
| 33 uint16_t rtpHeaderLength; | 33 uint16_t rtpHeaderLength; |
| 34 ForwardErrorCorrection::Packet* pkt; | 34 ForwardErrorCorrection::Packet* pkt; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 RTPSenderVideo::RTPSenderVideo(Clock* clock, RTPSenderInterface* rtpSender) | 37 RTPSenderVideo::RTPSenderVideo(Clock* clock, RTPSenderInterface* rtpSender) |
| 38 : _rtpSender(*rtpSender), | 38 : _rtpSender(*rtpSender), |
| 39 crit_(CriticalSectionWrapper::CreateCriticalSection()), | 39 crit_(CriticalSectionWrapper::CreateCriticalSection()), |
| 40 _videoType(kRtpVideoGeneric), | 40 _videoType(kRtpVideoGeneric), |
| 41 _maxBitrate(0), | |
| 42 _retransmissionSettings(kRetransmitBaseLayer), | 41 _retransmissionSettings(kRetransmitBaseLayer), |
| 43 | |
| 44 // Generic FEC | 42 // Generic FEC |
| 45 fec_(), | 43 fec_(), |
| 46 fec_enabled_(false), | 44 fec_enabled_(false), |
| 47 red_payload_type_(-1), | 45 red_payload_type_(-1), |
| 48 fec_payload_type_(-1), | 46 fec_payload_type_(-1), |
| 49 delta_fec_params_(), | 47 delta_fec_params_(), |
| 50 key_fec_params_(), | 48 key_fec_params_(), |
| 51 producer_fec_(&fec_), | 49 producer_fec_(&fec_), |
| 52 _fecOverheadRate(clock, NULL), | 50 _fecOverheadRate(clock, NULL), |
| 53 _videoBitrate(clock, NULL) { | 51 _videoBitrate(clock, NULL) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 65 _videoType = videoType; | 63 _videoType = videoType; |
| 66 } | 64 } |
| 67 | 65 |
| 68 RtpVideoCodecTypes RTPSenderVideo::VideoCodecType() const { | 66 RtpVideoCodecTypes RTPSenderVideo::VideoCodecType() const { |
| 69 return _videoType; | 67 return _videoType; |
| 70 } | 68 } |
| 71 | 69 |
| 72 // Static. | 70 // Static. |
| 73 RtpUtility::Payload* RTPSenderVideo::CreateVideoPayload( | 71 RtpUtility::Payload* RTPSenderVideo::CreateVideoPayload( |
| 74 const char payloadName[RTP_PAYLOAD_NAME_SIZE], | 72 const char payloadName[RTP_PAYLOAD_NAME_SIZE], |
| 75 const int8_t payloadType, | 73 const int8_t payloadType) { |
| 76 const uint32_t maxBitRate) { | |
| 77 RtpVideoCodecTypes videoType = kRtpVideoGeneric; | 74 RtpVideoCodecTypes videoType = kRtpVideoGeneric; |
| 78 if (RtpUtility::StringCompare(payloadName, "VP8", 3)) { | 75 if (RtpUtility::StringCompare(payloadName, "VP8", 3)) { |
| 79 videoType = kRtpVideoVp8; | 76 videoType = kRtpVideoVp8; |
| 80 } else if (RtpUtility::StringCompare(payloadName, "VP9", 3)) { | 77 } else if (RtpUtility::StringCompare(payloadName, "VP9", 3)) { |
| 81 videoType = kRtpVideoVp9; | 78 videoType = kRtpVideoVp9; |
| 82 } else if (RtpUtility::StringCompare(payloadName, "H264", 4)) { | 79 } else if (RtpUtility::StringCompare(payloadName, "H264", 4)) { |
| 83 videoType = kRtpVideoH264; | 80 videoType = kRtpVideoH264; |
| 84 } else if (RtpUtility::StringCompare(payloadName, "I420", 4)) { | 81 } else if (RtpUtility::StringCompare(payloadName, "I420", 4)) { |
| 85 videoType = kRtpVideoGeneric; | 82 videoType = kRtpVideoGeneric; |
| 86 } else { | 83 } else { |
| 87 videoType = kRtpVideoGeneric; | 84 videoType = kRtpVideoGeneric; |
| 88 } | 85 } |
| 89 RtpUtility::Payload* payload = new RtpUtility::Payload(); | 86 RtpUtility::Payload* payload = new RtpUtility::Payload(); |
| 90 payload->name[RTP_PAYLOAD_NAME_SIZE - 1] = 0; | 87 payload->name[RTP_PAYLOAD_NAME_SIZE - 1] = 0; |
| 91 strncpy(payload->name, payloadName, RTP_PAYLOAD_NAME_SIZE - 1); | 88 strncpy(payload->name, payloadName, RTP_PAYLOAD_NAME_SIZE - 1); |
| 92 payload->typeSpecific.Video.videoCodecType = videoType; | 89 payload->typeSpecific.Video.videoCodecType = videoType; |
| 93 payload->typeSpecific.Video.maxRate = maxBitRate; | |
| 94 payload->audio = false; | 90 payload->audio = false; |
| 95 return payload; | 91 return payload; |
| 96 } | 92 } |
| 97 | 93 |
| 98 void RTPSenderVideo::SendVideoPacket(uint8_t* data_buffer, | 94 void RTPSenderVideo::SendVideoPacket(uint8_t* data_buffer, |
| 99 const size_t payload_length, | 95 const size_t payload_length, |
| 100 const size_t rtp_header_length, | 96 const size_t rtp_header_length, |
| 101 uint16_t seq_num, | 97 uint16_t seq_num, |
| 102 const uint32_t capture_timestamp, | 98 const uint32_t capture_timestamp, |
| 103 int64_t capture_time_ms, | 99 int64_t capture_time_ms, |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 _rtpSender.SequenceNumber(), captureTimeStamp, | 314 _rtpSender.SequenceNumber(), captureTimeStamp, |
| 319 capture_time_ms, storage); | 315 capture_time_ms, storage); |
| 320 } | 316 } |
| 321 } | 317 } |
| 322 | 318 |
| 323 TRACE_EVENT_ASYNC_END1( | 319 TRACE_EVENT_ASYNC_END1( |
| 324 "webrtc", "Video", capture_time_ms, "timestamp", _rtpSender.Timestamp()); | 320 "webrtc", "Video", capture_time_ms, "timestamp", _rtpSender.Timestamp()); |
| 325 return 0; | 321 return 0; |
| 326 } | 322 } |
| 327 | 323 |
| 328 void RTPSenderVideo::SetMaxConfiguredBitrateVideo(const uint32_t maxBitrate) { | |
| 329 _maxBitrate = maxBitrate; | |
| 330 } | |
| 331 | |
| 332 uint32_t RTPSenderVideo::MaxConfiguredBitrateVideo() const { | |
| 333 return _maxBitrate; | |
| 334 } | |
| 335 | |
| 336 void RTPSenderVideo::ProcessBitrate() { | 324 void RTPSenderVideo::ProcessBitrate() { |
| 337 _videoBitrate.Process(); | 325 _videoBitrate.Process(); |
| 338 _fecOverheadRate.Process(); | 326 _fecOverheadRate.Process(); |
| 339 } | 327 } |
| 340 | 328 |
| 341 uint32_t RTPSenderVideo::VideoBitrateSent() const { | 329 uint32_t RTPSenderVideo::VideoBitrateSent() const { |
| 342 return _videoBitrate.BitrateLast(); | 330 return _videoBitrate.BitrateLast(); |
| 343 } | 331 } |
| 344 | 332 |
| 345 uint32_t RTPSenderVideo::FecOverheadRate() const { | 333 uint32_t RTPSenderVideo::FecOverheadRate() const { |
| 346 return _fecOverheadRate.BitrateLast(); | 334 return _fecOverheadRate.BitrateLast(); |
| 347 } | 335 } |
| 348 | 336 |
| 349 int RTPSenderVideo::SelectiveRetransmissions() const { | 337 int RTPSenderVideo::SelectiveRetransmissions() const { |
| 350 CriticalSectionScoped cs(crit_.get()); | 338 CriticalSectionScoped cs(crit_.get()); |
| 351 return _retransmissionSettings; | 339 return _retransmissionSettings; |
| 352 } | 340 } |
| 353 | 341 |
| 354 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 342 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
| 355 CriticalSectionScoped cs(crit_.get()); | 343 CriticalSectionScoped cs(crit_.get()); |
| 356 _retransmissionSettings = settings; | 344 _retransmissionSettings = settings; |
| 357 } | 345 } |
| 358 | 346 |
| 359 } // namespace webrtc | 347 } // namespace webrtc |
| OLD | NEW |