OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 } | 1306 } |
1307 | 1307 |
1308 void WebRtcVoiceEngine::StopRtcEventLog() { | 1308 void WebRtcVoiceEngine::StopRtcEventLog() { |
1309 voe_wrapper_->codec()->GetEventLog()->StopLogging(); | 1309 voe_wrapper_->codec()->GetEventLog()->StopLogging(); |
1310 } | 1310 } |
1311 | 1311 |
1312 int WebRtcVoiceEngine::CreateVoEChannel() { | 1312 int WebRtcVoiceEngine::CreateVoEChannel() { |
1313 return voe_wrapper_->base()->CreateChannel(voe_config_); | 1313 return voe_wrapper_->base()->CreateChannel(voe_config_); |
1314 } | 1314 } |
1315 | 1315 |
1316 class WebRtcVoiceMediaChannel::WebRtcVoiceChannelRenderer | 1316 class WebRtcVoiceMediaChannel::WebRtcAudioSendStream |
1317 : public AudioRenderer::Sink { | 1317 : public AudioRenderer::Sink { |
1318 public: | 1318 public: |
1319 WebRtcVoiceChannelRenderer(int ch, | 1319 WebRtcAudioSendStream(int ch, webrtc::AudioTransport* voe_audio_transport, |
1320 webrtc::AudioTransport* voe_audio_transport) | 1320 uint32_t ssrc, webrtc::Call* call) |
1321 : channel_(ch), | 1321 : channel_(ch), |
1322 voe_audio_transport_(voe_audio_transport), | 1322 voe_audio_transport_(voe_audio_transport), |
1323 renderer_(NULL) {} | 1323 call_(call) { |
1324 ~WebRtcVoiceChannelRenderer() override { Stop(); } | 1324 RTC_DCHECK(call); |
| 1325 webrtc::AudioSendStream::Config config(nullptr); |
| 1326 config.voe_channel_id = channel_; |
| 1327 config.rtp.ssrc = ssrc; |
| 1328 stream_ = call_->CreateAudioSendStream(config); |
| 1329 RTC_DCHECK(stream_); |
| 1330 } |
| 1331 ~WebRtcAudioSendStream() override { |
| 1332 Stop(); |
| 1333 call_->DestroyAudioSendStream(stream_); |
| 1334 } |
1325 | 1335 |
1326 // Starts the rendering by setting a sink to the renderer to get data | 1336 // Starts the rendering by setting a sink to the renderer to get data |
1327 // callback. | 1337 // callback. |
1328 // This method is called on the libjingle worker thread. | 1338 // This method is called on the libjingle worker thread. |
1329 // TODO(xians): Make sure Start() is called only once. | 1339 // TODO(xians): Make sure Start() is called only once. |
1330 void Start(AudioRenderer* renderer) { | 1340 void Start(AudioRenderer* renderer) { |
1331 rtc::CritScope lock(&lock_); | 1341 rtc::CritScope lock(&lock_); |
1332 RTC_DCHECK(renderer != NULL); | 1342 RTC_DCHECK(renderer); |
1333 if (renderer_ != NULL) { | 1343 if (renderer_) { |
1334 RTC_DCHECK(renderer_ == renderer); | 1344 RTC_DCHECK(renderer_ == renderer); |
1335 return; | 1345 return; |
1336 } | 1346 } |
1337 renderer->SetSink(this); | 1347 renderer->SetSink(this); |
1338 renderer_ = renderer; | 1348 renderer_ = renderer; |
1339 } | 1349 } |
1340 | 1350 |
1341 // Stops rendering by setting the sink of the renderer to NULL. No data | 1351 // Stops rendering by setting the sink of the renderer to nullptr. No data |
1342 // callback will be received after this method. | 1352 // callback will be received after this method. |
1343 // This method is called on the libjingle worker thread. | 1353 // This method is called on the libjingle worker thread. |
1344 void Stop() { | 1354 void Stop() { |
1345 rtc::CritScope lock(&lock_); | 1355 rtc::CritScope lock(&lock_); |
1346 if (renderer_ != NULL) { | 1356 if (renderer_) { |
1347 renderer_->SetSink(NULL); | 1357 renderer_->SetSink(nullptr); |
1348 renderer_ = NULL; | 1358 renderer_ = nullptr; |
1349 } | 1359 } |
1350 } | 1360 } |
1351 | 1361 |
1352 // AudioRenderer::Sink implementation. | 1362 // AudioRenderer::Sink implementation. |
1353 // This method is called on the audio thread. | 1363 // This method is called on the audio thread. |
1354 void OnData(const void* audio_data, | 1364 void OnData(const void* audio_data, |
1355 int bits_per_sample, | 1365 int bits_per_sample, |
1356 int sample_rate, | 1366 int sample_rate, |
1357 int number_of_channels, | 1367 int number_of_channels, |
1358 size_t number_of_frames) override { | 1368 size_t number_of_frames) override { |
| 1369 RTC_DCHECK(voe_audio_transport_); |
1359 voe_audio_transport_->OnData(channel_, | 1370 voe_audio_transport_->OnData(channel_, |
1360 audio_data, | 1371 audio_data, |
1361 bits_per_sample, | 1372 bits_per_sample, |
1362 sample_rate, | 1373 sample_rate, |
1363 number_of_channels, | 1374 number_of_channels, |
1364 number_of_frames); | 1375 number_of_frames); |
1365 } | 1376 } |
1366 | 1377 |
1367 // Callback from the |renderer_| when it is going away. In case Start() has | 1378 // Callback from the |renderer_| when it is going away. In case Start() has |
1368 // never been called, this callback won't be triggered. | 1379 // never been called, this callback won't be triggered. |
1369 void OnClose() override { | 1380 void OnClose() override { |
1370 rtc::CritScope lock(&lock_); | 1381 rtc::CritScope lock(&lock_); |
1371 // Set |renderer_| to NULL to make sure no more callback will get into | 1382 // Set |renderer_| to nullptr to make sure no more callback will get into |
1372 // the renderer. | 1383 // the renderer. |
1373 renderer_ = NULL; | 1384 renderer_ = nullptr; |
1374 } | 1385 } |
1375 | 1386 |
1376 // Accessor to the VoE channel ID. | 1387 // Accessor to the VoE channel ID. |
1377 int channel() const { return channel_; } | 1388 int channel() const { return channel_; } |
1378 | 1389 |
1379 private: | 1390 private: |
1380 const int channel_; | 1391 const int channel_ = -1; |
1381 webrtc::AudioTransport* const voe_audio_transport_; | 1392 webrtc::AudioTransport* const voe_audio_transport_ = nullptr; |
| 1393 webrtc::Call* call_ = nullptr; |
| 1394 webrtc::AudioSendStream* stream_ = nullptr; |
1382 | 1395 |
1383 // Raw pointer to AudioRenderer owned by LocalAudioTrackHandler. | 1396 // Raw pointer to AudioRenderer owned by LocalAudioTrackHandler. |
1384 // PeerConnection will make sure invalidating the pointer before the object | 1397 // PeerConnection will make sure invalidating the pointer before the object |
1385 // goes away. | 1398 // goes away. |
1386 AudioRenderer* renderer_; | 1399 AudioRenderer* renderer_ = nullptr; |
1387 | 1400 |
1388 // Protects |renderer_| in Start(), Stop() and OnClose(). | 1401 // Protects |renderer_| in Start(), Stop() and OnClose(). |
1389 rtc::CriticalSection lock_; | 1402 rtc::CriticalSection lock_; |
| 1403 |
| 1404 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioSendStream); |
| 1405 }; |
| 1406 |
| 1407 class WebRtcVoiceMediaChannel::WebRtcAudioReceiveStream { |
| 1408 public: |
| 1409 explicit WebRtcAudioReceiveStream(int voe_channel_id) |
| 1410 : channel_(voe_channel_id) {} |
| 1411 |
| 1412 int channel() { return channel_; } |
| 1413 |
| 1414 private: |
| 1415 int channel_; |
| 1416 |
| 1417 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioReceiveStream); |
1390 }; | 1418 }; |
1391 | 1419 |
1392 // WebRtcVoiceMediaChannel | 1420 // WebRtcVoiceMediaChannel |
1393 WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, | 1421 WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, |
1394 const AudioOptions& options, | 1422 const AudioOptions& options, |
1395 webrtc::Call* call) | 1423 webrtc::Call* call) |
1396 : engine_(engine), | 1424 : engine_(engine), |
1397 send_bitrate_setting_(false), | 1425 send_bitrate_setting_(false), |
1398 send_bitrate_bps_(0), | 1426 send_bitrate_bps_(0), |
1399 options_(), | 1427 options_(), |
(...skipping 10 matching lines...) Expand all Loading... |
1410 RTC_DCHECK(nullptr != call); | 1438 RTC_DCHECK(nullptr != call); |
1411 engine->RegisterChannel(this); | 1439 engine->RegisterChannel(this); |
1412 SetOptions(options); | 1440 SetOptions(options); |
1413 } | 1441 } |
1414 | 1442 |
1415 WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel() { | 1443 WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel() { |
1416 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 1444 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
1417 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel"; | 1445 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel"; |
1418 | 1446 |
1419 // Remove any remaining send streams. | 1447 // Remove any remaining send streams. |
1420 while (!send_channels_.empty()) { | 1448 while (!send_streams_.empty()) { |
1421 RemoveSendStream(send_channels_.begin()->first); | 1449 RemoveSendStream(send_streams_.begin()->first); |
1422 } | 1450 } |
1423 | 1451 |
1424 // Remove any remaining receive streams. | 1452 // Remove any remaining receive streams. |
1425 while (!receive_channels_.empty()) { | 1453 while (!receive_channels_.empty()) { |
1426 RemoveRecvStream(receive_channels_.begin()->first); | 1454 RemoveRecvStream(receive_channels_.begin()->first); |
1427 } | 1455 } |
1428 RTC_DCHECK(receive_streams_.empty()); | 1456 RTC_DCHECK(receive_streams_.empty()); |
1429 | 1457 |
1430 // Unregister ourselves from the engine. | 1458 // Unregister ourselves from the engine. |
1431 engine()->UnregisterChannel(this); | 1459 engine()->UnregisterChannel(this); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 | 1502 |
1475 if (dscp_option_changed) { | 1503 if (dscp_option_changed) { |
1476 rtc::DiffServCodePoint dscp = rtc::DSCP_DEFAULT; | 1504 rtc::DiffServCodePoint dscp = rtc::DSCP_DEFAULT; |
1477 if (options_.dscp.GetWithDefaultIfUnset(false)) | 1505 if (options_.dscp.GetWithDefaultIfUnset(false)) |
1478 dscp = kAudioDscpValue; | 1506 dscp = kAudioDscpValue; |
1479 if (MediaChannel::SetDscp(dscp) != 0) { | 1507 if (MediaChannel::SetDscp(dscp) != 0) { |
1480 LOG(LS_WARNING) << "Failed to set DSCP settings for audio channel"; | 1508 LOG(LS_WARNING) << "Failed to set DSCP settings for audio channel"; |
1481 } | 1509 } |
1482 } | 1510 } |
1483 | 1511 |
| 1512 // TODO(solenberg): Don't recreate unless options changed. |
1484 RecreateAudioReceiveStreams(); | 1513 RecreateAudioReceiveStreams(); |
1485 | 1514 |
1486 LOG(LS_INFO) << "Set voice channel options. Current options: " | 1515 LOG(LS_INFO) << "Set voice channel options. Current options: " |
1487 << options_.ToString(); | 1516 << options_.ToString(); |
1488 return true; | 1517 return true; |
1489 } | 1518 } |
1490 | 1519 |
1491 bool WebRtcVoiceMediaChannel::SetRecvCodecs( | 1520 bool WebRtcVoiceMediaChannel::SetRecvCodecs( |
1492 const std::vector<AudioCodec>& codecs) { | 1521 const std::vector<AudioCodec>& codecs) { |
1493 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 1522 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 dtmf_allowed_ = false; | 1782 dtmf_allowed_ = false; |
1754 for (const AudioCodec& codec : codecs) { | 1783 for (const AudioCodec& codec : codecs) { |
1755 // Find the DTMF telephone event "codec". | 1784 // Find the DTMF telephone event "codec". |
1756 if (IsCodec(codec, kDtmfCodecName)) { | 1785 if (IsCodec(codec, kDtmfCodecName)) { |
1757 dtmf_allowed_ = true; | 1786 dtmf_allowed_ = true; |
1758 } | 1787 } |
1759 } | 1788 } |
1760 | 1789 |
1761 // Cache the codecs in order to configure the channel created later. | 1790 // Cache the codecs in order to configure the channel created later. |
1762 send_codecs_ = codecs; | 1791 send_codecs_ = codecs; |
1763 for (const auto& ch : send_channels_) { | 1792 for (const auto& ch : send_streams_) { |
1764 if (!SetSendCodecs(ch.second->channel(), codecs)) { | 1793 if (!SetSendCodecs(ch.second->channel(), codecs)) { |
1765 return false; | 1794 return false; |
1766 } | 1795 } |
1767 } | 1796 } |
1768 | 1797 |
1769 // Set nack status on receive channels and update |nack_enabled_|. | 1798 // Set nack status on receive channels and update |nack_enabled_|. |
1770 for (const auto& ch : receive_channels_) { | 1799 for (const auto& ch : receive_channels_) { |
1771 SetNack(ch.second->channel(), nack_enabled_); | 1800 SetNack(ch.second->channel(), nack_enabled_); |
1772 } | 1801 } |
1773 | 1802 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1864 return true; | 1893 return true; |
1865 } | 1894 } |
1866 | 1895 |
1867 bool WebRtcVoiceMediaChannel::SetSendRtpHeaderExtensions( | 1896 bool WebRtcVoiceMediaChannel::SetSendRtpHeaderExtensions( |
1868 const std::vector<RtpHeaderExtension>& extensions) { | 1897 const std::vector<RtpHeaderExtension>& extensions) { |
1869 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 1898 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
1870 if (send_extensions_ == extensions) { | 1899 if (send_extensions_ == extensions) { |
1871 return true; | 1900 return true; |
1872 } | 1901 } |
1873 | 1902 |
1874 for (const auto& ch : send_channels_) { | 1903 for (const auto& ch : send_streams_) { |
1875 if (!SetChannelSendRtpHeaderExtensions(ch.second->channel(), extensions)) { | 1904 if (!SetChannelSendRtpHeaderExtensions(ch.second->channel(), extensions)) { |
1876 return false; | 1905 return false; |
1877 } | 1906 } |
1878 } | 1907 } |
1879 | 1908 |
1880 send_extensions_ = extensions; | 1909 send_extensions_ = extensions; |
1881 return true; | 1910 return true; |
1882 } | 1911 } |
1883 | 1912 |
1884 bool WebRtcVoiceMediaChannel::SetChannelSendRtpHeaderExtensions( | 1913 bool WebRtcVoiceMediaChannel::SetChannelSendRtpHeaderExtensions( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 << ch.second->channel() << " failed"; | 1957 << ch.second->channel() << " failed"; |
1929 return false; | 1958 return false; |
1930 } | 1959 } |
1931 } | 1960 } |
1932 playout_ = playout; | 1961 playout_ = playout; |
1933 return true; | 1962 return true; |
1934 } | 1963 } |
1935 | 1964 |
1936 bool WebRtcVoiceMediaChannel::SetSend(SendFlags send) { | 1965 bool WebRtcVoiceMediaChannel::SetSend(SendFlags send) { |
1937 desired_send_ = send; | 1966 desired_send_ = send; |
1938 if (!send_channels_.empty()) | 1967 if (!send_streams_.empty()) { |
1939 return ChangeSend(desired_send_); | 1968 return ChangeSend(desired_send_); |
| 1969 } |
1940 return true; | 1970 return true; |
1941 } | 1971 } |
1942 | 1972 |
1943 bool WebRtcVoiceMediaChannel::PauseSend() { | 1973 bool WebRtcVoiceMediaChannel::PauseSend() { |
1944 return ChangeSend(SEND_NOTHING); | 1974 return ChangeSend(SEND_NOTHING); |
1945 } | 1975 } |
1946 | 1976 |
1947 bool WebRtcVoiceMediaChannel::ResumeSend() { | 1977 bool WebRtcVoiceMediaChannel::ResumeSend() { |
1948 return ChangeSend(desired_send_); | 1978 return ChangeSend(desired_send_); |
1949 } | 1979 } |
1950 | 1980 |
1951 bool WebRtcVoiceMediaChannel::ChangeSend(SendFlags send) { | 1981 bool WebRtcVoiceMediaChannel::ChangeSend(SendFlags send) { |
1952 if (send_ == send) { | 1982 if (send_ == send) { |
1953 return true; | 1983 return true; |
1954 } | 1984 } |
1955 | 1985 |
1956 // Apply channel specific options. | 1986 // Apply channel specific options. |
1957 if (send == SEND_MICROPHONE) { | 1987 if (send == SEND_MICROPHONE) { |
1958 engine()->ApplyOptions(options_); | 1988 engine()->ApplyOptions(options_); |
1959 } | 1989 } |
1960 | 1990 |
1961 // Change the settings on each send channel. | 1991 // Change the settings on each send channel. |
1962 for (const auto& ch : send_channels_) { | 1992 for (const auto& ch : send_streams_) { |
1963 if (!ChangeSend(ch.second->channel(), send)) { | 1993 if (!ChangeSend(ch.second->channel(), send)) { |
1964 return false; | 1994 return false; |
1965 } | 1995 } |
1966 } | 1996 } |
1967 | 1997 |
1968 // Clear up the options after stopping sending. Since we may previously have | 1998 // Clear up the options after stopping sending. Since we may previously have |
1969 // applied the channel specific options, now apply the original options stored | 1999 // applied the channel specific options, now apply the original options stored |
1970 // in WebRtcVoiceEngine. | 2000 // in WebRtcVoiceEngine. |
1971 if (send == SEND_NOTHING) { | 2001 if (send == SEND_NOTHING) { |
1972 engine()->ApplyOptions(engine()->GetOptions()); | 2002 engine()->ApplyOptions(engine()->GetOptions()); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2068 DeleteChannel(channel); | 2098 DeleteChannel(channel); |
2069 return false; | 2099 return false; |
2070 } | 2100 } |
2071 | 2101 |
2072 if (engine()->voe()->rtp()->SetRTCP_CNAME(channel, sp.cname.c_str()) == -1) { | 2102 if (engine()->voe()->rtp()->SetRTCP_CNAME(channel, sp.cname.c_str()) == -1) { |
2073 LOG_RTCERR2(SetRTCP_CNAME, channel, sp.cname); | 2103 LOG_RTCERR2(SetRTCP_CNAME, channel, sp.cname); |
2074 DeleteChannel(channel); | 2104 DeleteChannel(channel); |
2075 return false; | 2105 return false; |
2076 } | 2106 } |
2077 | 2107 |
2078 // Save the channel to send_channels_, so that RemoveSendStream() can still | 2108 // Save the channel to send_streams_, so that RemoveSendStream() can still |
2079 // delete the channel in case failure happens below. | 2109 // delete the channel in case failure happens below. |
2080 webrtc::AudioTransport* audio_transport = | 2110 webrtc::AudioTransport* audio_transport = |
2081 engine()->voe()->base()->audio_transport(); | 2111 engine()->voe()->base()->audio_transport(); |
2082 send_channels_.insert( | 2112 send_streams_.insert( |
2083 std::make_pair(ssrc, | 2113 std::make_pair(ssrc, |
2084 new WebRtcVoiceChannelRenderer(channel, audio_transport))); | 2114 new WebRtcAudioSendStream(channel, audio_transport, ssrc, call_))); |
2085 | 2115 |
2086 // Set the current codecs to be used for the new channel. We need to do this | 2116 // Set the current codecs to be used for the new channel. We need to do this |
2087 // after adding the channel to send_channels_, because of how max bitrate is | 2117 // after adding the channel to send_channels_, because of how max bitrate is |
2088 // currently being configured by SetSendCodec(). | 2118 // currently being configured by SetSendCodec(). |
2089 if (!send_codecs_.empty() && !SetSendCodecs(channel, send_codecs_)) { | 2119 if (!send_codecs_.empty() && !SetSendCodecs(channel, send_codecs_)) { |
2090 RemoveSendStream(ssrc); | 2120 RemoveSendStream(ssrc); |
2091 return false; | 2121 return false; |
2092 } | 2122 } |
2093 | 2123 |
2094 // At this point the channel's local SSRC has been updated. If the channel is | 2124 // At this point the channel's local SSRC has been updated. If the channel is |
2095 // the first send channel make sure that all the receive channels are updated | 2125 // the first send channel make sure that all the receive channels are updated |
2096 // with the same SSRC in order to send receiver reports. | 2126 // with the same SSRC in order to send receiver reports. |
2097 if (send_channels_.size() == 1) { | 2127 if (send_streams_.size() == 1) { |
2098 receiver_reports_ssrc_ = ssrc; | 2128 receiver_reports_ssrc_ = ssrc; |
2099 for (const auto& ch : receive_channels_) { | 2129 for (const auto& ch : receive_channels_) { |
2100 int recv_channel = ch.second->channel(); | 2130 int recv_channel = ch.second->channel(); |
2101 if (engine()->voe()->rtp()->SetLocalSSRC(recv_channel, ssrc) != 0) { | 2131 if (engine()->voe()->rtp()->SetLocalSSRC(recv_channel, ssrc) != 0) { |
2102 LOG_RTCERR2(SetLocalSSRC, ch.second->channel(), ssrc); | 2132 LOG_RTCERR2(SetLocalSSRC, ch.second->channel(), ssrc); |
2103 return false; | 2133 return false; |
2104 } | 2134 } |
2105 engine()->voe()->base()->AssociateSendChannel(recv_channel, channel); | 2135 engine()->voe()->base()->AssociateSendChannel(recv_channel, channel); |
2106 LOG(LS_INFO) << "VoiceEngine channel #" << recv_channel | 2136 LOG(LS_INFO) << "VoiceEngine channel #" << recv_channel |
2107 << " is associated with channel #" << channel << "."; | 2137 << " is associated with channel #" << channel << "."; |
2108 } | 2138 } |
2109 } | 2139 } |
2110 | 2140 |
2111 return ChangeSend(channel, desired_send_); | 2141 return ChangeSend(channel, desired_send_); |
2112 } | 2142 } |
2113 | 2143 |
2114 bool WebRtcVoiceMediaChannel::RemoveSendStream(uint32_t ssrc) { | 2144 bool WebRtcVoiceMediaChannel::RemoveSendStream(uint32_t ssrc) { |
2115 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 2145 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
2116 ChannelMap::iterator it = send_channels_.find(ssrc); | 2146 auto it = send_streams_.find(ssrc); |
2117 if (it == send_channels_.end()) { | 2147 if (it == send_streams_.end()) { |
2118 LOG(LS_WARNING) << "Try to remove stream with ssrc " << ssrc | 2148 LOG(LS_WARNING) << "Try to remove stream with ssrc " << ssrc |
2119 << " which doesn't exist."; | 2149 << " which doesn't exist."; |
2120 return false; | 2150 return false; |
2121 } | 2151 } |
2122 | 2152 |
2123 int channel = it->second->channel(); | 2153 int channel = it->second->channel(); |
2124 ChangeSend(channel, SEND_NOTHING); | 2154 ChangeSend(channel, SEND_NOTHING); |
2125 | 2155 |
2126 // Delete the WebRtcVoiceChannelRenderer object connected to the channel, | 2156 // Delete the WebRtcVoiceChannelRenderer object connected to the channel, |
2127 // this will disconnect the audio renderer with the send channel. | 2157 // this will disconnect the audio renderer with the send channel. |
2128 delete it->second; | 2158 delete it->second; |
2129 send_channels_.erase(it); | 2159 send_streams_.erase(it); |
2130 | 2160 |
2131 // Clean up and delete the send channel. | 2161 // Clean up and delete the send channel. |
2132 LOG(LS_INFO) << "Removing audio send stream " << ssrc | 2162 LOG(LS_INFO) << "Removing audio send stream " << ssrc |
2133 << " with VoiceEngine channel #" << channel << "."; | 2163 << " with VoiceEngine channel #" << channel << "."; |
2134 if (!DeleteChannel(channel)) { | 2164 if (!DeleteChannel(channel)) { |
2135 return false; | 2165 return false; |
2136 } | 2166 } |
2137 if (send_channels_.empty()) { | 2167 if (send_streams_.empty()) { |
2138 ChangeSend(SEND_NOTHING); | 2168 ChangeSend(SEND_NOTHING); |
2139 } | 2169 } |
2140 return true; | 2170 return true; |
2141 } | 2171 } |
2142 | 2172 |
2143 bool WebRtcVoiceMediaChannel::AddRecvStream(const StreamParams& sp) { | 2173 bool WebRtcVoiceMediaChannel::AddRecvStream(const StreamParams& sp) { |
2144 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 2174 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
2145 LOG(LS_INFO) << "AddRecvStream: " << sp.ToString(); | 2175 LOG(LS_INFO) << "AddRecvStream: " << sp.ToString(); |
2146 | 2176 |
2147 if (!ValidateStreamParams(sp)) { | 2177 if (!ValidateStreamParams(sp)) { |
(...skipping 21 matching lines...) Expand all Loading... |
2169 // Create a new channel for receiving audio data. | 2199 // Create a new channel for receiving audio data. |
2170 int channel = CreateVoEChannel(); | 2200 int channel = CreateVoEChannel(); |
2171 if (channel == -1) { | 2201 if (channel == -1) { |
2172 return false; | 2202 return false; |
2173 } | 2203 } |
2174 if (!ConfigureRecvChannel(channel)) { | 2204 if (!ConfigureRecvChannel(channel)) { |
2175 DeleteChannel(channel); | 2205 DeleteChannel(channel); |
2176 return false; | 2206 return false; |
2177 } | 2207 } |
2178 | 2208 |
2179 webrtc::AudioTransport* audio_transport = | 2209 WebRtcAudioReceiveStream* stream = new WebRtcAudioReceiveStream(channel); |
2180 engine()->voe()->base()->audio_transport(); | 2210 receive_channels_.insert(std::make_pair(ssrc, stream)); |
2181 WebRtcVoiceChannelRenderer* channel_renderer = | |
2182 new WebRtcVoiceChannelRenderer(channel, audio_transport); | |
2183 receive_channels_.insert(std::make_pair(ssrc, channel_renderer)); | |
2184 receive_stream_params_[ssrc] = sp; | 2211 receive_stream_params_[ssrc] = sp; |
2185 AddAudioReceiveStream(ssrc); | 2212 AddAudioReceiveStream(ssrc); |
2186 | 2213 |
2187 LOG(LS_INFO) << "New audio stream " << ssrc | 2214 LOG(LS_INFO) << "New audio stream " << ssrc |
2188 << " registered to VoiceEngine channel #" | 2215 << " registered to VoiceEngine channel #" |
2189 << channel << "."; | 2216 << channel << "."; |
2190 return true; | 2217 return true; |
2191 } | 2218 } |
2192 | 2219 |
2193 bool WebRtcVoiceMediaChannel::ConfigureRecvChannel(int channel) { | 2220 bool WebRtcVoiceMediaChannel::ConfigureRecvChannel(int channel) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2242 } | 2269 } |
2243 | 2270 |
2244 SetPlayout(channel, playout_); | 2271 SetPlayout(channel, playout_); |
2245 return true; | 2272 return true; |
2246 } | 2273 } |
2247 | 2274 |
2248 bool WebRtcVoiceMediaChannel::RemoveRecvStream(uint32_t ssrc) { | 2275 bool WebRtcVoiceMediaChannel::RemoveRecvStream(uint32_t ssrc) { |
2249 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 2276 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
2250 LOG(LS_INFO) << "RemoveRecvStream: " << ssrc; | 2277 LOG(LS_INFO) << "RemoveRecvStream: " << ssrc; |
2251 | 2278 |
2252 ChannelMap::iterator it = receive_channels_.find(ssrc); | 2279 auto it = receive_channels_.find(ssrc); |
2253 if (it == receive_channels_.end()) { | 2280 if (it == receive_channels_.end()) { |
2254 LOG(LS_WARNING) << "Try to remove stream with ssrc " << ssrc | 2281 LOG(LS_WARNING) << "Try to remove stream with ssrc " << ssrc |
2255 << " which doesn't exist."; | 2282 << " which doesn't exist."; |
2256 return false; | 2283 return false; |
2257 } | 2284 } |
2258 | 2285 |
2259 RemoveAudioReceiveStream(ssrc); | 2286 RemoveAudioReceiveStream(ssrc); |
2260 receive_stream_params_.erase(ssrc); | 2287 receive_stream_params_.erase(ssrc); |
2261 | 2288 |
2262 // Delete the WebRtcVoiceChannelRenderer object connected to the channel, this | |
2263 // will disconnect the audio renderer with the receive channel. | |
2264 // Cache the channel before the deletion. | |
2265 const int channel = it->second->channel(); | 2289 const int channel = it->second->channel(); |
2266 delete it->second; | 2290 delete it->second; |
2267 receive_channels_.erase(it); | 2291 receive_channels_.erase(it); |
2268 | 2292 |
2269 // Deregister default channel, if that's the one being destroyed. | 2293 // Deregister default channel, if that's the one being destroyed. |
2270 if (IsDefaultRecvStream(ssrc)) { | 2294 if (IsDefaultRecvStream(ssrc)) { |
2271 default_recv_ssrc_ = -1; | 2295 default_recv_ssrc_ = -1; |
2272 } | 2296 } |
2273 | 2297 |
2274 LOG(LS_INFO) << "Removing audio stream " << ssrc | 2298 LOG(LS_INFO) << "Removing audio stream " << ssrc |
2275 << " with VoiceEngine channel #" << channel << "."; | 2299 << " with VoiceEngine channel #" << channel << "."; |
2276 return DeleteChannel(channel); | 2300 return DeleteChannel(channel); |
2277 } | 2301 } |
2278 | 2302 |
2279 bool WebRtcVoiceMediaChannel::SetLocalRenderer(uint32_t ssrc, | 2303 bool WebRtcVoiceMediaChannel::SetLocalRenderer(uint32_t ssrc, |
2280 AudioRenderer* renderer) { | 2304 AudioRenderer* renderer) { |
2281 ChannelMap::iterator it = send_channels_.find(ssrc); | 2305 auto it = send_streams_.find(ssrc); |
2282 if (it == send_channels_.end()) { | 2306 if (it == send_streams_.end()) { |
2283 if (renderer) { | 2307 if (renderer) { |
2284 // Return an error if trying to set a valid renderer with an invalid ssrc. | 2308 // Return an error if trying to set a valid renderer with an invalid ssrc. |
2285 LOG(LS_ERROR) << "SetLocalRenderer failed with ssrc "<< ssrc; | 2309 LOG(LS_ERROR) << "SetLocalRenderer failed with ssrc "<< ssrc; |
2286 return false; | 2310 return false; |
2287 } | 2311 } |
2288 | 2312 |
2289 // The channel likely has gone away, do nothing. | 2313 // The channel likely has gone away, do nothing. |
2290 return true; | 2314 return true; |
2291 } | 2315 } |
2292 | 2316 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2381 int flags) { | 2405 int flags) { |
2382 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 2406 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
2383 if (!dtmf_allowed_) { | 2407 if (!dtmf_allowed_) { |
2384 return false; | 2408 return false; |
2385 } | 2409 } |
2386 | 2410 |
2387 // Send the event. | 2411 // Send the event. |
2388 if (flags & cricket::DF_SEND) { | 2412 if (flags & cricket::DF_SEND) { |
2389 int channel = -1; | 2413 int channel = -1; |
2390 if (ssrc == 0) { | 2414 if (ssrc == 0) { |
2391 if (send_channels_.size() > 0) { | 2415 if (send_streams_.size() > 0) { |
2392 channel = send_channels_.begin()->second->channel(); | 2416 channel = send_streams_.begin()->second->channel(); |
2393 } | 2417 } |
2394 } else { | 2418 } else { |
2395 channel = GetSendChannelId(ssrc); | 2419 channel = GetSendChannelId(ssrc); |
2396 } | 2420 } |
2397 if (channel == -1) { | 2421 if (channel == -1) { |
2398 LOG(LS_WARNING) << "InsertDtmf - The specified ssrc " | 2422 LOG(LS_WARNING) << "InsertDtmf - The specified ssrc " |
2399 << ssrc << " is not in use."; | 2423 << ssrc << " is not in use."; |
2400 return false; | 2424 return false; |
2401 } | 2425 } |
2402 // Send DTMF using out-of-band DTMF. ("true", as 3rd arg) | 2426 // Send DTMF using out-of-band DTMF. ("true", as 3rd arg) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2492 int recv_channel_id = GetReceiveChannelId(ssrc); | 2516 int recv_channel_id = GetReceiveChannelId(ssrc); |
2493 if (recv_channel_id != -1) { | 2517 if (recv_channel_id != -1) { |
2494 engine()->voe()->network()->ReceivedRTCPPacket( | 2518 engine()->voe()->network()->ReceivedRTCPPacket( |
2495 recv_channel_id, packet->data(), packet->size()); | 2519 recv_channel_id, packet->data(), packet->size()); |
2496 } | 2520 } |
2497 } | 2521 } |
2498 | 2522 |
2499 // SR may continue RR and any RR entry may correspond to any one of the send | 2523 // SR may continue RR and any RR entry may correspond to any one of the send |
2500 // channels. So all RTCP packets must be forwarded all send channels. VoE | 2524 // channels. So all RTCP packets must be forwarded all send channels. VoE |
2501 // will filter out RR internally. | 2525 // will filter out RR internally. |
2502 for (const auto& ch : send_channels_) { | 2526 for (const auto& ch : send_streams_) { |
2503 engine()->voe()->network()->ReceivedRTCPPacket( | 2527 engine()->voe()->network()->ReceivedRTCPPacket( |
2504 ch.second->channel(), packet->data(), packet->size()); | 2528 ch.second->channel(), packet->data(), packet->size()); |
2505 } | 2529 } |
2506 } | 2530 } |
2507 | 2531 |
2508 bool WebRtcVoiceMediaChannel::MuteStream(uint32_t ssrc, bool muted) { | 2532 bool WebRtcVoiceMediaChannel::MuteStream(uint32_t ssrc, bool muted) { |
2509 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 2533 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
2510 int channel = GetSendChannelId(ssrc); | 2534 int channel = GetSendChannelId(ssrc); |
2511 if (channel == -1) { | 2535 if (channel == -1) { |
2512 LOG(LS_WARNING) << "The specified ssrc " << ssrc << " is not in use."; | 2536 LOG(LS_WARNING) << "The specified ssrc " << ssrc << " is not in use."; |
2513 return false; | 2537 return false; |
2514 } | 2538 } |
2515 if (engine()->voe()->volume()->SetInputMute(channel, muted) == -1) { | 2539 if (engine()->voe()->volume()->SetInputMute(channel, muted) == -1) { |
2516 LOG_RTCERR2(SetInputMute, channel, muted); | 2540 LOG_RTCERR2(SetInputMute, channel, muted); |
2517 return false; | 2541 return false; |
2518 } | 2542 } |
2519 // We set the AGC to mute state only when all the channels are muted. | 2543 // We set the AGC to mute state only when all the channels are muted. |
2520 // This implementation is not ideal, instead we should signal the AGC when | 2544 // This implementation is not ideal, instead we should signal the AGC when |
2521 // the mic channel is muted/unmuted. We can't do it today because there | 2545 // the mic channel is muted/unmuted. We can't do it today because there |
2522 // is no good way to know which stream is mapping to the mic channel. | 2546 // is no good way to know which stream is mapping to the mic channel. |
2523 bool all_muted = muted; | 2547 bool all_muted = muted; |
2524 for (const auto& ch : send_channels_) { | 2548 for (const auto& ch : send_streams_) { |
2525 if (!all_muted) { | 2549 if (!all_muted) { |
2526 break; | 2550 break; |
2527 } | 2551 } |
2528 if (engine()->voe()->volume()->GetInputMute(ch.second->channel(), | 2552 if (engine()->voe()->volume()->GetInputMute(ch.second->channel(), |
2529 all_muted)) { | 2553 all_muted)) { |
2530 LOG_RTCERR1(GetInputMute, ch.second->channel()); | 2554 LOG_RTCERR1(GetInputMute, ch.second->channel()); |
2531 return false; | 2555 return false; |
2532 } | 2556 } |
2533 } | 2557 } |
2534 | 2558 |
(...skipping 28 matching lines...) Expand all Loading... |
2563 // SetMaxSendBandwith(0), the second call removes the previous limit. | 2587 // SetMaxSendBandwith(0), the second call removes the previous limit. |
2564 if (bps <= 0) | 2588 if (bps <= 0) |
2565 return true; | 2589 return true; |
2566 | 2590 |
2567 webrtc::CodecInst codec = *send_codec_; | 2591 webrtc::CodecInst codec = *send_codec_; |
2568 bool is_multi_rate = IsCodecMultiRate(codec); | 2592 bool is_multi_rate = IsCodecMultiRate(codec); |
2569 | 2593 |
2570 if (is_multi_rate) { | 2594 if (is_multi_rate) { |
2571 // If codec is multi-rate then just set the bitrate. | 2595 // If codec is multi-rate then just set the bitrate. |
2572 codec.rate = bps; | 2596 codec.rate = bps; |
2573 for (const auto& ch : send_channels_) { | 2597 for (const auto& ch : send_streams_) { |
2574 if (!SetSendCodec(ch.second->channel(), codec)) { | 2598 if (!SetSendCodec(ch.second->channel(), codec)) { |
2575 LOG(LS_INFO) << "Failed to set codec " << codec.plname | 2599 LOG(LS_INFO) << "Failed to set codec " << codec.plname |
2576 << " to bitrate " << bps << " bps."; | 2600 << " to bitrate " << bps << " bps."; |
2577 return false; | 2601 return false; |
2578 } | 2602 } |
2579 } | 2603 } |
2580 return true; | 2604 return true; |
2581 } else { | 2605 } else { |
2582 // If codec is not multi-rate and |bps| is less than the fixed bitrate | 2606 // If codec is not multi-rate and |bps| is less than the fixed bitrate |
2583 // then fail. If codec is not multi-rate and |bps| exceeds or equal the | 2607 // then fail. If codec is not multi-rate and |bps| exceeds or equal the |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2623 echo_delay_median_ms = median; | 2647 echo_delay_median_ms = median; |
2624 echo_delay_std_ms = std; | 2648 echo_delay_std_ms = std; |
2625 } | 2649 } |
2626 } | 2650 } |
2627 | 2651 |
2628 webrtc::CallStatistics cs; | 2652 webrtc::CallStatistics cs; |
2629 unsigned int ssrc; | 2653 unsigned int ssrc; |
2630 webrtc::CodecInst codec; | 2654 webrtc::CodecInst codec; |
2631 unsigned int level; | 2655 unsigned int level; |
2632 | 2656 |
2633 for (const auto& ch : send_channels_) { | 2657 for (const auto& ch : send_streams_) { |
2634 const int channel = ch.second->channel(); | 2658 const int channel = ch.second->channel(); |
2635 | 2659 |
2636 // Fill in the sender info, based on what we know, and what the | 2660 // Fill in the sender info, based on what we know, and what the |
2637 // remote side told us it got from its RTCP report. | 2661 // remote side told us it got from its RTCP report. |
2638 VoiceSenderInfo sinfo; | 2662 VoiceSenderInfo sinfo; |
2639 | 2663 |
2640 if (engine()->voe()->rtp()->GetRTCPStatistics(channel, cs) == -1 || | 2664 if (engine()->voe()->rtp()->GetRTCPStatistics(channel, cs) == -1 || |
2641 engine()->voe()->rtp()->GetLocalSSRC(channel, ssrc) == -1) { | 2665 engine()->voe()->rtp()->GetLocalSSRC(channel, ssrc) == -1) { |
2642 continue; | 2666 continue; |
2643 } | 2667 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2784 } | 2808 } |
2785 | 2809 |
2786 int WebRtcVoiceMediaChannel::GetOutputLevel(int channel) { | 2810 int WebRtcVoiceMediaChannel::GetOutputLevel(int channel) { |
2787 unsigned int ulevel = 0; | 2811 unsigned int ulevel = 0; |
2788 int ret = engine()->voe()->volume()->GetSpeechOutputLevel(channel, ulevel); | 2812 int ret = engine()->voe()->volume()->GetSpeechOutputLevel(channel, ulevel); |
2789 return (ret == 0) ? static_cast<int>(ulevel) : -1; | 2813 return (ret == 0) ? static_cast<int>(ulevel) : -1; |
2790 } | 2814 } |
2791 | 2815 |
2792 int WebRtcVoiceMediaChannel::GetReceiveChannelId(uint32_t ssrc) const { | 2816 int WebRtcVoiceMediaChannel::GetReceiveChannelId(uint32_t ssrc) const { |
2793 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 2817 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
2794 ChannelMap::const_iterator it = receive_channels_.find(ssrc); | 2818 const auto it = receive_channels_.find(ssrc); |
2795 if (it != receive_channels_.end()) { | 2819 if (it != receive_channels_.end()) { |
2796 return it->second->channel(); | 2820 return it->second->channel(); |
2797 } | 2821 } |
2798 return -1; | 2822 return -1; |
2799 } | 2823 } |
2800 | 2824 |
2801 int WebRtcVoiceMediaChannel::GetSendChannelId(uint32_t ssrc) const { | 2825 int WebRtcVoiceMediaChannel::GetSendChannelId(uint32_t ssrc) const { |
2802 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 2826 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
2803 ChannelMap::const_iterator it = send_channels_.find(ssrc); | 2827 const auto it = send_streams_.find(ssrc); |
2804 if (it != send_channels_.end()) { | 2828 if (it != send_streams_.end()) { |
2805 return it->second->channel(); | 2829 return it->second->channel(); |
2806 } | 2830 } |
2807 return -1; | 2831 return -1; |
2808 } | 2832 } |
2809 | 2833 |
2810 bool WebRtcVoiceMediaChannel::GetRedSendCodec(const AudioCodec& red_codec, | 2834 bool WebRtcVoiceMediaChannel::GetRedSendCodec(const AudioCodec& red_codec, |
2811 const std::vector<AudioCodec>& all_codecs, webrtc::CodecInst* send_codec) { | 2835 const std::vector<AudioCodec>& all_codecs, webrtc::CodecInst* send_codec) { |
2812 // Get the RED encodings from the parameter with no name. This may | 2836 // Get the RED encodings from the parameter with no name. This may |
2813 // change based on what is discussed on the Jingle list. | 2837 // change based on what is discussed on the Jingle list. |
2814 // The encoding parameter is of the form "a/b"; we only support where | 2838 // The encoding parameter is of the form "a/b"; we only support where |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2920 for (const auto& it : receive_channels_) { | 2944 for (const auto& it : receive_channels_) { |
2921 RemoveAudioReceiveStream(it.first); | 2945 RemoveAudioReceiveStream(it.first); |
2922 } | 2946 } |
2923 for (const auto& it : receive_channels_) { | 2947 for (const auto& it : receive_channels_) { |
2924 AddAudioReceiveStream(it.first); | 2948 AddAudioReceiveStream(it.first); |
2925 } | 2949 } |
2926 } | 2950 } |
2927 | 2951 |
2928 void WebRtcVoiceMediaChannel::AddAudioReceiveStream(uint32_t ssrc) { | 2952 void WebRtcVoiceMediaChannel::AddAudioReceiveStream(uint32_t ssrc) { |
2929 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 2953 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
2930 WebRtcVoiceChannelRenderer* channel = receive_channels_[ssrc]; | 2954 WebRtcAudioReceiveStream* stream = receive_channels_[ssrc]; |
2931 RTC_DCHECK(channel != nullptr); | 2955 RTC_DCHECK(stream != nullptr); |
2932 RTC_DCHECK(receive_streams_.find(ssrc) == receive_streams_.end()); | 2956 RTC_DCHECK(receive_streams_.find(ssrc) == receive_streams_.end()); |
2933 webrtc::AudioReceiveStream::Config config; | 2957 webrtc::AudioReceiveStream::Config config; |
2934 config.rtp.remote_ssrc = ssrc; | 2958 config.rtp.remote_ssrc = ssrc; |
2935 // Only add RTP extensions if we support combined A/V BWE. | 2959 // Only add RTP extensions if we support combined A/V BWE. |
2936 config.rtp.extensions = recv_rtp_extensions_; | 2960 config.rtp.extensions = recv_rtp_extensions_; |
2937 config.combined_audio_video_bwe = | 2961 config.combined_audio_video_bwe = |
2938 options_.combined_audio_video_bwe.GetWithDefaultIfUnset(false); | 2962 options_.combined_audio_video_bwe.GetWithDefaultIfUnset(false); |
2939 config.voe_channel_id = channel->channel(); | 2963 config.voe_channel_id = stream->channel(); |
2940 config.sync_group = receive_stream_params_[ssrc].sync_label; | 2964 config.sync_group = receive_stream_params_[ssrc].sync_label; |
2941 webrtc::AudioReceiveStream* s = call_->CreateAudioReceiveStream(config); | 2965 webrtc::AudioReceiveStream* s = call_->CreateAudioReceiveStream(config); |
2942 receive_streams_.insert(std::make_pair(ssrc, s)); | 2966 receive_streams_.insert(std::make_pair(ssrc, s)); |
2943 } | 2967 } |
2944 | 2968 |
2945 void WebRtcVoiceMediaChannel::RemoveAudioReceiveStream(uint32_t ssrc) { | 2969 void WebRtcVoiceMediaChannel::RemoveAudioReceiveStream(uint32_t ssrc) { |
2946 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 2970 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
2947 auto stream_it = receive_streams_.find(ssrc); | 2971 auto stream_it = receive_streams_.find(ssrc); |
2948 if (stream_it != receive_streams_.end()) { | 2972 if (stream_it != receive_streams_.end()) { |
2949 call_->DestroyAudioReceiveStream(stream_it->second); | 2973 call_->DestroyAudioReceiveStream(stream_it->second); |
(...skipping 21 matching lines...) Expand all Loading... |
2971 LOG(LS_WARNING) << "Unknown codec " << ToString(codec); | 2995 LOG(LS_WARNING) << "Unknown codec " << ToString(codec); |
2972 return false; | 2996 return false; |
2973 } | 2997 } |
2974 } | 2998 } |
2975 return true; | 2999 return true; |
2976 } | 3000 } |
2977 | 3001 |
2978 } // namespace cricket | 3002 } // namespace cricket |
2979 | 3003 |
2980 #endif // HAVE_WEBRTC_VOICE | 3004 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |