OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 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 11 matching lines...) Expand all Loading... |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "talk/session/media/channel.h" | 28 #include "talk/session/media/channel.h" |
29 | 29 |
30 #include "talk/media/base/constants.h" | 30 #include "talk/media/base/constants.h" |
31 #include "talk/media/base/rtputils.h" | 31 #include "talk/media/base/rtputils.h" |
32 #include "webrtc/p2p/base/transportchannel.h" | |
33 #include "talk/session/media/channelmanager.h" | 32 #include "talk/session/media/channelmanager.h" |
34 #include "webrtc/base/bind.h" | 33 #include "webrtc/base/bind.h" |
35 #include "webrtc/base/buffer.h" | 34 #include "webrtc/base/buffer.h" |
36 #include "webrtc/base/byteorder.h" | 35 #include "webrtc/base/byteorder.h" |
37 #include "webrtc/base/common.h" | 36 #include "webrtc/base/common.h" |
38 #include "webrtc/base/dscp.h" | 37 #include "webrtc/base/dscp.h" |
39 #include "webrtc/base/logging.h" | 38 #include "webrtc/base/logging.h" |
| 39 #include "webrtc/base/trace_event.h" |
| 40 #include "webrtc/p2p/base/transportchannel.h" |
40 | 41 |
41 namespace cricket { | 42 namespace cricket { |
42 | 43 |
43 using rtc::Bind; | 44 using rtc::Bind; |
44 | 45 |
45 enum { | 46 enum { |
46 MSG_EARLYMEDIATIMEOUT = 1, | 47 MSG_EARLYMEDIATIMEOUT = 1, |
47 MSG_SCREENCASTWINDOWEVENT, | 48 MSG_SCREENCASTWINDOWEVENT, |
48 MSG_RTPPACKET, | 49 MSG_RTPPACKET, |
49 MSG_RTCPPACKET, | 50 MSG_RTCPPACKET, |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 465 |
465 void BaseChannel::OnWritableState(TransportChannel* channel) { | 466 void BaseChannel::OnWritableState(TransportChannel* channel) { |
466 ASSERT(channel == transport_channel_ || channel == rtcp_transport_channel_); | 467 ASSERT(channel == transport_channel_ || channel == rtcp_transport_channel_); |
467 UpdateWritableState_w(); | 468 UpdateWritableState_w(); |
468 } | 469 } |
469 | 470 |
470 void BaseChannel::OnChannelRead(TransportChannel* channel, | 471 void BaseChannel::OnChannelRead(TransportChannel* channel, |
471 const char* data, size_t len, | 472 const char* data, size_t len, |
472 const rtc::PacketTime& packet_time, | 473 const rtc::PacketTime& packet_time, |
473 int flags) { | 474 int flags) { |
| 475 TRACE_EVENT0("webrtc", "BaseChannel::OnChannelRead"); |
474 // OnChannelRead gets called from P2PSocket; now pass data to MediaEngine | 476 // OnChannelRead gets called from P2PSocket; now pass data to MediaEngine |
475 ASSERT(worker_thread_ == rtc::Thread::Current()); | 477 ASSERT(worker_thread_ == rtc::Thread::Current()); |
476 | 478 |
477 // When using RTCP multiplexing we might get RTCP packets on the RTP | 479 // When using RTCP multiplexing we might get RTCP packets on the RTP |
478 // transport. We feed RTP traffic into the demuxer to determine if it is RTCP. | 480 // transport. We feed RTP traffic into the demuxer to determine if it is RTCP. |
479 bool rtcp = PacketIsRtcp(channel, data, len); | 481 bool rtcp = PacketIsRtcp(channel, data, len); |
480 rtc::Buffer packet(data, len); | 482 rtc::Buffer packet(data, len); |
481 HandlePacket(rtcp, &packet, packet_time); | 483 HandlePacket(rtcp, &packet, packet_time); |
482 } | 484 } |
483 | 485 |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 | 1267 |
1266 void BaseChannel::MaybeCacheRtpAbsSendTimeHeaderExtension( | 1268 void BaseChannel::MaybeCacheRtpAbsSendTimeHeaderExtension( |
1267 const std::vector<RtpHeaderExtension>& extensions) { | 1269 const std::vector<RtpHeaderExtension>& extensions) { |
1268 const RtpHeaderExtension* send_time_extension = | 1270 const RtpHeaderExtension* send_time_extension = |
1269 FindHeaderExtension(extensions, kRtpAbsoluteSenderTimeHeaderExtension); | 1271 FindHeaderExtension(extensions, kRtpAbsoluteSenderTimeHeaderExtension); |
1270 rtp_abs_sendtime_extn_id_ = | 1272 rtp_abs_sendtime_extn_id_ = |
1271 send_time_extension ? send_time_extension->id : -1; | 1273 send_time_extension ? send_time_extension->id : -1; |
1272 } | 1274 } |
1273 | 1275 |
1274 void BaseChannel::OnMessage(rtc::Message *pmsg) { | 1276 void BaseChannel::OnMessage(rtc::Message *pmsg) { |
| 1277 TRACE_EVENT0("webrtc", "BaseChannel::OnMessage"); |
1275 switch (pmsg->message_id) { | 1278 switch (pmsg->message_id) { |
1276 case MSG_RTPPACKET: | 1279 case MSG_RTPPACKET: |
1277 case MSG_RTCPPACKET: { | 1280 case MSG_RTCPPACKET: { |
1278 PacketMessageData* data = static_cast<PacketMessageData*>(pmsg->pdata); | 1281 PacketMessageData* data = static_cast<PacketMessageData*>(pmsg->pdata); |
1279 SendPacket(pmsg->message_id == MSG_RTCPPACKET, &data->packet, | 1282 SendPacket(pmsg->message_id == MSG_RTCPPACKET, &data->packet, |
1280 data->options); | 1283 data->options); |
1281 delete data; // because it is Posted | 1284 delete data; // because it is Posted |
1282 break; | 1285 break; |
1283 } | 1286 } |
1284 case MSG_FIRSTPACKETRECEIVED: { | 1287 case MSG_FIRSTPACKETRECEIVED: { |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2302 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); | 2305 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
2303 } | 2306 } |
2304 | 2307 |
2305 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2308 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
2306 rtc::TypedMessageData<uint32_t>* message = | 2309 rtc::TypedMessageData<uint32_t>* message = |
2307 new rtc::TypedMessageData<uint32_t>(sid); | 2310 new rtc::TypedMessageData<uint32_t>(sid); |
2308 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2311 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2309 } | 2312 } |
2310 | 2313 |
2311 } // namespace cricket | 2314 } // namespace cricket |
OLD | NEW |