Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: webrtc/api/webrtcsession.cc

Issue 1903393004: Added network thread to rtc::BaseChannel (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix flakiness of WebRtcSessionTest.TestPacketOptionsAndOnPacketSent Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/webrtcsession.h ('k') | webrtc/api/webrtcsession_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 media_controller_, transport_controller_.get(), content->name, true, 1790 media_controller_, transport_controller_.get(), content->name, true,
1791 audio_options_)); 1791 audio_options_));
1792 if (!voice_channel_) { 1792 if (!voice_channel_) {
1793 return false; 1793 return false;
1794 } 1794 }
1795 1795
1796 voice_channel_->SignalDtlsSetupFailure.connect( 1796 voice_channel_->SignalDtlsSetupFailure.connect(
1797 this, &WebRtcSession::OnDtlsSetupFailure); 1797 this, &WebRtcSession::OnDtlsSetupFailure);
1798 1798
1799 SignalVoiceChannelCreated(); 1799 SignalVoiceChannelCreated();
1800 voice_channel_->transport_channel()->SignalSentPacket.connect( 1800 voice_channel_->SignalSentPacket.connect(this,
1801 this, &WebRtcSession::OnSentPacket_w); 1801 &WebRtcSession::OnSentPacket_w);
1802 return true; 1802 return true;
1803 } 1803 }
1804 1804
1805 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { 1805 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) {
1806 video_channel_.reset(channel_manager_->CreateVideoChannel( 1806 video_channel_.reset(channel_manager_->CreateVideoChannel(
1807 media_controller_, transport_controller_.get(), content->name, true, 1807 media_controller_, transport_controller_.get(), content->name, true,
1808 video_options_)); 1808 video_options_));
1809 if (!video_channel_) { 1809 if (!video_channel_) {
1810 return false; 1810 return false;
1811 } 1811 }
1812 1812
1813 video_channel_->SignalDtlsSetupFailure.connect( 1813 video_channel_->SignalDtlsSetupFailure.connect(
1814 this, &WebRtcSession::OnDtlsSetupFailure); 1814 this, &WebRtcSession::OnDtlsSetupFailure);
1815 1815
1816 SignalVideoChannelCreated(); 1816 SignalVideoChannelCreated();
1817 video_channel_->transport_channel()->SignalSentPacket.connect( 1817 video_channel_->SignalSentPacket.connect(this,
1818 this, &WebRtcSession::OnSentPacket_w); 1818 &WebRtcSession::OnSentPacket_w);
1819 return true; 1819 return true;
1820 } 1820 }
1821 1821
1822 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) { 1822 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) {
1823 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); 1823 bool sctp = (data_channel_type_ == cricket::DCT_SCTP);
1824 data_channel_.reset(channel_manager_->CreateDataChannel( 1824 data_channel_.reset(channel_manager_->CreateDataChannel(
1825 transport_controller_.get(), content->name, !sctp, data_channel_type_)); 1825 transport_controller_.get(), content->name, !sctp, data_channel_type_));
1826 if (!data_channel_) { 1826 if (!data_channel_) {
1827 return false; 1827 return false;
1828 } 1828 }
1829 1829
1830 if (sctp) { 1830 if (sctp) {
1831 data_channel_->SignalDataReceived.connect( 1831 data_channel_->SignalDataReceived.connect(
1832 this, &WebRtcSession::OnDataChannelMessageReceived); 1832 this, &WebRtcSession::OnDataChannelMessageReceived);
1833 } 1833 }
1834 1834
1835 data_channel_->SignalDtlsSetupFailure.connect( 1835 data_channel_->SignalDtlsSetupFailure.connect(
1836 this, &WebRtcSession::OnDtlsSetupFailure); 1836 this, &WebRtcSession::OnDtlsSetupFailure);
1837 1837
1838 SignalDataChannelCreated(); 1838 SignalDataChannelCreated();
1839 data_channel_->transport_channel()->SignalSentPacket.connect( 1839 data_channel_->SignalSentPacket.connect(this, &WebRtcSession::OnSentPacket_w);
1840 this, &WebRtcSession::OnSentPacket_w);
1841 return true; 1840 return true;
1842 } 1841 }
1843 1842
1844 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { 1843 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) {
1845 SetError(ERROR_TRANSPORT, 1844 SetError(ERROR_TRANSPORT,
1846 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); 1845 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp);
1847 } 1846 }
1848 1847
1849 void WebRtcSession::OnDataChannelMessageReceived( 1848 void WebRtcSession::OnDataChannelMessageReceived(
1850 cricket::DataChannel* channel, 1849 cricket::DataChannel* channel,
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 if (srtp_crypto_suite != rtc::SRTP_INVALID_CRYPTO_SUITE) { 2147 if (srtp_crypto_suite != rtc::SRTP_INVALID_CRYPTO_SUITE) {
2149 metrics_observer_->IncrementSparseEnumCounter(srtp_counter_type, 2148 metrics_observer_->IncrementSparseEnumCounter(srtp_counter_type,
2150 srtp_crypto_suite); 2149 srtp_crypto_suite);
2151 } 2150 }
2152 if (ssl_cipher_suite != rtc::TLS_NULL_WITH_NULL_NULL) { 2151 if (ssl_cipher_suite != rtc::TLS_NULL_WITH_NULL_NULL) {
2153 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type, 2152 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type,
2154 ssl_cipher_suite); 2153 ssl_cipher_suite);
2155 } 2154 }
2156 } 2155 }
2157 2156
2158 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, 2157 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) {
2159 const rtc::SentPacket& sent_packet) {
2160 RTC_DCHECK(worker_thread()->IsCurrent()); 2158 RTC_DCHECK(worker_thread()->IsCurrent());
2161 media_controller_->call_w()->OnSentPacket(sent_packet); 2159 media_controller_->call_w()->OnSentPacket(sent_packet);
2162 } 2160 }
2163 2161
2164 } // namespace webrtc 2162 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession.h ('k') | webrtc/api/webrtcsession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698