Chromium Code Reviews| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 }; | 99 }; |
| 100 static_assert(INVALID == arraysize(kValidIceServiceTypes), | 100 static_assert(INVALID == arraysize(kValidIceServiceTypes), |
| 101 "kValidIceServiceTypes must have as many strings as ServiceType " | 101 "kValidIceServiceTypes must have as many strings as ServiceType " |
| 102 "has values."); | 102 "has values."); |
| 103 | 103 |
| 104 enum { | 104 enum { |
| 105 MSG_SET_SESSIONDESCRIPTION_SUCCESS = 0, | 105 MSG_SET_SESSIONDESCRIPTION_SUCCESS = 0, |
| 106 MSG_SET_SESSIONDESCRIPTION_FAILED, | 106 MSG_SET_SESSIONDESCRIPTION_FAILED, |
| 107 MSG_CREATE_SESSIONDESCRIPTION_FAILED, | 107 MSG_CREATE_SESSIONDESCRIPTION_FAILED, |
| 108 MSG_GETSTATS, | 108 MSG_GETSTATS, |
| 109 MSG_FREE_DATACHANNEL, | |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 struct SetSessionDescriptionMsg : public rtc::MessageData { | 112 struct SetSessionDescriptionMsg : public rtc::MessageData { |
| 112 explicit SetSessionDescriptionMsg( | 113 explicit SetSessionDescriptionMsg( |
| 113 webrtc::SetSessionDescriptionObserver* observer) | 114 webrtc::SetSessionDescriptionObserver* observer) |
| 114 : observer(observer) { | 115 : observer(observer) { |
| 115 } | 116 } |
| 116 | 117 |
| 117 rtc::scoped_refptr<webrtc::SetSessionDescriptionObserver> observer; | 118 rtc::scoped_refptr<webrtc::SetSessionDescriptionObserver> observer; |
| 118 std::string error; | 119 std::string error; |
| (...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1306 break; | 1307 break; |
| 1307 } | 1308 } |
| 1308 case MSG_GETSTATS: { | 1309 case MSG_GETSTATS: { |
| 1309 GetStatsMsg* param = static_cast<GetStatsMsg*>(msg->pdata); | 1310 GetStatsMsg* param = static_cast<GetStatsMsg*>(msg->pdata); |
| 1310 StatsReports reports; | 1311 StatsReports reports; |
| 1311 stats_->GetStats(param->track, &reports); | 1312 stats_->GetStats(param->track, &reports); |
| 1312 param->observer->OnComplete(reports); | 1313 param->observer->OnComplete(reports); |
| 1313 delete param; | 1314 delete param; |
| 1314 break; | 1315 break; |
| 1315 } | 1316 } |
| 1317 case MSG_FREE_DATACHANNEL: { | |
| 1318 auto param = | |
| 1319 static_cast<rtc::TypedMessageData<rtc::scoped_refptr<DataChannel>>*>( | |
| 1320 msg->pdata); | |
| 1321 delete param; | |
|
pthatcher1
2015/12/03 19:45:15
Does "delete msg->pdata" not work without the cast
| |
| 1322 break; | |
| 1323 } | |
| 1316 default: | 1324 default: |
| 1317 RTC_DCHECK(false && "Not implemented"); | 1325 RTC_DCHECK(false && "Not implemented"); |
| 1318 break; | 1326 break; |
| 1319 } | 1327 } |
| 1320 } | 1328 } |
| 1321 | 1329 |
| 1322 void PeerConnection::CreateAudioReceiver(MediaStreamInterface* stream, | 1330 void PeerConnection::CreateAudioReceiver(MediaStreamInterface* stream, |
| 1323 AudioTrackInterface* audio_track, | 1331 AudioTrackInterface* audio_track, |
| 1324 uint32_t ssrc) { | 1332 uint32_t ssrc) { |
| 1325 receivers_.push_back(new AudioRtpReceiver(audio_track, ssrc, session_.get())); | 1333 receivers_.push_back(new AudioRtpReceiver(audio_track, ssrc, session_.get())); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1893 } | 1901 } |
| 1894 } | 1902 } |
| 1895 | 1903 |
| 1896 void PeerConnection::OnSctpDataChannelClosed(DataChannel* channel) { | 1904 void PeerConnection::OnSctpDataChannelClosed(DataChannel* channel) { |
| 1897 for (auto it = sctp_data_channels_.begin(); it != sctp_data_channels_.end(); | 1905 for (auto it = sctp_data_channels_.begin(); it != sctp_data_channels_.end(); |
| 1898 ++it) { | 1906 ++it) { |
| 1899 if (it->get() == channel) { | 1907 if (it->get() == channel) { |
| 1900 if (channel->id() >= 0) { | 1908 if (channel->id() >= 0) { |
| 1901 sid_allocator_.ReleaseSid(channel->id()); | 1909 sid_allocator_.ReleaseSid(channel->id()); |
| 1902 } | 1910 } |
| 1911 // Since this method is triggered by a signal from the DataChannel, | |
| 1912 // we can't free it directly here; we need to free it asynchronously. | |
| 1913 signaling_thread()->Post( | |
| 1914 this, MSG_FREE_DATACHANNEL, | |
|
pthatcher1
2015/12/03 19:45:15
If you don't need the type cast, you could just ca
Taylor Brandstetter
2015/12/04 19:27:45
Good point. Done.
| |
| 1915 new rtc::TypedMessageData<rtc::scoped_refptr<DataChannel>>(channel)); | |
| 1903 sctp_data_channels_.erase(it); | 1916 sctp_data_channels_.erase(it); |
| 1904 return; | 1917 return; |
| 1905 } | 1918 } |
| 1906 } | 1919 } |
| 1907 } | 1920 } |
| 1908 | 1921 |
| 1909 void PeerConnection::OnVoiceChannelDestroyed() { | 1922 void PeerConnection::OnVoiceChannelDestroyed() { |
| 1910 EndRemoteTracks(cricket::MEDIA_TYPE_AUDIO); | 1923 EndRemoteTracks(cricket::MEDIA_TYPE_AUDIO); |
| 1911 } | 1924 } |
| 1912 | 1925 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2009 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { | 2022 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { |
| 2010 for (const auto& channel : sctp_data_channels_) { | 2023 for (const auto& channel : sctp_data_channels_) { |
| 2011 if (channel->id() == sid) { | 2024 if (channel->id() == sid) { |
| 2012 return channel; | 2025 return channel; |
| 2013 } | 2026 } |
| 2014 } | 2027 } |
| 2015 return nullptr; | 2028 return nullptr; |
| 2016 } | 2029 } |
| 2017 | 2030 |
| 2018 } // namespace webrtc | 2031 } // namespace webrtc |
| OLD | NEW |