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 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 if (it == decoder_map.end() || *it != item) { | 1602 if (it == decoder_map.end() || *it != item) { |
1603 return false; // The old map isn't a subset of the new map. | 1603 return false; // The old map isn't a subset of the new map. |
1604 } | 1604 } |
1605 } | 1605 } |
1606 return true; | 1606 return true; |
1607 }()); | 1607 }()); |
1608 config_.decoder_map = decoder_map; | 1608 config_.decoder_map = decoder_map; |
1609 RecreateAudioReceiveStream(); | 1609 RecreateAudioReceiveStream(); |
1610 } | 1610 } |
1611 | 1611 |
| 1612 void MaybeRecreateAudioReceiveStream(const std::string& sync_group) { |
| 1613 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1614 if (config_.sync_group != sync_group) { |
| 1615 config_.sync_group = sync_group; |
| 1616 RecreateAudioReceiveStream(); |
| 1617 } |
| 1618 } |
| 1619 |
1612 webrtc::AudioReceiveStream::Stats GetStats() const { | 1620 webrtc::AudioReceiveStream::Stats GetStats() const { |
1613 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1621 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1614 RTC_DCHECK(stream_); | 1622 RTC_DCHECK(stream_); |
1615 return stream_->GetStats(); | 1623 return stream_->GetStats(); |
1616 } | 1624 } |
1617 | 1625 |
1618 int channel() const { | 1626 int channel() const { |
1619 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1627 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1620 return config_.voe_channel_id; | 1628 return config_.voe_channel_id; |
1621 } | 1629 } |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2269 if (!ValidateStreamParams(sp)) { | 2277 if (!ValidateStreamParams(sp)) { |
2270 return false; | 2278 return false; |
2271 } | 2279 } |
2272 | 2280 |
2273 const uint32_t ssrc = sp.first_ssrc(); | 2281 const uint32_t ssrc = sp.first_ssrc(); |
2274 if (ssrc == 0) { | 2282 if (ssrc == 0) { |
2275 LOG(LS_WARNING) << "AddRecvStream with ssrc==0 is not supported."; | 2283 LOG(LS_WARNING) << "AddRecvStream with ssrc==0 is not supported."; |
2276 return false; | 2284 return false; |
2277 } | 2285 } |
2278 | 2286 |
2279 // Remove the default receive stream if one had been created with this ssrc; | 2287 // If the default receive stream was created with this ssrc, we unmark it as |
2280 // we'll recreate it then. | 2288 // being the default stream, and possibly recreate the AudioReceiveStream, if |
| 2289 // sync_label has changed. |
2281 if (IsDefaultRecvStream(ssrc)) { | 2290 if (IsDefaultRecvStream(ssrc)) { |
2282 RemoveRecvStream(ssrc); | 2291 recv_streams_[ssrc]->MaybeRecreateAudioReceiveStream(sp.sync_label); |
| 2292 default_recv_ssrc_ = -1; |
| 2293 return true; |
2283 } | 2294 } |
2284 | 2295 |
2285 if (GetReceiveChannelId(ssrc) != -1) { | 2296 if (GetReceiveChannelId(ssrc) != -1) { |
2286 LOG(LS_ERROR) << "Stream already exists with ssrc " << ssrc; | 2297 LOG(LS_ERROR) << "Stream already exists with ssrc " << ssrc; |
2287 return false; | 2298 return false; |
2288 } | 2299 } |
2289 | 2300 |
2290 // Create a new channel for receiving audio data. | 2301 // Create a new channel for receiving audio data. |
2291 const int channel = CreateVoEChannel(); | 2302 const int channel = CreateVoEChannel(); |
2292 if (channel == -1) { | 2303 if (channel == -1) { |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2698 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2709 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
2699 const auto it = send_streams_.find(ssrc); | 2710 const auto it = send_streams_.find(ssrc); |
2700 if (it != send_streams_.end()) { | 2711 if (it != send_streams_.end()) { |
2701 return it->second->channel(); | 2712 return it->second->channel(); |
2702 } | 2713 } |
2703 return -1; | 2714 return -1; |
2704 } | 2715 } |
2705 } // namespace cricket | 2716 } // namespace cricket |
2706 | 2717 |
2707 #endif // HAVE_WEBRTC_VOICE | 2718 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |