| 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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 StopMediaMonitor(); | 1294 StopMediaMonitor(); |
| 1295 // this can't be done in the base class, since it calls a virtual | 1295 // this can't be done in the base class, since it calls a virtual |
| 1296 DisableMedia_w(); | 1296 DisableMedia_w(); |
| 1297 Deinit(); | 1297 Deinit(); |
| 1298 } | 1298 } |
| 1299 | 1299 |
| 1300 bool VoiceChannel::Init() { | 1300 bool VoiceChannel::Init() { |
| 1301 if (!BaseChannel::Init()) { | 1301 if (!BaseChannel::Init()) { |
| 1302 return false; | 1302 return false; |
| 1303 } | 1303 } |
| 1304 media_channel()->SignalMediaError.connect( | |
| 1305 this, &VoiceChannel::OnVoiceChannelError); | |
| 1306 srtp_filter()->SignalSrtpError.connect( | |
| 1307 this, &VoiceChannel::OnSrtpError); | |
| 1308 return true; | 1304 return true; |
| 1309 } | 1305 } |
| 1310 | 1306 |
| 1311 bool VoiceChannel::SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer) { | 1307 bool VoiceChannel::SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer) { |
| 1312 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetRemoteRenderer, | 1308 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetRemoteRenderer, |
| 1313 media_channel(), ssrc, renderer)); | 1309 media_channel(), ssrc, renderer)); |
| 1314 } | 1310 } |
| 1315 | 1311 |
| 1316 bool VoiceChannel::SetAudioSend(uint32 ssrc, | 1312 bool VoiceChannel::SetAudioSend(uint32 ssrc, |
| 1317 bool enable, | 1313 bool enable, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 // media, this will disable the timeout. | 1419 // media, this will disable the timeout. |
| 1424 if (!received_media_ && !PacketIsRtcp(channel, data, len)) { | 1420 if (!received_media_ && !PacketIsRtcp(channel, data, len)) { |
| 1425 received_media_ = true; | 1421 received_media_ = true; |
| 1426 } | 1422 } |
| 1427 } | 1423 } |
| 1428 | 1424 |
| 1429 void VoiceChannel::ChangeState() { | 1425 void VoiceChannel::ChangeState() { |
| 1430 // Render incoming data if we're the active call, and we have the local | 1426 // Render incoming data if we're the active call, and we have the local |
| 1431 // content. We receive data on the default channel and multiplexed streams. | 1427 // content. We receive data on the default channel and multiplexed streams. |
| 1432 bool recv = IsReadyToReceive(); | 1428 bool recv = IsReadyToReceive(); |
| 1433 if (!media_channel()->SetPlayout(recv)) { | 1429 media_channel()->SetPlayout(recv); |
| 1434 SendLastMediaError(); | |
| 1435 } | |
| 1436 | 1430 |
| 1437 // Send outgoing data if we're the active call, we have the remote content, | 1431 // Send outgoing data if we're the active call, we have the remote content, |
| 1438 // and we have had some form of connectivity. | 1432 // and we have had some form of connectivity. |
| 1439 bool send = IsReadyToSend(); | 1433 bool send = IsReadyToSend(); |
| 1440 SendFlags send_flag = send ? SEND_MICROPHONE : SEND_NOTHING; | 1434 SendFlags send_flag = send ? SEND_MICROPHONE : SEND_NOTHING; |
| 1441 if (!media_channel()->SetSend(send_flag)) { | 1435 if (!media_channel()->SetSend(send_flag)) { |
| 1442 LOG(LS_ERROR) << "Failed to SetSend " << send_flag << " on voice channel"; | 1436 LOG(LS_ERROR) << "Failed to SetSend " << send_flag << " on voice channel"; |
| 1443 SendLastMediaError(); | |
| 1444 } | 1437 } |
| 1445 | 1438 |
| 1446 LOG(LS_INFO) << "Changing voice state, recv=" << recv << " send=" << send; | 1439 LOG(LS_INFO) << "Changing voice state, recv=" << recv << " send=" << send; |
| 1447 } | 1440 } |
| 1448 | 1441 |
| 1449 const ContentInfo* VoiceChannel::GetFirstContent( | 1442 const ContentInfo* VoiceChannel::GetFirstContent( |
| 1450 const SessionDescription* sdesc) { | 1443 const SessionDescription* sdesc) { |
| 1451 return GetFirstAudioContent(sdesc); | 1444 return GetFirstAudioContent(sdesc); |
| 1452 } | 1445 } |
| 1453 | 1446 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 } | 1557 } |
| 1565 | 1558 |
| 1566 void VoiceChannel::OnMessage(rtc::Message *pmsg) { | 1559 void VoiceChannel::OnMessage(rtc::Message *pmsg) { |
| 1567 switch (pmsg->message_id) { | 1560 switch (pmsg->message_id) { |
| 1568 case MSG_EARLYMEDIATIMEOUT: | 1561 case MSG_EARLYMEDIATIMEOUT: |
| 1569 HandleEarlyMediaTimeout(); | 1562 HandleEarlyMediaTimeout(); |
| 1570 break; | 1563 break; |
| 1571 case MSG_CHANNEL_ERROR: { | 1564 case MSG_CHANNEL_ERROR: { |
| 1572 VoiceChannelErrorMessageData* data = | 1565 VoiceChannelErrorMessageData* data = |
| 1573 static_cast<VoiceChannelErrorMessageData*>(pmsg->pdata); | 1566 static_cast<VoiceChannelErrorMessageData*>(pmsg->pdata); |
| 1574 SignalMediaError(this, data->ssrc, data->error); | |
| 1575 delete data; | 1567 delete data; |
| 1576 break; | 1568 break; |
| 1577 } | 1569 } |
| 1578 default: | 1570 default: |
| 1579 BaseChannel::OnMessage(pmsg); | 1571 BaseChannel::OnMessage(pmsg); |
| 1580 break; | 1572 break; |
| 1581 } | 1573 } |
| 1582 } | 1574 } |
| 1583 | 1575 |
| 1584 void VoiceChannel::OnConnectionMonitorUpdate( | 1576 void VoiceChannel::OnConnectionMonitorUpdate( |
| 1585 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos) { | 1577 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos) { |
| 1586 SignalConnectionMonitor(this, infos); | 1578 SignalConnectionMonitor(this, infos); |
| 1587 } | 1579 } |
| 1588 | 1580 |
| 1589 void VoiceChannel::OnMediaMonitorUpdate( | 1581 void VoiceChannel::OnMediaMonitorUpdate( |
| 1590 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info) { | 1582 VoiceMediaChannel* media_channel, const VoiceMediaInfo& info) { |
| 1591 ASSERT(media_channel == this->media_channel()); | 1583 ASSERT(media_channel == this->media_channel()); |
| 1592 SignalMediaMonitor(this, info); | 1584 SignalMediaMonitor(this, info); |
| 1593 } | 1585 } |
| 1594 | 1586 |
| 1595 void VoiceChannel::OnAudioMonitorUpdate(AudioMonitor* monitor, | 1587 void VoiceChannel::OnAudioMonitorUpdate(AudioMonitor* monitor, |
| 1596 const AudioInfo& info) { | 1588 const AudioInfo& info) { |
| 1597 SignalAudioMonitor(this, info); | 1589 SignalAudioMonitor(this, info); |
| 1598 } | 1590 } |
| 1599 | 1591 |
| 1600 void VoiceChannel::OnVoiceChannelError( | |
| 1601 uint32 ssrc, VoiceMediaChannel::Error err) { | |
| 1602 VoiceChannelErrorMessageData* data = new VoiceChannelErrorMessageData( | |
| 1603 ssrc, err); | |
| 1604 signaling_thread()->Post(this, MSG_CHANNEL_ERROR, data); | |
| 1605 } | |
| 1606 | |
| 1607 void VoiceChannel::OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, | |
| 1608 SrtpFilter::Error error) { | |
| 1609 switch (error) { | |
| 1610 case SrtpFilter::ERROR_FAIL: | |
| 1611 OnVoiceChannelError(ssrc, (mode == SrtpFilter::PROTECT) ? | |
| 1612 VoiceMediaChannel::ERROR_REC_SRTP_ERROR : | |
| 1613 VoiceMediaChannel::ERROR_PLAY_SRTP_ERROR); | |
| 1614 break; | |
| 1615 case SrtpFilter::ERROR_AUTH: | |
| 1616 OnVoiceChannelError(ssrc, (mode == SrtpFilter::PROTECT) ? | |
| 1617 VoiceMediaChannel::ERROR_REC_SRTP_AUTH_FAILED : | |
| 1618 VoiceMediaChannel::ERROR_PLAY_SRTP_AUTH_FAILED); | |
| 1619 break; | |
| 1620 case SrtpFilter::ERROR_REPLAY: | |
| 1621 // Only receving channel should have this error. | |
| 1622 ASSERT(mode == SrtpFilter::UNPROTECT); | |
| 1623 OnVoiceChannelError(ssrc, VoiceMediaChannel::ERROR_PLAY_SRTP_REPLAY); | |
| 1624 break; | |
| 1625 default: | |
| 1626 break; | |
| 1627 } | |
| 1628 } | |
| 1629 | |
| 1630 void VoiceChannel::GetSrtpCryptoSuiteNames( | 1592 void VoiceChannel::GetSrtpCryptoSuiteNames( |
| 1631 std::vector<std::string>* ciphers) const { | 1593 std::vector<std::string>* ciphers) const { |
| 1632 GetSupportedAudioCryptoSuites(ciphers); | 1594 GetSupportedAudioCryptoSuites(ciphers); |
| 1633 } | 1595 } |
| 1634 | 1596 |
| 1635 VideoChannel::VideoChannel(rtc::Thread* thread, | 1597 VideoChannel::VideoChannel(rtc::Thread* thread, |
| 1636 VideoMediaChannel* media_channel, | 1598 VideoMediaChannel* media_channel, |
| 1637 TransportController* transport_controller, | 1599 TransportController* transport_controller, |
| 1638 const std::string& content_name, | 1600 const std::string& content_name, |
| 1639 bool rtcp) | 1601 bool rtcp) |
| 1640 : BaseChannel(thread, | 1602 : BaseChannel(thread, |
| 1641 media_channel, | 1603 media_channel, |
| 1642 transport_controller, | 1604 transport_controller, |
| 1643 content_name, | 1605 content_name, |
| 1644 rtcp), | 1606 rtcp), |
| 1645 renderer_(NULL), | 1607 renderer_(NULL), |
| 1646 previous_we_(rtc::WE_CLOSE) {} | 1608 previous_we_(rtc::WE_CLOSE) {} |
| 1647 | 1609 |
| 1648 bool VideoChannel::Init() { | 1610 bool VideoChannel::Init() { |
| 1649 if (!BaseChannel::Init()) { | 1611 if (!BaseChannel::Init()) { |
| 1650 return false; | 1612 return false; |
| 1651 } | 1613 } |
| 1652 media_channel()->SignalMediaError.connect( | |
| 1653 this, &VideoChannel::OnVideoChannelError); | |
| 1654 srtp_filter()->SignalSrtpError.connect( | |
| 1655 this, &VideoChannel::OnSrtpError); | |
| 1656 return true; | 1614 return true; |
| 1657 } | 1615 } |
| 1658 | 1616 |
| 1659 void VoiceChannel::SendLastMediaError() { | |
| 1660 uint32 ssrc; | |
| 1661 VoiceMediaChannel::Error error; | |
| 1662 media_channel()->GetLastMediaError(&ssrc, &error); | |
| 1663 SignalMediaError(this, ssrc, error); | |
| 1664 } | |
| 1665 | |
| 1666 VideoChannel::~VideoChannel() { | 1617 VideoChannel::~VideoChannel() { |
| 1667 std::vector<uint32> screencast_ssrcs; | 1618 std::vector<uint32> screencast_ssrcs; |
| 1668 ScreencastMap::iterator iter; | 1619 ScreencastMap::iterator iter; |
| 1669 while (!screencast_capturers_.empty()) { | 1620 while (!screencast_capturers_.empty()) { |
| 1670 if (!RemoveScreencast(screencast_capturers_.begin()->first)) { | 1621 if (!RemoveScreencast(screencast_capturers_.begin()->first)) { |
| 1671 LOG(LS_ERROR) << "Unable to delete screencast with ssrc " | 1622 LOG(LS_ERROR) << "Unable to delete screencast with ssrc " |
| 1672 << screencast_capturers_.begin()->first; | 1623 << screencast_capturers_.begin()->first; |
| 1673 ASSERT(false); | 1624 ASSERT(false); |
| 1674 break; | 1625 break; |
| 1675 } | 1626 } |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 case MSG_SCREENCASTWINDOWEVENT: { | 1908 case MSG_SCREENCASTWINDOWEVENT: { |
| 1958 const ScreencastEventMessageData* data = | 1909 const ScreencastEventMessageData* data = |
| 1959 static_cast<ScreencastEventMessageData*>(pmsg->pdata); | 1910 static_cast<ScreencastEventMessageData*>(pmsg->pdata); |
| 1960 OnScreencastWindowEvent_s(data->ssrc, data->event); | 1911 OnScreencastWindowEvent_s(data->ssrc, data->event); |
| 1961 delete data; | 1912 delete data; |
| 1962 break; | 1913 break; |
| 1963 } | 1914 } |
| 1964 case MSG_CHANNEL_ERROR: { | 1915 case MSG_CHANNEL_ERROR: { |
| 1965 const VideoChannelErrorMessageData* data = | 1916 const VideoChannelErrorMessageData* data = |
| 1966 static_cast<VideoChannelErrorMessageData*>(pmsg->pdata); | 1917 static_cast<VideoChannelErrorMessageData*>(pmsg->pdata); |
| 1967 SignalMediaError(this, data->ssrc, data->error); | |
| 1968 delete data; | 1918 delete data; |
| 1969 break; | 1919 break; |
| 1970 } | 1920 } |
| 1971 default: | 1921 default: |
| 1972 BaseChannel::OnMessage(pmsg); | 1922 BaseChannel::OnMessage(pmsg); |
| 1973 break; | 1923 break; |
| 1974 } | 1924 } |
| 1975 } | 1925 } |
| 1976 | 1926 |
| 1977 void VideoChannel::OnConnectionMonitorUpdate( | 1927 void VideoChannel::OnConnectionMonitorUpdate( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 for (ScreencastMap::iterator iter = screencast_capturers_.begin(); | 1972 for (ScreencastMap::iterator iter = screencast_capturers_.begin(); |
| 2023 iter != screencast_capturers_.end(); ++iter) { | 1973 iter != screencast_capturers_.end(); ++iter) { |
| 2024 if (iter->second == capturer) { | 1974 if (iter->second == capturer) { |
| 2025 *ssrc = iter->first; | 1975 *ssrc = iter->first; |
| 2026 return true; | 1976 return true; |
| 2027 } | 1977 } |
| 2028 } | 1978 } |
| 2029 return false; | 1979 return false; |
| 2030 } | 1980 } |
| 2031 | 1981 |
| 2032 void VideoChannel::OnVideoChannelError(uint32 ssrc, | |
| 2033 VideoMediaChannel::Error error) { | |
| 2034 VideoChannelErrorMessageData* data = new VideoChannelErrorMessageData( | |
| 2035 ssrc, error); | |
| 2036 signaling_thread()->Post(this, MSG_CHANNEL_ERROR, data); | |
| 2037 } | |
| 2038 | |
| 2039 void VideoChannel::OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, | |
| 2040 SrtpFilter::Error error) { | |
| 2041 switch (error) { | |
| 2042 case SrtpFilter::ERROR_FAIL: | |
| 2043 OnVideoChannelError(ssrc, (mode == SrtpFilter::PROTECT) ? | |
| 2044 VideoMediaChannel::ERROR_REC_SRTP_ERROR : | |
| 2045 VideoMediaChannel::ERROR_PLAY_SRTP_ERROR); | |
| 2046 break; | |
| 2047 case SrtpFilter::ERROR_AUTH: | |
| 2048 OnVideoChannelError(ssrc, (mode == SrtpFilter::PROTECT) ? | |
| 2049 VideoMediaChannel::ERROR_REC_SRTP_AUTH_FAILED : | |
| 2050 VideoMediaChannel::ERROR_PLAY_SRTP_AUTH_FAILED); | |
| 2051 break; | |
| 2052 case SrtpFilter::ERROR_REPLAY: | |
| 2053 // Only receving channel should have this error. | |
| 2054 ASSERT(mode == SrtpFilter::UNPROTECT); | |
| 2055 // TODO(gangji): Turn on the signaling of replay error once we have | |
| 2056 // switched to the new mechanism for doing video retransmissions. | |
| 2057 // OnVideoChannelError(ssrc, VideoMediaChannel::ERROR_PLAY_SRTP_REPLAY); | |
| 2058 break; | |
| 2059 default: | |
| 2060 break; | |
| 2061 } | |
| 2062 } | |
| 2063 | |
| 2064 void VideoChannel::GetSrtpCryptoSuiteNames( | 1982 void VideoChannel::GetSrtpCryptoSuiteNames( |
| 2065 std::vector<std::string>* ciphers) const { | 1983 std::vector<std::string>* ciphers) const { |
| 2066 GetSupportedVideoCryptoSuites(ciphers); | 1984 GetSupportedVideoCryptoSuites(ciphers); |
| 2067 } | 1985 } |
| 2068 | 1986 |
| 2069 DataChannel::DataChannel(rtc::Thread* thread, | 1987 DataChannel::DataChannel(rtc::Thread* thread, |
| 2070 DataMediaChannel* media_channel, | 1988 DataMediaChannel* media_channel, |
| 2071 TransportController* transport_controller, | 1989 TransportController* transport_controller, |
| 2072 const std::string& content_name, | 1990 const std::string& content_name, |
| 2073 bool rtcp) | 1991 bool rtcp) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2086 | 2004 |
| 2087 Deinit(); | 2005 Deinit(); |
| 2088 } | 2006 } |
| 2089 | 2007 |
| 2090 bool DataChannel::Init() { | 2008 bool DataChannel::Init() { |
| 2091 if (!BaseChannel::Init()) { | 2009 if (!BaseChannel::Init()) { |
| 2092 return false; | 2010 return false; |
| 2093 } | 2011 } |
| 2094 media_channel()->SignalDataReceived.connect( | 2012 media_channel()->SignalDataReceived.connect( |
| 2095 this, &DataChannel::OnDataReceived); | 2013 this, &DataChannel::OnDataReceived); |
| 2096 media_channel()->SignalMediaError.connect( | |
| 2097 this, &DataChannel::OnDataChannelError); | |
| 2098 media_channel()->SignalReadyToSend.connect( | 2014 media_channel()->SignalReadyToSend.connect( |
| 2099 this, &DataChannel::OnDataChannelReadyToSend); | 2015 this, &DataChannel::OnDataChannelReadyToSend); |
| 2100 media_channel()->SignalStreamClosedRemotely.connect( | 2016 media_channel()->SignalStreamClosedRemotely.connect( |
| 2101 this, &DataChannel::OnStreamClosedRemotely); | 2017 this, &DataChannel::OnStreamClosedRemotely); |
| 2102 srtp_filter()->SignalSrtpError.connect( | |
| 2103 this, &DataChannel::OnSrtpError); | |
| 2104 return true; | 2018 return true; |
| 2105 } | 2019 } |
| 2106 | 2020 |
| 2107 bool DataChannel::SendData(const SendDataParams& params, | 2021 bool DataChannel::SendData(const SendDataParams& params, |
| 2108 const rtc::Buffer& payload, | 2022 const rtc::Buffer& payload, |
| 2109 SendDataResult* result) { | 2023 SendDataResult* result) { |
| 2110 return InvokeOnWorker(Bind(&DataMediaChannel::SendData, | 2024 return InvokeOnWorker(Bind(&DataMediaChannel::SendData, |
| 2111 media_channel(), params, payload, result)); | 2025 media_channel(), params, payload, result)); |
| 2112 } | 2026 } |
| 2113 | 2027 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2301 case MSG_DATARECEIVED: { | 2215 case MSG_DATARECEIVED: { |
| 2302 DataReceivedMessageData* data = | 2216 DataReceivedMessageData* data = |
| 2303 static_cast<DataReceivedMessageData*>(pmsg->pdata); | 2217 static_cast<DataReceivedMessageData*>(pmsg->pdata); |
| 2304 SignalDataReceived(this, data->params, data->payload); | 2218 SignalDataReceived(this, data->params, data->payload); |
| 2305 delete data; | 2219 delete data; |
| 2306 break; | 2220 break; |
| 2307 } | 2221 } |
| 2308 case MSG_CHANNEL_ERROR: { | 2222 case MSG_CHANNEL_ERROR: { |
| 2309 const DataChannelErrorMessageData* data = | 2223 const DataChannelErrorMessageData* data = |
| 2310 static_cast<DataChannelErrorMessageData*>(pmsg->pdata); | 2224 static_cast<DataChannelErrorMessageData*>(pmsg->pdata); |
| 2311 SignalMediaError(this, data->ssrc, data->error); | |
| 2312 delete data; | 2225 delete data; |
| 2313 break; | 2226 break; |
| 2314 } | 2227 } |
| 2315 case MSG_STREAMCLOSEDREMOTELY: { | 2228 case MSG_STREAMCLOSEDREMOTELY: { |
| 2316 rtc::TypedMessageData<uint32>* data = | 2229 rtc::TypedMessageData<uint32>* data = |
| 2317 static_cast<rtc::TypedMessageData<uint32>*>(pmsg->pdata); | 2230 static_cast<rtc::TypedMessageData<uint32>*>(pmsg->pdata); |
| 2318 SignalStreamClosedRemotely(data->data()); | 2231 SignalStreamClosedRemotely(data->data()); |
| 2319 delete data; | 2232 delete data; |
| 2320 break; | 2233 break; |
| 2321 } | 2234 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2367 } | 2280 } |
| 2368 | 2281 |
| 2369 void DataChannel::OnDataChannelReadyToSend(bool writable) { | 2282 void DataChannel::OnDataChannelReadyToSend(bool writable) { |
| 2370 // This is usded for congestion control to indicate that the stream is ready | 2283 // This is usded for congestion control to indicate that the stream is ready |
| 2371 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates | 2284 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates |
| 2372 // that the transport channel is ready. | 2285 // that the transport channel is ready. |
| 2373 signaling_thread()->Post(this, MSG_READYTOSENDDATA, | 2286 signaling_thread()->Post(this, MSG_READYTOSENDDATA, |
| 2374 new DataChannelReadyToSendMessageData(writable)); | 2287 new DataChannelReadyToSendMessageData(writable)); |
| 2375 } | 2288 } |
| 2376 | 2289 |
| 2377 void DataChannel::OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, | |
| 2378 SrtpFilter::Error error) { | |
| 2379 switch (error) { | |
| 2380 case SrtpFilter::ERROR_FAIL: | |
| 2381 OnDataChannelError(ssrc, (mode == SrtpFilter::PROTECT) ? | |
| 2382 DataMediaChannel::ERROR_SEND_SRTP_ERROR : | |
| 2383 DataMediaChannel::ERROR_RECV_SRTP_ERROR); | |
| 2384 break; | |
| 2385 case SrtpFilter::ERROR_AUTH: | |
| 2386 OnDataChannelError(ssrc, (mode == SrtpFilter::PROTECT) ? | |
| 2387 DataMediaChannel::ERROR_SEND_SRTP_AUTH_FAILED : | |
| 2388 DataMediaChannel::ERROR_RECV_SRTP_AUTH_FAILED); | |
| 2389 break; | |
| 2390 case SrtpFilter::ERROR_REPLAY: | |
| 2391 // Only receving channel should have this error. | |
| 2392 ASSERT(mode == SrtpFilter::UNPROTECT); | |
| 2393 OnDataChannelError(ssrc, DataMediaChannel::ERROR_RECV_SRTP_REPLAY); | |
| 2394 break; | |
| 2395 default: | |
| 2396 break; | |
| 2397 } | |
| 2398 } | |
| 2399 | |
| 2400 void DataChannel::GetSrtpCryptoSuiteNames( | 2290 void DataChannel::GetSrtpCryptoSuiteNames( |
| 2401 std::vector<std::string>* ciphers) const { | 2291 std::vector<std::string>* ciphers) const { |
| 2402 GetSupportedDataCryptoSuites(ciphers); | 2292 GetSupportedDataCryptoSuites(ciphers); |
| 2403 } | 2293 } |
| 2404 | 2294 |
| 2405 bool DataChannel::ShouldSetupDtlsSrtp() const { | 2295 bool DataChannel::ShouldSetupDtlsSrtp() const { |
| 2406 return (data_channel_type_ == DCT_RTP); | 2296 return (data_channel_type_ == DCT_RTP); |
| 2407 } | 2297 } |
| 2408 | 2298 |
| 2409 void DataChannel::OnStreamClosedRemotely(uint32 sid) { | 2299 void DataChannel::OnStreamClosedRemotely(uint32 sid) { |
| 2410 rtc::TypedMessageData<uint32>* message = | 2300 rtc::TypedMessageData<uint32>* message = |
| 2411 new rtc::TypedMessageData<uint32>(sid); | 2301 new rtc::TypedMessageData<uint32>(sid); |
| 2412 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2302 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
| 2413 } | 2303 } |
| 2414 | 2304 |
| 2415 } // namespace cricket | 2305 } // namespace cricket |
| OLD | NEW |