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 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1837 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { | 1837 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { |
| 1838 voice_channel_.reset(channel_manager_->CreateVoiceChannel( | 1838 voice_channel_.reset(channel_manager_->CreateVoiceChannel( |
| 1839 media_controller_, transport_controller_.get(), content->name, true, | 1839 media_controller_, transport_controller_.get(), content->name, true, |
| 1840 audio_options_)); | 1840 audio_options_)); |
| 1841 if (!voice_channel_) { | 1841 if (!voice_channel_) { |
| 1842 return false; | 1842 return false; |
| 1843 } | 1843 } |
| 1844 | 1844 |
| 1845 voice_channel_->SignalDtlsSetupFailure.connect( | 1845 voice_channel_->SignalDtlsSetupFailure.connect( |
| 1846 this, &WebRtcSession::OnDtlsSetupFailure); | 1846 this, &WebRtcSession::OnDtlsSetupFailure); |
| 1847 voice_channel_->SignalFirstPacketReceived.connect( | |
| 1848 this, &WebRtcSession::OnChannelFirstPacketReceived); | |
| 1847 | 1849 |
| 1848 SignalVoiceChannelCreated(); | 1850 SignalVoiceChannelCreated(); |
| 1849 voice_channel_->transport_channel()->SignalSentPacket.connect( | 1851 voice_channel_->transport_channel()->SignalSentPacket.connect( |
| 1850 this, &WebRtcSession::OnSentPacket_w); | 1852 this, &WebRtcSession::OnSentPacket_w); |
| 1851 return true; | 1853 return true; |
| 1852 } | 1854 } |
| 1853 | 1855 |
| 1854 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { | 1856 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { |
| 1855 video_channel_.reset(channel_manager_->CreateVideoChannel( | 1857 video_channel_.reset(channel_manager_->CreateVideoChannel( |
| 1856 media_controller_, transport_controller_.get(), content->name, true, | 1858 media_controller_, transport_controller_.get(), content->name, true, |
| 1857 video_options_)); | 1859 video_options_)); |
| 1858 if (!video_channel_) { | 1860 if (!video_channel_) { |
| 1859 return false; | 1861 return false; |
| 1860 } | 1862 } |
| 1861 | 1863 |
| 1862 video_channel_->SignalDtlsSetupFailure.connect( | 1864 video_channel_->SignalDtlsSetupFailure.connect( |
| 1863 this, &WebRtcSession::OnDtlsSetupFailure); | 1865 this, &WebRtcSession::OnDtlsSetupFailure); |
| 1866 video_channel_->SignalFirstPacketReceived.connect( | |
| 1867 this, &WebRtcSession::OnChannelFirstPacketReceived); | |
| 1864 | 1868 |
| 1865 SignalVideoChannelCreated(); | 1869 SignalVideoChannelCreated(); |
| 1866 video_channel_->transport_channel()->SignalSentPacket.connect( | 1870 video_channel_->transport_channel()->SignalSentPacket.connect( |
| 1867 this, &WebRtcSession::OnSentPacket_w); | 1871 this, &WebRtcSession::OnSentPacket_w); |
| 1868 return true; | 1872 return true; |
| 1869 } | 1873 } |
| 1870 | 1874 |
| 1871 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) { | 1875 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) { |
| 1872 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); | 1876 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); |
| 1873 data_channel_.reset(channel_manager_->CreateDataChannel( | 1877 data_channel_.reset(channel_manager_->CreateDataChannel( |
| 1874 transport_controller_.get(), content->name, !sctp, data_channel_type_)); | 1878 transport_controller_.get(), content->name, !sctp, data_channel_type_)); |
| 1875 if (!data_channel_) { | 1879 if (!data_channel_) { |
| 1876 return false; | 1880 return false; |
| 1877 } | 1881 } |
| 1878 | 1882 |
| 1879 if (sctp) { | 1883 if (sctp) { |
| 1880 data_channel_->SignalDataReceived.connect( | 1884 data_channel_->SignalDataReceived.connect( |
| 1881 this, &WebRtcSession::OnDataChannelMessageReceived); | 1885 this, &WebRtcSession::OnDataChannelMessageReceived); |
| 1882 } | 1886 } |
| 1883 | 1887 |
| 1884 data_channel_->SignalDtlsSetupFailure.connect( | 1888 data_channel_->SignalDtlsSetupFailure.connect( |
| 1885 this, &WebRtcSession::OnDtlsSetupFailure); | 1889 this, &WebRtcSession::OnDtlsSetupFailure); |
| 1890 data_channel_->SignalFirstPacketReceived.connect( | |
| 1891 this, &WebRtcSession::OnChannelFirstPacketReceived); | |
| 1886 | 1892 |
| 1887 SignalDataChannelCreated(); | 1893 SignalDataChannelCreated(); |
| 1888 data_channel_->transport_channel()->SignalSentPacket.connect( | 1894 data_channel_->transport_channel()->SignalSentPacket.connect( |
| 1889 this, &WebRtcSession::OnSentPacket_w); | 1895 this, &WebRtcSession::OnSentPacket_w); |
| 1890 return true; | 1896 return true; |
| 1891 } | 1897 } |
| 1892 | 1898 |
| 1893 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { | 1899 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { |
| 1894 SetError(ERROR_TRANSPORT, | 1900 SetError(ERROR_TRANSPORT, |
| 1895 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); | 1901 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); |
| 1896 } | 1902 } |
| 1897 | 1903 |
| 1904 void WebRtcSession::OnChannelFirstPacketReceived(cricket::BaseChannel*) { | |
| 1905 ASSERT(signaling_thread()->IsCurrent()); | |
| 1906 if (has_received_packet_) { | |
|
pthatcher1
2016/01/14 23:50:09
Should that be "!has_recieved_packet_"?
Taylor Brandstetter
2016/01/15 17:06:58
Yep; I would have noticed this pretty quickly if I
| |
| 1907 has_received_packet_ = true; | |
| 1908 SignalFirstPacketReceived(); | |
| 1909 } | |
| 1910 } | |
| 1911 | |
| 1898 void WebRtcSession::OnDataChannelMessageReceived( | 1912 void WebRtcSession::OnDataChannelMessageReceived( |
| 1899 cricket::DataChannel* channel, | 1913 cricket::DataChannel* channel, |
| 1900 const cricket::ReceiveDataParams& params, | 1914 const cricket::ReceiveDataParams& params, |
| 1901 const rtc::Buffer& payload) { | 1915 const rtc::Buffer& payload) { |
| 1902 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); | 1916 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); |
| 1903 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { | 1917 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { |
| 1904 // Received OPEN message; parse and signal that a new data channel should | 1918 // Received OPEN message; parse and signal that a new data channel should |
| 1905 // be created. | 1919 // be created. |
| 1906 std::string label; | 1920 std::string label; |
| 1907 InternalDataChannelInit config; | 1921 InternalDataChannelInit config; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2205 } | 2219 } |
| 2206 } | 2220 } |
| 2207 | 2221 |
| 2208 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, | 2222 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, |
| 2209 const rtc::SentPacket& sent_packet) { | 2223 const rtc::SentPacket& sent_packet) { |
| 2210 RTC_DCHECK(worker_thread()->IsCurrent()); | 2224 RTC_DCHECK(worker_thread()->IsCurrent()); |
| 2211 media_controller_->call_w()->OnSentPacket(sent_packet); | 2225 media_controller_->call_w()->OnSentPacket(sent_packet); |
| 2212 } | 2226 } |
| 2213 | 2227 |
| 2214 } // namespace webrtc | 2228 } // namespace webrtc |
| OLD | NEW |