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