OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 }; | 100 }; |
101 static_assert(INVALID == arraysize(kValidIceServiceTypes), | 101 static_assert(INVALID == arraysize(kValidIceServiceTypes), |
102 "kValidIceServiceTypes must have as many strings as ServiceType " | 102 "kValidIceServiceTypes must have as many strings as ServiceType " |
103 "has values."); | 103 "has values."); |
104 | 104 |
105 enum { | 105 enum { |
106 MSG_SET_SESSIONDESCRIPTION_SUCCESS = 0, | 106 MSG_SET_SESSIONDESCRIPTION_SUCCESS = 0, |
107 MSG_SET_SESSIONDESCRIPTION_FAILED, | 107 MSG_SET_SESSIONDESCRIPTION_FAILED, |
108 MSG_CREATE_SESSIONDESCRIPTION_FAILED, | 108 MSG_CREATE_SESSIONDESCRIPTION_FAILED, |
109 MSG_GETSTATS, | 109 MSG_GETSTATS, |
110 MSG_FREE_DATACHANNELS, | |
110 }; | 111 }; |
111 | 112 |
112 struct SetSessionDescriptionMsg : public rtc::MessageData { | 113 struct SetSessionDescriptionMsg : public rtc::MessageData { |
113 explicit SetSessionDescriptionMsg( | 114 explicit SetSessionDescriptionMsg( |
114 webrtc::SetSessionDescriptionObserver* observer) | 115 webrtc::SetSessionDescriptionObserver* observer) |
115 : observer(observer) { | 116 : observer(observer) { |
116 } | 117 } |
117 | 118 |
118 rtc::scoped_refptr<webrtc::SetSessionDescriptionObserver> observer; | 119 rtc::scoped_refptr<webrtc::SetSessionDescriptionObserver> observer; |
119 std::string error; | 120 std::string error; |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1322 break; | 1323 break; |
1323 } | 1324 } |
1324 case MSG_GETSTATS: { | 1325 case MSG_GETSTATS: { |
1325 GetStatsMsg* param = static_cast<GetStatsMsg*>(msg->pdata); | 1326 GetStatsMsg* param = static_cast<GetStatsMsg*>(msg->pdata); |
1326 StatsReports reports; | 1327 StatsReports reports; |
1327 stats_->GetStats(param->track, &reports); | 1328 stats_->GetStats(param->track, &reports); |
1328 param->observer->OnComplete(reports); | 1329 param->observer->OnComplete(reports); |
1329 delete param; | 1330 delete param; |
1330 break; | 1331 break; |
1331 } | 1332 } |
1333 case MSG_FREE_DATACHANNELS: { | |
1334 sctp_data_channels_to_free_.clear(); | |
1335 break; | |
1336 } | |
1332 default: | 1337 default: |
1333 RTC_DCHECK(false && "Not implemented"); | 1338 RTC_DCHECK(false && "Not implemented"); |
1334 break; | 1339 break; |
1335 } | 1340 } |
1336 } | 1341 } |
1337 | 1342 |
1338 void PeerConnection::CreateAudioReceiver(MediaStreamInterface* stream, | 1343 void PeerConnection::CreateAudioReceiver(MediaStreamInterface* stream, |
1339 AudioTrackInterface* audio_track, | 1344 AudioTrackInterface* audio_track, |
1340 uint32_t ssrc) { | 1345 uint32_t ssrc) { |
1341 receivers_.push_back(new AudioRtpReceiver(audio_track, ssrc, session_.get())); | 1346 receivers_.push_back(new AudioRtpReceiver(audio_track, ssrc, session_.get())); |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1901 } | 1906 } |
1902 } | 1907 } |
1903 | 1908 |
1904 void PeerConnection::OnSctpDataChannelClosed(DataChannel* channel) { | 1909 void PeerConnection::OnSctpDataChannelClosed(DataChannel* channel) { |
1905 for (auto it = sctp_data_channels_.begin(); it != sctp_data_channels_.end(); | 1910 for (auto it = sctp_data_channels_.begin(); it != sctp_data_channels_.end(); |
1906 ++it) { | 1911 ++it) { |
1907 if (it->get() == channel) { | 1912 if (it->get() == channel) { |
1908 if (channel->id() >= 0) { | 1913 if (channel->id() >= 0) { |
1909 sid_allocator_.ReleaseSid(channel->id()); | 1914 sid_allocator_.ReleaseSid(channel->id()); |
1910 } | 1915 } |
1916 // Since this method is triggered by a signal from the DataChannel, | |
1917 // we can't free it directly here; we need to free it asynchronously. | |
1918 sctp_data_channels_to_free_.push_back(*it); | |
pthatcher1
2015/12/11 02:55:01
We should probably add a RTC_DCHECK(signaling_thre
Taylor Brandstetter
2015/12/11 18:21:48
Done.
| |
1911 sctp_data_channels_.erase(it); | 1919 sctp_data_channels_.erase(it); |
1920 signaling_thread()->Post(this, MSG_FREE_DATACHANNELS, nullptr); | |
1912 return; | 1921 return; |
1913 } | 1922 } |
1914 } | 1923 } |
1915 } | 1924 } |
1916 | 1925 |
1917 void PeerConnection::OnVoiceChannelDestroyed() { | 1926 void PeerConnection::OnVoiceChannelDestroyed() { |
1918 EndRemoteTracks(cricket::MEDIA_TYPE_AUDIO); | 1927 EndRemoteTracks(cricket::MEDIA_TYPE_AUDIO); |
1919 } | 1928 } |
1920 | 1929 |
1921 void PeerConnection::OnVideoChannelDestroyed() { | 1930 void PeerConnection::OnVideoChannelDestroyed() { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2017 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { | 2026 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { |
2018 for (const auto& channel : sctp_data_channels_) { | 2027 for (const auto& channel : sctp_data_channels_) { |
2019 if (channel->id() == sid) { | 2028 if (channel->id() == sid) { |
2020 return channel; | 2029 return channel; |
2021 } | 2030 } |
2022 } | 2031 } |
2023 return nullptr; | 2032 return nullptr; |
2024 } | 2033 } |
2025 | 2034 |
2026 } // namespace webrtc | 2035 } // namespace webrtc |
OLD | NEW |