| 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 } | 380 } |
| 381 | 381 |
| 382 bool BaseChannel::RemoveSendStream(uint32_t ssrc) { | 382 bool BaseChannel::RemoveSendStream(uint32_t ssrc) { |
| 383 return InvokeOnWorker( | 383 return InvokeOnWorker( |
| 384 Bind(&MediaChannel::RemoveSendStream, media_channel(), ssrc)); | 384 Bind(&MediaChannel::RemoveSendStream, media_channel(), ssrc)); |
| 385 } | 385 } |
| 386 | 386 |
| 387 bool BaseChannel::SetLocalContent(const MediaContentDescription* content, | 387 bool BaseChannel::SetLocalContent(const MediaContentDescription* content, |
| 388 ContentAction action, | 388 ContentAction action, |
| 389 std::string* error_desc) { | 389 std::string* error_desc) { |
| 390 TRACE_EVENT0("webrtc", "BaseChannel::SetLocalContent"); |
| 390 return InvokeOnWorker(Bind(&BaseChannel::SetLocalContent_w, | 391 return InvokeOnWorker(Bind(&BaseChannel::SetLocalContent_w, |
| 391 this, content, action, error_desc)); | 392 this, content, action, error_desc)); |
| 392 } | 393 } |
| 393 | 394 |
| 394 bool BaseChannel::SetRemoteContent(const MediaContentDescription* content, | 395 bool BaseChannel::SetRemoteContent(const MediaContentDescription* content, |
| 395 ContentAction action, | 396 ContentAction action, |
| 396 std::string* error_desc) { | 397 std::string* error_desc) { |
| 398 TRACE_EVENT0("webrtc", "BaseChannel::SetRemoteContent"); |
| 397 return InvokeOnWorker(Bind(&BaseChannel::SetRemoteContent_w, | 399 return InvokeOnWorker(Bind(&BaseChannel::SetRemoteContent_w, |
| 398 this, content, action, error_desc)); | 400 this, content, action, error_desc)); |
| 399 } | 401 } |
| 400 | 402 |
| 401 void BaseChannel::StartConnectionMonitor(int cms) { | 403 void BaseChannel::StartConnectionMonitor(int cms) { |
| 402 // We pass in the BaseChannel instead of the transport_channel_ | 404 // We pass in the BaseChannel instead of the transport_channel_ |
| 403 // because if the transport_channel_ changes, the ConnectionMonitor | 405 // because if the transport_channel_ changes, the ConnectionMonitor |
| 404 // would be pointing to the wrong TransportChannel. | 406 // would be pointing to the wrong TransportChannel. |
| 405 connection_monitor_.reset(new ConnectionMonitor( | 407 connection_monitor_.reset(new ConnectionMonitor( |
| 406 this, worker_thread(), rtc::Thread::Current())); | 408 this, worker_thread(), rtc::Thread::Current())); |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 } | 1457 } |
| 1456 | 1458 |
| 1457 const ContentInfo* VoiceChannel::GetFirstContent( | 1459 const ContentInfo* VoiceChannel::GetFirstContent( |
| 1458 const SessionDescription* sdesc) { | 1460 const SessionDescription* sdesc) { |
| 1459 return GetFirstAudioContent(sdesc); | 1461 return GetFirstAudioContent(sdesc); |
| 1460 } | 1462 } |
| 1461 | 1463 |
| 1462 bool VoiceChannel::SetLocalContent_w(const MediaContentDescription* content, | 1464 bool VoiceChannel::SetLocalContent_w(const MediaContentDescription* content, |
| 1463 ContentAction action, | 1465 ContentAction action, |
| 1464 std::string* error_desc) { | 1466 std::string* error_desc) { |
| 1467 TRACE_EVENT0("webrtc", "VoiceChannel::SetLocalContent_w"); |
| 1465 ASSERT(worker_thread() == rtc::Thread::Current()); | 1468 ASSERT(worker_thread() == rtc::Thread::Current()); |
| 1466 LOG(LS_INFO) << "Setting local voice description"; | 1469 LOG(LS_INFO) << "Setting local voice description"; |
| 1467 | 1470 |
| 1468 const AudioContentDescription* audio = | 1471 const AudioContentDescription* audio = |
| 1469 static_cast<const AudioContentDescription*>(content); | 1472 static_cast<const AudioContentDescription*>(content); |
| 1470 ASSERT(audio != NULL); | 1473 ASSERT(audio != NULL); |
| 1471 if (!audio) { | 1474 if (!audio) { |
| 1472 SafeSetError("Can't find audio content in local description.", error_desc); | 1475 SafeSetError("Can't find audio content in local description.", error_desc); |
| 1473 return false; | 1476 return false; |
| 1474 } | 1477 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1499 } | 1502 } |
| 1500 | 1503 |
| 1501 set_local_content_direction(content->direction()); | 1504 set_local_content_direction(content->direction()); |
| 1502 ChangeState(); | 1505 ChangeState(); |
| 1503 return true; | 1506 return true; |
| 1504 } | 1507 } |
| 1505 | 1508 |
| 1506 bool VoiceChannel::SetRemoteContent_w(const MediaContentDescription* content, | 1509 bool VoiceChannel::SetRemoteContent_w(const MediaContentDescription* content, |
| 1507 ContentAction action, | 1510 ContentAction action, |
| 1508 std::string* error_desc) { | 1511 std::string* error_desc) { |
| 1512 TRACE_EVENT0("webrtc", "VoiceChannel::SetRemoteContent_w"); |
| 1509 ASSERT(worker_thread() == rtc::Thread::Current()); | 1513 ASSERT(worker_thread() == rtc::Thread::Current()); |
| 1510 LOG(LS_INFO) << "Setting remote voice description"; | 1514 LOG(LS_INFO) << "Setting remote voice description"; |
| 1511 | 1515 |
| 1512 const AudioContentDescription* audio = | 1516 const AudioContentDescription* audio = |
| 1513 static_cast<const AudioContentDescription*>(content); | 1517 static_cast<const AudioContentDescription*>(content); |
| 1514 ASSERT(audio != NULL); | 1518 ASSERT(audio != NULL); |
| 1515 if (!audio) { | 1519 if (!audio) { |
| 1516 SafeSetError("Can't find audio content in remote description.", error_desc); | 1520 SafeSetError("Can't find audio content in remote description.", error_desc); |
| 1517 return false; | 1521 return false; |
| 1518 } | 1522 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 } | 1742 } |
| 1739 | 1743 |
| 1740 const ContentInfo* VideoChannel::GetFirstContent( | 1744 const ContentInfo* VideoChannel::GetFirstContent( |
| 1741 const SessionDescription* sdesc) { | 1745 const SessionDescription* sdesc) { |
| 1742 return GetFirstVideoContent(sdesc); | 1746 return GetFirstVideoContent(sdesc); |
| 1743 } | 1747 } |
| 1744 | 1748 |
| 1745 bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content, | 1749 bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content, |
| 1746 ContentAction action, | 1750 ContentAction action, |
| 1747 std::string* error_desc) { | 1751 std::string* error_desc) { |
| 1752 TRACE_EVENT0("webrtc", "VideoChannel::SetLocalContent_w"); |
| 1748 ASSERT(worker_thread() == rtc::Thread::Current()); | 1753 ASSERT(worker_thread() == rtc::Thread::Current()); |
| 1749 LOG(LS_INFO) << "Setting local video description"; | 1754 LOG(LS_INFO) << "Setting local video description"; |
| 1750 | 1755 |
| 1751 const VideoContentDescription* video = | 1756 const VideoContentDescription* video = |
| 1752 static_cast<const VideoContentDescription*>(content); | 1757 static_cast<const VideoContentDescription*>(content); |
| 1753 ASSERT(video != NULL); | 1758 ASSERT(video != NULL); |
| 1754 if (!video) { | 1759 if (!video) { |
| 1755 SafeSetError("Can't find video content in local description.", error_desc); | 1760 SafeSetError("Can't find video content in local description.", error_desc); |
| 1756 return false; | 1761 return false; |
| 1757 } | 1762 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1782 } | 1787 } |
| 1783 | 1788 |
| 1784 set_local_content_direction(content->direction()); | 1789 set_local_content_direction(content->direction()); |
| 1785 ChangeState(); | 1790 ChangeState(); |
| 1786 return true; | 1791 return true; |
| 1787 } | 1792 } |
| 1788 | 1793 |
| 1789 bool VideoChannel::SetRemoteContent_w(const MediaContentDescription* content, | 1794 bool VideoChannel::SetRemoteContent_w(const MediaContentDescription* content, |
| 1790 ContentAction action, | 1795 ContentAction action, |
| 1791 std::string* error_desc) { | 1796 std::string* error_desc) { |
| 1797 TRACE_EVENT0("webrtc", "VideoChannel::SetRemoteContent_w"); |
| 1792 ASSERT(worker_thread() == rtc::Thread::Current()); | 1798 ASSERT(worker_thread() == rtc::Thread::Current()); |
| 1793 LOG(LS_INFO) << "Setting remote video description"; | 1799 LOG(LS_INFO) << "Setting remote video description"; |
| 1794 | 1800 |
| 1795 const VideoContentDescription* video = | 1801 const VideoContentDescription* video = |
| 1796 static_cast<const VideoContentDescription*>(content); | 1802 static_cast<const VideoContentDescription*>(content); |
| 1797 ASSERT(video != NULL); | 1803 ASSERT(video != NULL); |
| 1798 if (!video) { | 1804 if (!video) { |
| 1799 SafeSetError("Can't find video content in remote description.", error_desc); | 1805 SafeSetError("Can't find video content in remote description.", error_desc); |
| 1800 return false; | 1806 return false; |
| 1801 } | 1807 } |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2078 std::string* error_desc) { | 2084 std::string* error_desc) { |
| 2079 bool is_sctp = ((content->protocol() == kMediaProtocolSctp) || | 2085 bool is_sctp = ((content->protocol() == kMediaProtocolSctp) || |
| 2080 (content->protocol() == kMediaProtocolDtlsSctp)); | 2086 (content->protocol() == kMediaProtocolDtlsSctp)); |
| 2081 DataChannelType data_channel_type = is_sctp ? DCT_SCTP : DCT_RTP; | 2087 DataChannelType data_channel_type = is_sctp ? DCT_SCTP : DCT_RTP; |
| 2082 return SetDataChannelType(data_channel_type, error_desc); | 2088 return SetDataChannelType(data_channel_type, error_desc); |
| 2083 } | 2089 } |
| 2084 | 2090 |
| 2085 bool DataChannel::SetLocalContent_w(const MediaContentDescription* content, | 2091 bool DataChannel::SetLocalContent_w(const MediaContentDescription* content, |
| 2086 ContentAction action, | 2092 ContentAction action, |
| 2087 std::string* error_desc) { | 2093 std::string* error_desc) { |
| 2094 TRACE_EVENT0("webrtc", "DataChannel::SetLocalContent_w"); |
| 2088 ASSERT(worker_thread() == rtc::Thread::Current()); | 2095 ASSERT(worker_thread() == rtc::Thread::Current()); |
| 2089 LOG(LS_INFO) << "Setting local data description"; | 2096 LOG(LS_INFO) << "Setting local data description"; |
| 2090 | 2097 |
| 2091 const DataContentDescription* data = | 2098 const DataContentDescription* data = |
| 2092 static_cast<const DataContentDescription*>(content); | 2099 static_cast<const DataContentDescription*>(content); |
| 2093 ASSERT(data != NULL); | 2100 ASSERT(data != NULL); |
| 2094 if (!data) { | 2101 if (!data) { |
| 2095 SafeSetError("Can't find data content in local description.", error_desc); | 2102 SafeSetError("Can't find data content in local description.", error_desc); |
| 2096 return false; | 2103 return false; |
| 2097 } | 2104 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 } | 2140 } |
| 2134 | 2141 |
| 2135 set_local_content_direction(content->direction()); | 2142 set_local_content_direction(content->direction()); |
| 2136 ChangeState(); | 2143 ChangeState(); |
| 2137 return true; | 2144 return true; |
| 2138 } | 2145 } |
| 2139 | 2146 |
| 2140 bool DataChannel::SetRemoteContent_w(const MediaContentDescription* content, | 2147 bool DataChannel::SetRemoteContent_w(const MediaContentDescription* content, |
| 2141 ContentAction action, | 2148 ContentAction action, |
| 2142 std::string* error_desc) { | 2149 std::string* error_desc) { |
| 2150 TRACE_EVENT0("webrtc", "DataChannel::SetRemoteContent_w"); |
| 2143 ASSERT(worker_thread() == rtc::Thread::Current()); | 2151 ASSERT(worker_thread() == rtc::Thread::Current()); |
| 2144 | 2152 |
| 2145 const DataContentDescription* data = | 2153 const DataContentDescription* data = |
| 2146 static_cast<const DataContentDescription*>(content); | 2154 static_cast<const DataContentDescription*>(content); |
| 2147 ASSERT(data != NULL); | 2155 ASSERT(data != NULL); |
| 2148 if (!data) { | 2156 if (!data) { |
| 2149 SafeSetError("Can't find data content in remote description.", error_desc); | 2157 SafeSetError("Can't find data content in remote description.", error_desc); |
| 2150 return false; | 2158 return false; |
| 2151 } | 2159 } |
| 2152 | 2160 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2305 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); | 2313 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
| 2306 } | 2314 } |
| 2307 | 2315 |
| 2308 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2316 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
| 2309 rtc::TypedMessageData<uint32_t>* message = | 2317 rtc::TypedMessageData<uint32_t>* message = |
| 2310 new rtc::TypedMessageData<uint32_t>(sid); | 2318 new rtc::TypedMessageData<uint32_t>(sid); |
| 2311 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2319 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
| 2312 } | 2320 } |
| 2313 | 2321 |
| 2314 } // namespace cricket | 2322 } // namespace cricket |
| OLD | NEW |