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

Side by Side Diff: talk/session/media/channel.cc

Issue 1457383002: Implement standalone event tracing in AppRTCDemo. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years 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 * 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
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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 453
453 void BaseChannel::OnWritableState(TransportChannel* channel) { 454 void BaseChannel::OnWritableState(TransportChannel* channel) {
454 ASSERT(channel == transport_channel_ || channel == rtcp_transport_channel_); 455 ASSERT(channel == transport_channel_ || channel == rtcp_transport_channel_);
455 UpdateWritableState_w(); 456 UpdateWritableState_w();
456 } 457 }
457 458
458 void BaseChannel::OnChannelRead(TransportChannel* channel, 459 void BaseChannel::OnChannelRead(TransportChannel* channel,
459 const char* data, size_t len, 460 const char* data, size_t len,
460 const rtc::PacketTime& packet_time, 461 const rtc::PacketTime& packet_time,
461 int flags) { 462 int flags) {
463 TRACE_EVENT0("webrtc", "BaseChannel::OnChannelRead");
462 // OnChannelRead gets called from P2PSocket; now pass data to MediaEngine 464 // OnChannelRead gets called from P2PSocket; now pass data to MediaEngine
463 ASSERT(worker_thread_ == rtc::Thread::Current()); 465 ASSERT(worker_thread_ == rtc::Thread::Current());
464 466
465 // When using RTCP multiplexing we might get RTCP packets on the RTP 467 // When using RTCP multiplexing we might get RTCP packets on the RTP
466 // transport. We feed RTP traffic into the demuxer to determine if it is RTCP. 468 // transport. We feed RTP traffic into the demuxer to determine if it is RTCP.
467 bool rtcp = PacketIsRtcp(channel, data, len); 469 bool rtcp = PacketIsRtcp(channel, data, len);
468 rtc::Buffer packet(data, len); 470 rtc::Buffer packet(data, len);
469 HandlePacket(rtcp, &packet, packet_time); 471 HandlePacket(rtcp, &packet, packet_time);
470 } 472 }
471 473
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 1231
1230 void BaseChannel::MaybeCacheRtpAbsSendTimeHeaderExtension( 1232 void BaseChannel::MaybeCacheRtpAbsSendTimeHeaderExtension(
1231 const std::vector<RtpHeaderExtension>& extensions) { 1233 const std::vector<RtpHeaderExtension>& extensions) {
1232 const RtpHeaderExtension* send_time_extension = 1234 const RtpHeaderExtension* send_time_extension =
1233 FindHeaderExtension(extensions, kRtpAbsoluteSenderTimeHeaderExtension); 1235 FindHeaderExtension(extensions, kRtpAbsoluteSenderTimeHeaderExtension);
1234 rtp_abs_sendtime_extn_id_ = 1236 rtp_abs_sendtime_extn_id_ =
1235 send_time_extension ? send_time_extension->id : -1; 1237 send_time_extension ? send_time_extension->id : -1;
1236 } 1238 }
1237 1239
1238 void BaseChannel::OnMessage(rtc::Message *pmsg) { 1240 void BaseChannel::OnMessage(rtc::Message *pmsg) {
1241 TRACE_EVENT0("webrtc", "BaseChannel::OnMessage");
1239 switch (pmsg->message_id) { 1242 switch (pmsg->message_id) {
1240 case MSG_RTPPACKET: 1243 case MSG_RTPPACKET:
1241 case MSG_RTCPPACKET: { 1244 case MSG_RTCPPACKET: {
1242 PacketMessageData* data = static_cast<PacketMessageData*>(pmsg->pdata); 1245 PacketMessageData* data = static_cast<PacketMessageData*>(pmsg->pdata);
1243 SendPacket(pmsg->message_id == MSG_RTCPPACKET, &data->packet, 1246 SendPacket(pmsg->message_id == MSG_RTCPPACKET, &data->packet,
1244 data->options); 1247 data->options);
1245 delete data; // because it is Posted 1248 delete data; // because it is Posted
1246 break; 1249 break;
1247 } 1250 }
1248 case MSG_FIRSTPACKETRECEIVED: { 1251 case MSG_FIRSTPACKETRECEIVED: {
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 return (data_channel_type_ == DCT_RTP); 2281 return (data_channel_type_ == DCT_RTP);
2279 } 2282 }
2280 2283
2281 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { 2284 void DataChannel::OnStreamClosedRemotely(uint32_t sid) {
2282 rtc::TypedMessageData<uint32_t>* message = 2285 rtc::TypedMessageData<uint32_t>* message =
2283 new rtc::TypedMessageData<uint32_t>(sid); 2286 new rtc::TypedMessageData<uint32_t>(sid);
2284 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); 2287 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message);
2285 } 2288 }
2286 2289
2287 } // namespace cricket 2290 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698