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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 | 73 |
74 memset(current_remote_csrc_, 0, sizeof(current_remote_csrc_)); | 74 memset(current_remote_csrc_, 0, sizeof(current_remote_csrc_)); |
75 } | 75 } |
76 | 76 |
77 RtpReceiverImpl::~RtpReceiverImpl() { | 77 RtpReceiverImpl::~RtpReceiverImpl() { |
78 for (int i = 0; i < num_csrcs_; ++i) { | 78 for (int i = 0; i < num_csrcs_; ++i) { |
79 cb_rtp_feedback_->OnIncomingCSRCChanged(current_remote_csrc_[i], false); | 79 cb_rtp_feedback_->OnIncomingCSRCChanged(current_remote_csrc_[i], false); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 int32_t RtpReceiverImpl::RegisterReceivePayload( | 83 int32_t RtpReceiverImpl::RegisterReceivePayload(const CodecInst& audio_codec) { |
84 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | |
85 const int8_t payload_type, | |
86 const uint32_t frequency, | |
87 const size_t channels, | |
88 const uint32_t rate) { | |
89 rtc::CritScope lock(&critical_section_rtp_receiver_); | 84 rtc::CritScope lock(&critical_section_rtp_receiver_); |
90 | 85 |
91 // TODO(phoglund): Try to streamline handling of the RED codec and some other | 86 // TODO(phoglund): Try to streamline handling of the RED codec and some other |
92 // cases which makes it necessary to keep track of whether we created a | 87 // cases which makes it necessary to keep track of whether we created a |
93 // payload or not. | 88 // payload or not. |
94 bool created_new_payload = false; | 89 bool created_new_payload = false; |
95 int32_t result = rtp_payload_registry_->RegisterReceivePayload( | 90 int32_t result = rtp_payload_registry_->RegisterReceivePayload( |
96 payload_name, payload_type, frequency, channels, rate, | 91 audio_codec, &created_new_payload); |
97 &created_new_payload); | |
98 if (created_new_payload) { | 92 if (created_new_payload) { |
99 if (rtp_media_receiver_->OnNewPayloadTypeCreated(payload_name, payload_type, | 93 if (rtp_media_receiver_->OnNewPayloadTypeCreated( |
100 frequency) != 0) { | 94 audio_codec.plname, audio_codec.pltype, audio_codec.plfreq) != 0) { |
101 LOG(LS_ERROR) << "Failed to register payload: " << payload_name << "/" | 95 LOG(LS_ERROR) << "Failed to register payload: " << audio_codec.plname |
102 << static_cast<int>(payload_type); | 96 << "/" << static_cast<int>(audio_codec.pltype); |
103 return -1; | 97 return -1; |
104 } | 98 } |
105 } | 99 } |
100 return result; | |
101 } | |
102 | |
103 int32_t RtpReceiverImpl::RegisterReceivePayload(const VideoCodec& video_codec) { | |
104 rtc::CritScope lock(&critical_section_rtp_receiver_); | |
105 | |
106 // TODO(phoglund): Try to streamline handling of the RED codec and some other | |
107 // cases which makes it necessary to keep track of whether we created a | |
108 // payload or not. | |
109 bool created_new_payload = false; | |
110 int32_t result = rtp_payload_registry_->RegisterReceivePayload( | |
111 video_codec, &created_new_payload); | |
112 if (created_new_payload) { | |
113 if (rtp_media_receiver_->OnNewPayloadTypeCreated( | |
danilchap
2016/11/23 15:19:23
look like noone interested in new Video payload ty
magjed_webrtc
2016/11/23 16:35:53
Thanks, you are right! I didn't notice when I wrot
| |
114 video_codec.plName, video_codec.plType, | |
115 kVideoPayloadTypeFrequency) != 0) { | |
116 LOG(LS_ERROR) << "Failed to register payload: " << video_codec.plName | |
117 << "/" << static_cast<int>(video_codec.plType); | |
118 return -1; | |
119 } | |
120 } | |
106 return result; | 121 return result; |
107 } | 122 } |
108 | 123 |
109 int32_t RtpReceiverImpl::DeRegisterReceivePayload( | 124 int32_t RtpReceiverImpl::DeRegisterReceivePayload( |
110 const int8_t payload_type) { | 125 const int8_t payload_type) { |
111 rtc::CritScope lock(&critical_section_rtp_receiver_); | 126 rtc::CritScope lock(&critical_section_rtp_receiver_); |
112 return rtp_payload_registry_->DeRegisterReceivePayload(payload_type); | 127 return rtp_payload_registry_->DeRegisterReceivePayload(payload_type); |
113 } | 128 } |
114 | 129 |
115 uint32_t RtpReceiverImpl::SSRC() const { | 130 uint32_t RtpReceiverImpl::SSRC() const { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
456 // implementations might have CSRC 0 as a valid value. | 471 // implementations might have CSRC 0 as a valid value. |
457 if (num_csrcs_diff > 0) { | 472 if (num_csrcs_diff > 0) { |
458 cb_rtp_feedback_->OnIncomingCSRCChanged(0, true); | 473 cb_rtp_feedback_->OnIncomingCSRCChanged(0, true); |
459 } else if (num_csrcs_diff < 0) { | 474 } else if (num_csrcs_diff < 0) { |
460 cb_rtp_feedback_->OnIncomingCSRCChanged(0, false); | 475 cb_rtp_feedback_->OnIncomingCSRCChanged(0, false); |
461 } | 476 } |
462 } | 477 } |
463 } | 478 } |
464 | 479 |
465 } // namespace webrtc | 480 } // namespace webrtc |
OLD | NEW |