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( |
(...skipping 14 matching lines...) Expand all Loading... |
1888 data_channel_->transport_channel()->SignalSentPacket.connect( | 1892 data_channel_->transport_channel()->SignalSentPacket.connect( |
1889 this, &WebRtcSession::OnSentPacket_w); | 1893 this, &WebRtcSession::OnSentPacket_w); |
1890 return true; | 1894 return true; |
1891 } | 1895 } |
1892 | 1896 |
1893 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { | 1897 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { |
1894 SetError(ERROR_TRANSPORT, | 1898 SetError(ERROR_TRANSPORT, |
1895 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); | 1899 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); |
1896 } | 1900 } |
1897 | 1901 |
| 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 |
1898 void WebRtcSession::OnDataChannelMessageReceived( | 1910 void WebRtcSession::OnDataChannelMessageReceived( |
1899 cricket::DataChannel* channel, | 1911 cricket::DataChannel* channel, |
1900 const cricket::ReceiveDataParams& params, | 1912 const cricket::ReceiveDataParams& params, |
1901 const rtc::Buffer& payload) { | 1913 const rtc::Buffer& payload) { |
1902 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); | 1914 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); |
1903 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { | 1915 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { |
1904 // Received OPEN message; parse and signal that a new data channel should | 1916 // Received OPEN message; parse and signal that a new data channel should |
1905 // be created. | 1917 // be created. |
1906 std::string label; | 1918 std::string label; |
1907 InternalDataChannelInit config; | 1919 InternalDataChannelInit config; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2205 } | 2217 } |
2206 } | 2218 } |
2207 | 2219 |
2208 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, | 2220 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, |
2209 const rtc::SentPacket& sent_packet) { | 2221 const rtc::SentPacket& sent_packet) { |
2210 RTC_DCHECK(worker_thread()->IsCurrent()); | 2222 RTC_DCHECK(worker_thread()->IsCurrent()); |
2211 media_controller_->call_w()->OnSentPacket(sent_packet); | 2223 media_controller_->call_w()->OnSentPacket(sent_packet); |
2212 } | 2224 } |
2213 | 2225 |
2214 } // namespace webrtc | 2226 } // namespace webrtc |
OLD | NEW |