OLD | NEW |
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 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 bundle_transport, create_rtcp_transport_channel, audio_options_)); | 1760 bundle_transport, create_rtcp_transport_channel, audio_options_)); |
1761 if (!voice_channel_) { | 1761 if (!voice_channel_) { |
1762 return false; | 1762 return false; |
1763 } | 1763 } |
1764 if (require_rtcp_mux) { | 1764 if (require_rtcp_mux) { |
1765 voice_channel_->ActivateRtcpMux(); | 1765 voice_channel_->ActivateRtcpMux(); |
1766 } | 1766 } |
1767 | 1767 |
1768 voice_channel_->SignalDtlsSetupFailure.connect( | 1768 voice_channel_->SignalDtlsSetupFailure.connect( |
1769 this, &WebRtcSession::OnDtlsSetupFailure); | 1769 this, &WebRtcSession::OnDtlsSetupFailure); |
| 1770 voice_channel_->SignalFirstPacketReceived.connect( |
| 1771 this, &WebRtcSession::OnChannelFirstPacketReceived); |
1770 | 1772 |
1771 SignalVoiceChannelCreated(); | 1773 SignalVoiceChannelCreated(); |
1772 voice_channel_->SignalSentPacket.connect(this, | 1774 voice_channel_->SignalSentPacket.connect(this, |
1773 &WebRtcSession::OnSentPacket_w); | 1775 &WebRtcSession::OnSentPacket_w); |
1774 return true; | 1776 return true; |
1775 } | 1777 } |
1776 | 1778 |
1777 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, | 1779 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, |
1778 const std::string* bundle_transport) { | 1780 const std::string* bundle_transport) { |
1779 bool require_rtcp_mux = | 1781 bool require_rtcp_mux = |
1780 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1782 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
1781 bool create_rtcp_transport_channel = !require_rtcp_mux; | 1783 bool create_rtcp_transport_channel = !require_rtcp_mux; |
1782 video_channel_.reset(channel_manager_->CreateVideoChannel( | 1784 video_channel_.reset(channel_manager_->CreateVideoChannel( |
1783 media_controller_, transport_controller_.get(), content->name, | 1785 media_controller_, transport_controller_.get(), content->name, |
1784 bundle_transport, create_rtcp_transport_channel, video_options_)); | 1786 bundle_transport, create_rtcp_transport_channel, video_options_)); |
1785 if (!video_channel_) { | 1787 if (!video_channel_) { |
1786 return false; | 1788 return false; |
1787 } | 1789 } |
1788 if (require_rtcp_mux) { | 1790 if (require_rtcp_mux) { |
1789 video_channel_->ActivateRtcpMux(); | 1791 video_channel_->ActivateRtcpMux(); |
1790 } | 1792 } |
1791 video_channel_->SignalDtlsSetupFailure.connect( | 1793 video_channel_->SignalDtlsSetupFailure.connect( |
1792 this, &WebRtcSession::OnDtlsSetupFailure); | 1794 this, &WebRtcSession::OnDtlsSetupFailure); |
| 1795 video_channel_->SignalFirstPacketReceived.connect( |
| 1796 this, &WebRtcSession::OnChannelFirstPacketReceived); |
1793 | 1797 |
1794 SignalVideoChannelCreated(); | 1798 SignalVideoChannelCreated(); |
1795 video_channel_->SignalSentPacket.connect(this, | 1799 video_channel_->SignalSentPacket.connect(this, |
1796 &WebRtcSession::OnSentPacket_w); | 1800 &WebRtcSession::OnSentPacket_w); |
1797 return true; | 1801 return true; |
1798 } | 1802 } |
1799 | 1803 |
1800 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, | 1804 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, |
1801 const std::string* bundle_transport) { | 1805 const std::string* bundle_transport) { |
1802 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); | 1806 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); |
(...skipping 21 matching lines...) Expand all Loading... |
1824 SignalDataChannelCreated(); | 1828 SignalDataChannelCreated(); |
1825 data_channel_->SignalSentPacket.connect(this, &WebRtcSession::OnSentPacket_w); | 1829 data_channel_->SignalSentPacket.connect(this, &WebRtcSession::OnSentPacket_w); |
1826 return true; | 1830 return true; |
1827 } | 1831 } |
1828 | 1832 |
1829 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { | 1833 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { |
1830 SetError(ERROR_TRANSPORT, | 1834 SetError(ERROR_TRANSPORT, |
1831 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); | 1835 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); |
1832 } | 1836 } |
1833 | 1837 |
| 1838 void WebRtcSession::OnChannelFirstPacketReceived( |
| 1839 cricket::BaseChannel* channel) { |
| 1840 ASSERT(signaling_thread()->IsCurrent()); |
| 1841 |
| 1842 if (!received_first_audio_packet_ && |
| 1843 channel->media_type() == cricket::MEDIA_TYPE_AUDIO) { |
| 1844 received_first_audio_packet_ = true; |
| 1845 SignalFirstAudioPacketReceived(); |
| 1846 } else if (!received_first_video_packet_ && |
| 1847 channel->media_type() == cricket::MEDIA_TYPE_VIDEO) { |
| 1848 received_first_video_packet_ = true; |
| 1849 SignalFirstVideoPacketReceived(); |
| 1850 } |
| 1851 } |
| 1852 |
1834 void WebRtcSession::OnDataChannelMessageReceived( | 1853 void WebRtcSession::OnDataChannelMessageReceived( |
1835 cricket::DataChannel* channel, | 1854 cricket::DataChannel* channel, |
1836 const cricket::ReceiveDataParams& params, | 1855 const cricket::ReceiveDataParams& params, |
1837 const rtc::CopyOnWriteBuffer& payload) { | 1856 const rtc::CopyOnWriteBuffer& payload) { |
1838 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); | 1857 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); |
1839 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { | 1858 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { |
1840 // Received OPEN message; parse and signal that a new data channel should | 1859 // Received OPEN message; parse and signal that a new data channel should |
1841 // be created. | 1860 // be created. |
1842 std::string label; | 1861 std::string label; |
1843 InternalDataChannelInit config; | 1862 InternalDataChannelInit config; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 ssl_cipher_suite); | 2161 ssl_cipher_suite); |
2143 } | 2162 } |
2144 } | 2163 } |
2145 | 2164 |
2146 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) { | 2165 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) { |
2147 RTC_DCHECK(worker_thread()->IsCurrent()); | 2166 RTC_DCHECK(worker_thread()->IsCurrent()); |
2148 media_controller_->call_w()->OnSentPacket(sent_packet); | 2167 media_controller_->call_w()->OnSentPacket(sent_packet); |
2149 } | 2168 } |
2150 | 2169 |
2151 } // namespace webrtc | 2170 } // namespace webrtc |
OLD | NEW |