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

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

Issue 1999853002: Forward the SignalFirstPacketReceived to RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add media type to BaseChannel. 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
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 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 bundle_transport, create_rtcp_transport_channel, audio_options_)); 1810 bundle_transport, create_rtcp_transport_channel, audio_options_));
1811 if (!voice_channel_) { 1811 if (!voice_channel_) {
1812 return false; 1812 return false;
1813 } 1813 }
1814 if (require_rtcp_mux) { 1814 if (require_rtcp_mux) {
1815 voice_channel_->ActivateRtcpMux(); 1815 voice_channel_->ActivateRtcpMux();
1816 } 1816 }
1817 1817
1818 voice_channel_->SignalDtlsSetupFailure.connect( 1818 voice_channel_->SignalDtlsSetupFailure.connect(
1819 this, &WebRtcSession::OnDtlsSetupFailure); 1819 this, &WebRtcSession::OnDtlsSetupFailure);
1820 voice_channel_->SignalFirstPacketReceived.connect(
1821 this, &WebRtcSession::OnChannelFirstPacketReceived);
1820 1822
1821 SignalVoiceChannelCreated(); 1823 SignalVoiceChannelCreated();
1822 voice_channel_->SignalSentPacket.connect(this, 1824 voice_channel_->SignalSentPacket.connect(this,
1823 &WebRtcSession::OnSentPacket_w); 1825 &WebRtcSession::OnSentPacket_w);
1824 return true; 1826 return true;
1825 } 1827 }
1826 1828
1827 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, 1829 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content,
1828 const std::string* bundle_transport) { 1830 const std::string* bundle_transport) {
1829 bool require_rtcp_mux = 1831 bool require_rtcp_mux =
1830 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; 1832 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire;
1831 bool create_rtcp_transport_channel = !require_rtcp_mux; 1833 bool create_rtcp_transport_channel = !require_rtcp_mux;
1832 video_channel_.reset(channel_manager_->CreateVideoChannel( 1834 video_channel_.reset(channel_manager_->CreateVideoChannel(
1833 media_controller_, transport_controller_.get(), content->name, 1835 media_controller_, transport_controller_.get(), content->name,
1834 bundle_transport, create_rtcp_transport_channel, video_options_)); 1836 bundle_transport, create_rtcp_transport_channel, video_options_));
1835 if (!video_channel_) { 1837 if (!video_channel_) {
1836 return false; 1838 return false;
1837 } 1839 }
1838 if (require_rtcp_mux) { 1840 if (require_rtcp_mux) {
1839 video_channel_->ActivateRtcpMux(); 1841 video_channel_->ActivateRtcpMux();
1840 } 1842 }
1841 video_channel_->SignalDtlsSetupFailure.connect( 1843 video_channel_->SignalDtlsSetupFailure.connect(
1842 this, &WebRtcSession::OnDtlsSetupFailure); 1844 this, &WebRtcSession::OnDtlsSetupFailure);
1845 video_channel_->SignalFirstPacketReceived.connect(
1846 this, &WebRtcSession::OnChannelFirstPacketReceived);
1843 1847
1844 SignalVideoChannelCreated(); 1848 SignalVideoChannelCreated();
1845 video_channel_->SignalSentPacket.connect(this, 1849 video_channel_->SignalSentPacket.connect(this,
1846 &WebRtcSession::OnSentPacket_w); 1850 &WebRtcSession::OnSentPacket_w);
1847 return true; 1851 return true;
1848 } 1852 }
1849 1853
1850 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, 1854 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content,
1851 const std::string* bundle_transport) { 1855 const std::string* bundle_transport) {
1852 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); 1856 bool sctp = (data_channel_type_ == cricket::DCT_SCTP);
(...skipping 21 matching lines...) Expand all
1874 SignalDataChannelCreated(); 1878 SignalDataChannelCreated();
1875 data_channel_->SignalSentPacket.connect(this, &WebRtcSession::OnSentPacket_w); 1879 data_channel_->SignalSentPacket.connect(this, &WebRtcSession::OnSentPacket_w);
1876 return true; 1880 return true;
1877 } 1881 }
1878 1882
1879 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { 1883 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) {
1880 SetError(ERROR_TRANSPORT, 1884 SetError(ERROR_TRANSPORT,
1881 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); 1885 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp);
1882 } 1886 }
1883 1887
1888 void WebRtcSession::OnChannelFirstPacketReceived(
1889 cricket::BaseChannel* channel) {
1890 ASSERT(signaling_thread()->IsCurrent());
1891
1892 if (!has_received_audio_packet_ &&
1893 channel->MediaType() == cricket::MEDIA_TYPE_AUDIO) {
1894 has_received_audio_packet_ = true;
pthatcher1 2016/06/08 17:35:55 To be consistent with naming, might as well call i
Zhi Huang 2016/06/09 00:37:36 Done.
1895 SignalFirstAudioPacketReceived();
1896 } else if (!has_received_video_packet_ &&
1897 channel->MediaType() == cricket::MEDIA_TYPE_VIDEO) {
1898 has_received_video_packet_ = true;
1899 SignalFirstVideoPacketReceived();
1900 }
1901 }
1902
1884 void WebRtcSession::OnDataChannelMessageReceived( 1903 void WebRtcSession::OnDataChannelMessageReceived(
1885 cricket::DataChannel* channel, 1904 cricket::DataChannel* channel,
1886 const cricket::ReceiveDataParams& params, 1905 const cricket::ReceiveDataParams& params,
1887 const rtc::CopyOnWriteBuffer& payload) { 1906 const rtc::CopyOnWriteBuffer& payload) {
1888 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); 1907 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP);
1889 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { 1908 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) {
1890 // Received OPEN message; parse and signal that a new data channel should 1909 // Received OPEN message; parse and signal that a new data channel should
1891 // be created. 1910 // be created.
1892 std::string label; 1911 std::string label;
1893 InternalDataChannelInit config; 1912 InternalDataChannelInit config;
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2192 ssl_cipher_suite); 2211 ssl_cipher_suite);
2193 } 2212 }
2194 } 2213 }
2195 2214
2196 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) { 2215 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) {
2197 RTC_DCHECK(worker_thread()->IsCurrent()); 2216 RTC_DCHECK(worker_thread()->IsCurrent());
2198 media_controller_->call_w()->OnSentPacket(sent_packet); 2217 media_controller_->call_w()->OnSentPacket(sent_packet);
2199 } 2218 }
2200 2219
2201 } // namespace webrtc 2220 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698