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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // Ensure that we update the rate if new or old is zero. | 319 // Ensure that we update the rate if new or old is zero. |
320 return 0; | 320 return 0; |
321 } | 321 } |
322 if (!audio_configured_ && !payload->audio) { | 322 if (!audio_configured_ && !payload->audio) { |
323 return 0; | 323 return 0; |
324 } | 324 } |
325 } | 325 } |
326 return -1; | 326 return -1; |
327 } | 327 } |
328 int32_t ret_val = 0; | 328 int32_t ret_val = 0; |
329 RtpUtility::Payload* payload = NULL; | 329 RtpUtility::Payload* payload = nullptr; |
330 if (audio_configured_) { | 330 if (audio_configured_) { |
331 // TODO(mflodman): Change to CreateAudioPayload and make static. | 331 // TODO(mflodman): Change to CreateAudioPayload and make static. |
332 ret_val = audio_->RegisterAudioPayload(payload_name, payload_number, | 332 ret_val = audio_->RegisterAudioPayload(payload_name, payload_number, |
333 frequency, channels, rate, payload); | 333 frequency, channels, rate, &payload); |
334 } else { | 334 } else { |
335 payload = video_->CreateVideoPayload(payload_name, payload_number, rate); | 335 payload = video_->CreateVideoPayload(payload_name, payload_number, rate); |
336 } | 336 } |
337 if (payload) { | 337 if (payload) { |
338 payload_type_map_[payload_number] = payload; | 338 payload_type_map_[payload_number] = payload; |
339 } | 339 } |
340 return ret_val; | 340 return ret_val; |
341 } | 341 } |
342 | 342 |
343 int32_t RTPSender::DeRegisterSendPayload(int8_t payload_type) { | 343 int32_t RTPSender::DeRegisterSendPayload(int8_t payload_type) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 int32_t RTPSender::CheckPayloadType(int8_t payload_type, | 448 int32_t RTPSender::CheckPayloadType(int8_t payload_type, |
449 RtpVideoCodecTypes* video_type) { | 449 RtpVideoCodecTypes* video_type) { |
450 CriticalSectionScoped cs(send_critsect_.get()); | 450 CriticalSectionScoped cs(send_critsect_.get()); |
451 | 451 |
452 if (payload_type < 0) { | 452 if (payload_type < 0) { |
453 LOG(LS_ERROR) << "Invalid payload_type " << payload_type; | 453 LOG(LS_ERROR) << "Invalid payload_type " << payload_type; |
454 return -1; | 454 return -1; |
455 } | 455 } |
456 if (audio_configured_) { | 456 if (audio_configured_) { |
457 int8_t red_pl_type = -1; | 457 int8_t red_pl_type = -1; |
458 if (audio_->RED(red_pl_type) == 0) { | 458 if (audio_->RED(&red_pl_type) == 0) { |
459 // We have configured RED. | 459 // We have configured RED. |
460 if (red_pl_type == payload_type) { | 460 if (red_pl_type == payload_type) { |
461 // And it's a match... | 461 // And it's a match... |
462 return 0; | 462 return 0; |
463 } | 463 } |
464 } | 464 } |
465 } | 465 } |
466 if (payload_type_ == payload_type) { | 466 if (payload_type_ == payload_type) { |
467 if (!audio_configured_) { | 467 if (!audio_configured_) { |
468 *video_type = video_->VideoCodecType(); | 468 *video_type = video_->VideoCodecType(); |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 } | 994 } |
995 | 995 |
996 bool RTPSender::IsFecPacket(const uint8_t* buffer, | 996 bool RTPSender::IsFecPacket(const uint8_t* buffer, |
997 const RTPHeader& header) const { | 997 const RTPHeader& header) const { |
998 if (!video_) { | 998 if (!video_) { |
999 return false; | 999 return false; |
1000 } | 1000 } |
1001 bool fec_enabled; | 1001 bool fec_enabled; |
1002 uint8_t pt_red; | 1002 uint8_t pt_red; |
1003 uint8_t pt_fec; | 1003 uint8_t pt_fec; |
1004 video_->GenericFECStatus(fec_enabled, pt_red, pt_fec); | 1004 video_->GenericFECStatus(&fec_enabled, &pt_red, &pt_fec); |
1005 return fec_enabled && | 1005 return fec_enabled && |
1006 header.payloadType == pt_red && | 1006 header.payloadType == pt_red && |
1007 buffer[header.headerLength] == pt_fec; | 1007 buffer[header.headerLength] == pt_fec; |
1008 } | 1008 } |
1009 | 1009 |
1010 size_t RTPSender::TimeToSendPadding(size_t bytes) { | 1010 size_t RTPSender::TimeToSendPadding(size_t bytes) { |
1011 if (audio_configured_ || bytes == 0) | 1011 if (audio_configured_ || bytes == 0) |
1012 return 0; | 1012 return 0; |
1013 { | 1013 { |
1014 CriticalSectionScoped cs(send_critsect_.get()); | 1014 CriticalSectionScoped cs(send_critsect_.get()); |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 if (!audio_configured_) { | 1771 if (!audio_configured_) { |
1772 return -1; | 1772 return -1; |
1773 } | 1773 } |
1774 return audio_->SetRED(payload_type); | 1774 return audio_->SetRED(payload_type); |
1775 } | 1775 } |
1776 | 1776 |
1777 int32_t RTPSender::RED(int8_t *payload_type) const { | 1777 int32_t RTPSender::RED(int8_t *payload_type) const { |
1778 if (!audio_configured_) { | 1778 if (!audio_configured_) { |
1779 return -1; | 1779 return -1; |
1780 } | 1780 } |
1781 return audio_->RED(*payload_type); | 1781 return audio_->RED(payload_type); |
1782 } | 1782 } |
1783 | 1783 |
1784 RtpVideoCodecTypes RTPSender::VideoCodecType() const { | 1784 RtpVideoCodecTypes RTPSender::VideoCodecType() const { |
1785 assert(!audio_configured_ && "Sender is an audio stream!"); | 1785 assert(!audio_configured_ && "Sender is an audio stream!"); |
1786 return video_->VideoCodecType(); | 1786 return video_->VideoCodecType(); |
1787 } | 1787 } |
1788 | 1788 |
1789 uint32_t RTPSender::MaxConfiguredBitrateVideo() const { | 1789 uint32_t RTPSender::MaxConfiguredBitrateVideo() const { |
1790 if (audio_configured_) { | 1790 if (audio_configured_) { |
1791 return 0; | 1791 return 0; |
1792 } | 1792 } |
1793 return video_->MaxConfiguredBitrateVideo(); | 1793 return video_->MaxConfiguredBitrateVideo(); |
1794 } | 1794 } |
1795 | 1795 |
1796 void RTPSender::SetGenericFECStatus(bool enable, | 1796 void RTPSender::SetGenericFECStatus(bool enable, |
1797 uint8_t payload_type_red, | 1797 uint8_t payload_type_red, |
1798 uint8_t payload_type_fec) { | 1798 uint8_t payload_type_fec) { |
1799 RTC_DCHECK(!audio_configured_); | 1799 RTC_DCHECK(!audio_configured_); |
1800 video_->SetGenericFECStatus(enable, payload_type_red, payload_type_fec); | 1800 video_->SetGenericFECStatus(enable, payload_type_red, payload_type_fec); |
1801 } | 1801 } |
1802 | 1802 |
1803 void RTPSender::GenericFECStatus(bool* enable, | 1803 void RTPSender::GenericFECStatus(bool* enable, |
1804 uint8_t* payload_type_red, | 1804 uint8_t* payload_type_red, |
1805 uint8_t* payload_type_fec) const { | 1805 uint8_t* payload_type_fec) const { |
1806 RTC_DCHECK(!audio_configured_); | 1806 RTC_DCHECK(!audio_configured_); |
1807 video_->GenericFECStatus(*enable, *payload_type_red, *payload_type_fec); | 1807 video_->GenericFECStatus(enable, payload_type_red, payload_type_fec); |
1808 } | 1808 } |
1809 | 1809 |
1810 int32_t RTPSender::SetFecParameters( | 1810 int32_t RTPSender::SetFecParameters( |
1811 const FecProtectionParams *delta_params, | 1811 const FecProtectionParams *delta_params, |
1812 const FecProtectionParams *key_params) { | 1812 const FecProtectionParams *key_params) { |
1813 if (audio_configured_) { | 1813 if (audio_configured_) { |
1814 return -1; | 1814 return -1; |
1815 } | 1815 } |
1816 video_->SetFecParameters(delta_params, key_params); | 1816 video_->SetFecParameters(delta_params, key_params); |
1817 return 0; | 1817 return 0; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 CriticalSectionScoped lock(send_critsect_.get()); | 1906 CriticalSectionScoped lock(send_critsect_.get()); |
1907 | 1907 |
1908 RtpState state; | 1908 RtpState state; |
1909 state.sequence_number = sequence_number_rtx_; | 1909 state.sequence_number = sequence_number_rtx_; |
1910 state.start_timestamp = start_timestamp_; | 1910 state.start_timestamp = start_timestamp_; |
1911 | 1911 |
1912 return state; | 1912 return state; |
1913 } | 1913 } |
1914 | 1914 |
1915 } // namespace webrtc | 1915 } // namespace webrtc |
OLD | NEW |