| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2078 | 2078 |
| 2079 // At this point the stream's local SSRC has been updated. If it is the first | 2079 // At this point the stream's local SSRC has been updated. If it is the first |
| 2080 // send stream, make sure that all the receive streams are updated with the | 2080 // send stream, make sure that all the receive streams are updated with the |
| 2081 // same SSRC in order to send receiver reports. | 2081 // same SSRC in order to send receiver reports. |
| 2082 if (send_streams_.size() == 1) { | 2082 if (send_streams_.size() == 1) { |
| 2083 receiver_reports_ssrc_ = ssrc; | 2083 receiver_reports_ssrc_ = ssrc; |
| 2084 for (const auto& kv : recv_streams_) { | 2084 for (const auto& kv : recv_streams_) { |
| 2085 // TODO(solenberg): Allow applications to set the RTCP SSRC of receive | 2085 // TODO(solenberg): Allow applications to set the RTCP SSRC of receive |
| 2086 // streams instead, so we can avoid recreating the streams here. | 2086 // streams instead, so we can avoid recreating the streams here. |
| 2087 kv.second->RecreateAudioReceiveStream(ssrc); | 2087 kv.second->RecreateAudioReceiveStream(ssrc); |
| 2088 int recv_channel = kv.second->channel(); | |
| 2089 engine()->voe()->base()->AssociateSendChannel(recv_channel, channel); | |
| 2090 LOG(LS_INFO) << "VoiceEngine channel #" << recv_channel | |
| 2091 << " is associated with channel #" << channel << "."; | |
| 2092 } | 2088 } |
| 2093 } | 2089 } |
| 2094 | 2090 |
| 2095 send_streams_[ssrc]->SetSend(send_); | 2091 send_streams_[ssrc]->SetSend(send_); |
| 2096 return true; | 2092 return true; |
| 2097 } | 2093 } |
| 2098 | 2094 |
| 2099 bool WebRtcVoiceMediaChannel::RemoveSendStream(uint32_t ssrc) { | 2095 bool WebRtcVoiceMediaChannel::RemoveSendStream(uint32_t ssrc) { |
| 2100 TRACE_EVENT0("webrtc", "WebRtcVoiceMediaChannel::RemoveSendStream"); | 2096 TRACE_EVENT0("webrtc", "WebRtcVoiceMediaChannel::RemoveSendStream"); |
| 2101 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2097 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2102 LOG(LS_INFO) << "RemoveSendStream: " << ssrc; | 2098 LOG(LS_INFO) << "RemoveSendStream: " << ssrc; |
| 2103 | 2099 |
| 2104 auto it = send_streams_.find(ssrc); | 2100 auto it = send_streams_.find(ssrc); |
| 2105 if (it == send_streams_.end()) { | 2101 if (it == send_streams_.end()) { |
| 2106 LOG(LS_WARNING) << "Try to remove stream with ssrc " << ssrc | 2102 LOG(LS_WARNING) << "Try to remove stream with ssrc " << ssrc |
| 2107 << " which doesn't exist."; | 2103 << " which doesn't exist."; |
| 2108 return false; | 2104 return false; |
| 2109 } | 2105 } |
| 2110 | 2106 |
| 2111 it->second->SetSend(false); | 2107 it->second->SetSend(false); |
| 2112 | 2108 |
| 2109 // TODO(solenberg): If we're removing the receiver_reports_ssrc_ stream, find |
| 2110 // the first active send stream and use that instead, reassociating receive |
| 2111 // streams. |
| 2112 |
| 2113 // Clean up and delete the send stream+channel. | 2113 // Clean up and delete the send stream+channel. |
| 2114 int channel = it->second->channel(); | 2114 int channel = it->second->channel(); |
| 2115 LOG(LS_INFO) << "Removing audio send stream " << ssrc | 2115 LOG(LS_INFO) << "Removing audio send stream " << ssrc |
| 2116 << " with VoiceEngine channel #" << channel << "."; | 2116 << " with VoiceEngine channel #" << channel << "."; |
| 2117 delete it->second; | 2117 delete it->second; |
| 2118 send_streams_.erase(it); | 2118 send_streams_.erase(it); |
| 2119 if (!DeleteVoEChannel(channel)) { | 2119 if (!DeleteVoEChannel(channel)) { |
| 2120 return false; | 2120 return false; |
| 2121 } | 2121 } |
| 2122 if (send_streams_.empty()) { | 2122 if (send_streams_.empty()) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2175 voe_codec.pltype = codec.id; | 2175 voe_codec.pltype = codec.id; |
| 2176 if (engine()->voe()->codec()->SetRecPayloadType( | 2176 if (engine()->voe()->codec()->SetRecPayloadType( |
| 2177 channel, voe_codec) == -1) { | 2177 channel, voe_codec) == -1) { |
| 2178 LOG_RTCERR2(SetRecPayloadType, channel, ToString(voe_codec)); | 2178 LOG_RTCERR2(SetRecPayloadType, channel, ToString(voe_codec)); |
| 2179 DeleteVoEChannel(channel); | 2179 DeleteVoEChannel(channel); |
| 2180 return false; | 2180 return false; |
| 2181 } | 2181 } |
| 2182 } | 2182 } |
| 2183 } | 2183 } |
| 2184 | 2184 |
| 2185 const int send_channel = GetSendChannelId(receiver_reports_ssrc_); | |
| 2186 if (send_channel != -1) { | |
| 2187 // Associate receive channel with first send channel (so the receive channel | |
| 2188 // can obtain RTT from the send channel) | |
| 2189 engine()->voe()->base()->AssociateSendChannel(channel, send_channel); | |
| 2190 LOG(LS_INFO) << "VoiceEngine channel #" << channel | |
| 2191 << " is associated with channel #" << send_channel << "."; | |
| 2192 } | |
| 2193 | |
| 2194 recv_streams_.insert(std::make_pair( | 2185 recv_streams_.insert(std::make_pair( |
| 2195 ssrc, new WebRtcAudioReceiveStream(channel, ssrc, receiver_reports_ssrc_, | 2186 ssrc, new WebRtcAudioReceiveStream(channel, ssrc, receiver_reports_ssrc_, |
| 2196 recv_transport_cc_enabled_, | 2187 recv_transport_cc_enabled_, |
| 2197 recv_nack_enabled_, | 2188 recv_nack_enabled_, |
| 2198 sp.sync_label, recv_rtp_extensions_, | 2189 sp.sync_label, recv_rtp_extensions_, |
| 2199 call_, this, | 2190 call_, this, |
| 2200 engine()->decoder_factory_))); | 2191 engine()->decoder_factory_))); |
| 2201 recv_streams_[ssrc]->SetPlayout(playout_); | 2192 recv_streams_[ssrc]->SetPlayout(playout_); |
| 2202 | 2193 |
| 2203 return true; | 2194 return true; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2579 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2570 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2580 const auto it = send_streams_.find(ssrc); | 2571 const auto it = send_streams_.find(ssrc); |
| 2581 if (it != send_streams_.end()) { | 2572 if (it != send_streams_.end()) { |
| 2582 return it->second->channel(); | 2573 return it->second->channel(); |
| 2583 } | 2574 } |
| 2584 return -1; | 2575 return -1; |
| 2585 } | 2576 } |
| 2586 } // namespace cricket | 2577 } // namespace cricket |
| 2587 | 2578 |
| 2588 #endif // HAVE_WEBRTC_VOICE | 2579 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |