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); | |
1849 | 1847 |
1850 SignalVoiceChannelCreated(); | 1848 SignalVoiceChannelCreated(); |
1851 voice_channel_->transport_channel()->SignalSentPacket.connect( | 1849 voice_channel_->transport_channel()->SignalSentPacket.connect( |
1852 this, &WebRtcSession::OnSentPacket_w); | 1850 this, &WebRtcSession::OnSentPacket_w); |
1853 return true; | 1851 return true; |
1854 } | 1852 } |
1855 | 1853 |
1856 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { | 1854 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { |
1857 video_channel_.reset(channel_manager_->CreateVideoChannel( | 1855 video_channel_.reset(channel_manager_->CreateVideoChannel( |
1858 media_controller_, transport_controller_.get(), content->name, true, | 1856 media_controller_, transport_controller_.get(), content->name, true, |
1859 video_options_)); | 1857 video_options_)); |
1860 if (!video_channel_) { | 1858 if (!video_channel_) { |
1861 return false; | 1859 return false; |
1862 } | 1860 } |
1863 | 1861 |
1864 video_channel_->SignalDtlsSetupFailure.connect( | 1862 video_channel_->SignalDtlsSetupFailure.connect( |
1865 this, &WebRtcSession::OnDtlsSetupFailure); | 1863 this, &WebRtcSession::OnDtlsSetupFailure); |
1866 video_channel_->SignalFirstPacketReceived.connect( | |
1867 this, &WebRtcSession::OnChannelFirstPacketReceived); | |
1868 | 1864 |
1869 SignalVideoChannelCreated(); | 1865 SignalVideoChannelCreated(); |
1870 video_channel_->transport_channel()->SignalSentPacket.connect( | 1866 video_channel_->transport_channel()->SignalSentPacket.connect( |
1871 this, &WebRtcSession::OnSentPacket_w); | 1867 this, &WebRtcSession::OnSentPacket_w); |
1872 return true; | 1868 return true; |
1873 } | 1869 } |
1874 | 1870 |
1875 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) { | 1871 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) { |
1876 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); | 1872 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); |
1877 data_channel_.reset(channel_manager_->CreateDataChannel( | 1873 data_channel_.reset(channel_manager_->CreateDataChannel( |
(...skipping 14 matching lines...) Expand all Loading... |
1892 data_channel_->transport_channel()->SignalSentPacket.connect( | 1888 data_channel_->transport_channel()->SignalSentPacket.connect( |
1893 this, &WebRtcSession::OnSentPacket_w); | 1889 this, &WebRtcSession::OnSentPacket_w); |
1894 return true; | 1890 return true; |
1895 } | 1891 } |
1896 | 1892 |
1897 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { | 1893 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { |
1898 SetError(ERROR_TRANSPORT, | 1894 SetError(ERROR_TRANSPORT, |
1899 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); | 1895 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); |
1900 } | 1896 } |
1901 | 1897 |
1902 void WebRtcSession::OnChannelFirstPacketReceived(cricket::BaseChannel*) { | |
1903 ASSERT(signaling_thread()->IsCurrent()); | |
1904 if (!has_received_media_packet_) { | |
1905 has_received_media_packet_ = true; | |
1906 SignalFirstMediaPacketReceived(); | |
1907 } | |
1908 } | |
1909 | |
1910 void WebRtcSession::OnDataChannelMessageReceived( | 1898 void WebRtcSession::OnDataChannelMessageReceived( |
1911 cricket::DataChannel* channel, | 1899 cricket::DataChannel* channel, |
1912 const cricket::ReceiveDataParams& params, | 1900 const cricket::ReceiveDataParams& params, |
1913 const rtc::Buffer& payload) { | 1901 const rtc::Buffer& payload) { |
1914 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); | 1902 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); |
1915 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { | 1903 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { |
1916 // Received OPEN message; parse and signal that a new data channel should | 1904 // Received OPEN message; parse and signal that a new data channel should |
1917 // be created. | 1905 // be created. |
1918 std::string label; | 1906 std::string label; |
1919 InternalDataChannelInit config; | 1907 InternalDataChannelInit config; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2217 } | 2205 } |
2218 } | 2206 } |
2219 | 2207 |
2220 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, | 2208 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, |
2221 const rtc::SentPacket& sent_packet) { | 2209 const rtc::SentPacket& sent_packet) { |
2222 RTC_DCHECK(worker_thread()->IsCurrent()); | 2210 RTC_DCHECK(worker_thread()->IsCurrent()); |
2223 media_controller_->call_w()->OnSentPacket(sent_packet); | 2211 media_controller_->call_w()->OnSentPacket(sent_packet); |
2224 } | 2212 } |
2225 | 2213 |
2226 } // namespace webrtc | 2214 } // namespace webrtc |
OLD | NEW |