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 12 matching lines...) Expand all Loading... | |
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" | 32 #include "webrtc/p2p/base/transportchannel.h" |
33 #include "talk/app/webrtc/mediacontroller.h" | |
33 #include "talk/session/media/channelmanager.h" | 34 #include "talk/session/media/channelmanager.h" |
34 #include "webrtc/base/bind.h" | 35 #include "webrtc/base/bind.h" |
35 #include "webrtc/base/buffer.h" | 36 #include "webrtc/base/buffer.h" |
36 #include "webrtc/base/byteorder.h" | 37 #include "webrtc/base/byteorder.h" |
37 #include "webrtc/base/common.h" | 38 #include "webrtc/base/common.h" |
38 #include "webrtc/base/dscp.h" | 39 #include "webrtc/base/dscp.h" |
39 #include "webrtc/base/logging.h" | 40 #include "webrtc/base/logging.h" |
41 #include "webrtc/call.h" | |
42 #include "webrtc/common_types.h" | |
40 | 43 |
41 namespace cricket { | 44 namespace cricket { |
42 | 45 |
43 using rtc::Bind; | 46 using rtc::Bind; |
44 | 47 |
45 enum { | 48 enum { |
46 MSG_EARLYMEDIATIMEOUT = 1, | 49 MSG_EARLYMEDIATIMEOUT = 1, |
47 MSG_SCREENCASTWINDOWEVENT, | 50 MSG_SCREENCASTWINDOWEVENT, |
48 MSG_RTPPACKET, | 51 MSG_RTPPACKET, |
49 MSG_RTCPPACKET, | 52 MSG_RTCPPACKET, |
(...skipping 10 matching lines...) Expand all Loading... | |
60 static const int kAgcMinus10db = -10; | 63 static const int kAgcMinus10db = -10; |
61 | 64 |
62 static void SafeSetError(const std::string& message, std::string* error_desc) { | 65 static void SafeSetError(const std::string& message, std::string* error_desc) { |
63 if (error_desc) { | 66 if (error_desc) { |
64 *error_desc = message; | 67 *error_desc = message; |
65 } | 68 } |
66 } | 69 } |
67 | 70 |
68 struct PacketMessageData : public rtc::MessageData { | 71 struct PacketMessageData : public rtc::MessageData { |
69 rtc::Buffer packet; | 72 rtc::Buffer packet; |
70 rtc::DiffServCodePoint dscp; | 73 rtc::PacketOptions options; |
71 }; | 74 }; |
72 | 75 |
73 struct ScreencastEventMessageData : public rtc::MessageData { | 76 struct ScreencastEventMessageData : public rtc::MessageData { |
74 ScreencastEventMessageData(uint32 s, rtc::WindowEvent we) | 77 ScreencastEventMessageData(uint32 s, rtc::WindowEvent we) |
75 : ssrc(s), | 78 : ssrc(s), |
76 event(we) { | 79 event(we) { |
77 } | 80 } |
78 uint32 ssrc; | 81 uint32 ssrc; |
79 rtc::WindowEvent event; | 82 rtc::WindowEvent event; |
80 }; | 83 }; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 template <class Codec, class Options> | 167 template <class Codec, class Options> |
165 void RtpSendParametersFromMediaDescription( | 168 void RtpSendParametersFromMediaDescription( |
166 const MediaContentDescriptionImpl<Codec>* desc, | 169 const MediaContentDescriptionImpl<Codec>* desc, |
167 RtpSendParameters<Codec, Options>* send_params) { | 170 RtpSendParameters<Codec, Options>* send_params) { |
168 RtpParametersFromMediaDescription(desc, send_params); | 171 RtpParametersFromMediaDescription(desc, send_params); |
169 send_params->max_bandwidth_bps = desc->bandwidth(); | 172 send_params->max_bandwidth_bps = desc->bandwidth(); |
170 } | 173 } |
171 | 174 |
172 BaseChannel::BaseChannel(rtc::Thread* thread, | 175 BaseChannel::BaseChannel(rtc::Thread* thread, |
173 MediaChannel* media_channel, | 176 MediaChannel* media_channel, |
177 webrtc::MediaControllerInterface* media_controller, | |
174 TransportController* transport_controller, | 178 TransportController* transport_controller, |
175 const std::string& content_name, | 179 const std::string& content_name, |
176 bool rtcp) | 180 bool rtcp) |
177 : worker_thread_(thread), | 181 : worker_thread_(thread), |
178 transport_controller_(transport_controller), | 182 transport_controller_(transport_controller), |
179 media_channel_(media_channel), | 183 media_channel_(media_channel), |
184 media_controller_(media_controller), | |
180 content_name_(content_name), | 185 content_name_(content_name), |
181 rtcp_transport_enabled_(rtcp), | 186 rtcp_transport_enabled_(rtcp), |
182 transport_channel_(nullptr), | 187 transport_channel_(nullptr), |
183 rtcp_transport_channel_(nullptr), | 188 rtcp_transport_channel_(nullptr), |
184 enabled_(false), | 189 enabled_(false), |
185 writable_(false), | 190 writable_(false), |
186 rtp_ready_to_send_(false), | 191 rtp_ready_to_send_(false), |
187 rtcp_ready_to_send_(false), | 192 rtcp_ready_to_send_(false), |
188 was_ever_writable_(false), | 193 was_ever_writable_(false), |
189 local_content_direction_(MD_INACTIVE), | 194 local_content_direction_(MD_INACTIVE), |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 UpdateWritableState_w(); | 342 UpdateWritableState_w(); |
338 SetReadyToSend(true, new_tc && new_tc->writable()); | 343 SetReadyToSend(true, new_tc && new_tc->writable()); |
339 } | 344 } |
340 | 345 |
341 void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) { | 346 void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) { |
342 ASSERT(worker_thread_ == rtc::Thread::Current()); | 347 ASSERT(worker_thread_ == rtc::Thread::Current()); |
343 | 348 |
344 tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState); | 349 tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState); |
345 tc->SignalReadPacket.connect(this, &BaseChannel::OnChannelRead); | 350 tc->SignalReadPacket.connect(this, &BaseChannel::OnChannelRead); |
346 tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend); | 351 tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend); |
352 media_controller_->ConnectTransportChannel(tc); | |
pthatcher1
2015/10/07 16:44:38
This isn't quite the right place to put this, sinc
stefan-webrtc
2015/10/08 12:53:45
Ok, that won't cause problems if the transport cha
pthatcher1
2015/10/08 20:27:55
You can connect before or after EnableBundle. The
stefan-webrtc
2015/10/09 14:18:44
Acknowledged.
| |
347 } | 353 } |
348 | 354 |
349 void BaseChannel::DisconnectFromTransportChannel(TransportChannel* tc) { | 355 void BaseChannel::DisconnectFromTransportChannel(TransportChannel* tc) { |
350 ASSERT(worker_thread_ == rtc::Thread::Current()); | 356 ASSERT(worker_thread_ == rtc::Thread::Current()); |
351 | 357 |
352 tc->SignalWritableState.disconnect(this); | 358 tc->SignalWritableState.disconnect(this); |
353 tc->SignalReadPacket.disconnect(this); | 359 tc->SignalReadPacket.disconnect(this); |
354 tc->SignalReadyToSend.disconnect(this); | 360 tc->SignalReadyToSend.disconnect(this); |
361 media_controller_->DisconnectTransportChannel(tc); | |
pthatcher1
2015/10/07 16:44:38
Woh, this won't work. If two BaseChannels share a
stefan-webrtc
2015/10/07 16:55:25
Very good point. I will look at these comments lat
stefan-webrtc
2015/10/08 12:53:45
I assume media controller is guaranteed to outlive
pthatcher1
2015/10/08 20:27:55
Yes, a MediaController has to outlive all the Base
stefan-webrtc
2015/10/09 14:18:44
No problem, I prefer to do the right thing here an
| |
355 } | 362 } |
356 | 363 |
357 bool BaseChannel::Enable(bool enable) { | 364 bool BaseChannel::Enable(bool enable) { |
358 worker_thread_->Invoke<void>(Bind( | 365 worker_thread_->Invoke<void>(Bind( |
359 enable ? &BaseChannel::EnableMedia_w : &BaseChannel::DisableMedia_w, | 366 enable ? &BaseChannel::EnableMedia_w : &BaseChannel::DisableMedia_w, |
360 this)); | 367 this)); |
361 return true; | 368 return true; |
362 } | 369 } |
363 | 370 |
364 bool BaseChannel::AddRecvStream(const StreamParams& sp) { | 371 bool BaseChannel::AddRecvStream(const StreamParams& sp) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 bool BaseChannel::IsReadyToSend() const { | 431 bool BaseChannel::IsReadyToSend() const { |
425 // Send outgoing data if we are enabled, have local and remote content, | 432 // Send outgoing data if we are enabled, have local and remote content, |
426 // and we have had some form of connectivity. | 433 // and we have had some form of connectivity. |
427 return enabled() && | 434 return enabled() && |
428 IsReceiveContentDirection(remote_content_direction_) && | 435 IsReceiveContentDirection(remote_content_direction_) && |
429 IsSendContentDirection(local_content_direction_) && | 436 IsSendContentDirection(local_content_direction_) && |
430 was_ever_writable(); | 437 was_ever_writable(); |
431 } | 438 } |
432 | 439 |
433 bool BaseChannel::SendPacket(rtc::Buffer* packet, | 440 bool BaseChannel::SendPacket(rtc::Buffer* packet, |
434 rtc::DiffServCodePoint dscp) { | 441 const rtc::PacketOptions& options) { |
435 return SendPacket(false, packet, dscp); | 442 return SendPacket(false, packet, options); |
436 } | 443 } |
437 | 444 |
438 bool BaseChannel::SendRtcp(rtc::Buffer* packet, | 445 bool BaseChannel::SendRtcp(rtc::Buffer* packet, |
439 rtc::DiffServCodePoint dscp) { | 446 const rtc::PacketOptions& options) { |
440 return SendPacket(true, packet, dscp); | 447 return SendPacket(true, packet, options); |
441 } | 448 } |
442 | 449 |
443 int BaseChannel::SetOption(SocketType type, rtc::Socket::Option opt, | 450 int BaseChannel::SetOption(SocketType type, rtc::Socket::Option opt, |
444 int value) { | 451 int value) { |
445 TransportChannel* channel = NULL; | 452 TransportChannel* channel = NULL; |
446 switch (type) { | 453 switch (type) { |
447 case ST_RTP: | 454 case ST_RTP: |
448 channel = transport_channel_; | 455 channel = transport_channel_; |
449 socket_options_.push_back( | 456 socket_options_.push_back( |
450 std::pair<rtc::Socket::Option, int>(opt, value)); | 457 std::pair<rtc::Socket::Option, int>(opt, value)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 media_channel_->OnReadyToSend(false); | 506 media_channel_->OnReadyToSend(false); |
500 } | 507 } |
501 } | 508 } |
502 | 509 |
503 bool BaseChannel::PacketIsRtcp(const TransportChannel* channel, | 510 bool BaseChannel::PacketIsRtcp(const TransportChannel* channel, |
504 const char* data, size_t len) { | 511 const char* data, size_t len) { |
505 return (channel == rtcp_transport_channel_ || | 512 return (channel == rtcp_transport_channel_ || |
506 rtcp_mux_filter_.DemuxRtcp(data, static_cast<int>(len))); | 513 rtcp_mux_filter_.DemuxRtcp(data, static_cast<int>(len))); |
507 } | 514 } |
508 | 515 |
509 bool BaseChannel::SendPacket(bool rtcp, rtc::Buffer* packet, | 516 bool BaseChannel::SendPacket(bool rtcp, |
510 rtc::DiffServCodePoint dscp) { | 517 rtc::Buffer* packet, |
518 const rtc::PacketOptions& options) { | |
511 // SendPacket gets called from MediaEngine, typically on an encoder thread. | 519 // SendPacket gets called from MediaEngine, typically on an encoder thread. |
512 // If the thread is not our worker thread, we will post to our worker | 520 // If the thread is not our worker thread, we will post to our worker |
513 // so that the real work happens on our worker. This avoids us having to | 521 // so that the real work happens on our worker. This avoids us having to |
514 // synchronize access to all the pieces of the send path, including | 522 // synchronize access to all the pieces of the send path, including |
515 // SRTP and the inner workings of the transport channels. | 523 // SRTP and the inner workings of the transport channels. |
516 // The only downside is that we can't return a proper failure code if | 524 // The only downside is that we can't return a proper failure code if |
517 // needed. Since UDP is unreliable anyway, this should be a non-issue. | 525 // needed. Since UDP is unreliable anyway, this should be a non-issue. |
518 if (rtc::Thread::Current() != worker_thread_) { | 526 if (rtc::Thread::Current() != worker_thread_) { |
519 // Avoid a copy by transferring the ownership of the packet data. | 527 // Avoid a copy by transferring the ownership of the packet data. |
520 int message_id = (!rtcp) ? MSG_RTPPACKET : MSG_RTCPPACKET; | 528 int message_id = (!rtcp) ? MSG_RTPPACKET : MSG_RTCPPACKET; |
521 PacketMessageData* data = new PacketMessageData; | 529 PacketMessageData* data = new PacketMessageData; |
522 data->packet = packet->Pass(); | 530 data->packet = packet->Pass(); |
523 data->dscp = dscp; | 531 data->options = options; |
524 worker_thread_->Post(this, message_id, data); | 532 worker_thread_->Post(this, message_id, data); |
525 return true; | 533 return true; |
526 } | 534 } |
527 | 535 |
528 // Now that we are on the correct thread, ensure we have a place to send this | 536 // Now that we are on the correct thread, ensure we have a place to send this |
529 // packet before doing anything. (We might get RTCP packets that we don't | 537 // packet before doing anything. (We might get RTCP packets that we don't |
530 // intend to send.) If we've negotiated RTCP mux, send RTCP over the RTP | 538 // intend to send.) If we've negotiated RTCP mux, send RTCP over the RTP |
531 // transport. | 539 // transport. |
532 TransportChannel* channel = (!rtcp || rtcp_mux_filter_.IsActive()) ? | 540 TransportChannel* channel = (!rtcp || rtcp_mux_filter_.IsActive()) ? |
533 transport_channel_ : rtcp_transport_channel_; | 541 transport_channel_ : rtcp_transport_channel_; |
534 if (!channel || !channel->writable()) { | 542 if (!channel || !channel->writable()) { |
535 return false; | 543 return false; |
536 } | 544 } |
537 | 545 |
538 // Protect ourselves against crazy data. | 546 // Protect ourselves against crazy data. |
539 if (!ValidPacket(rtcp, packet)) { | 547 if (!ValidPacket(rtcp, packet)) { |
540 LOG(LS_ERROR) << "Dropping outgoing " << content_name_ << " " | 548 LOG(LS_ERROR) << "Dropping outgoing " << content_name_ << " " |
541 << PacketType(rtcp) | 549 << PacketType(rtcp) |
542 << " packet: wrong size=" << packet->size(); | 550 << " packet: wrong size=" << packet->size(); |
543 return false; | 551 return false; |
544 } | 552 } |
545 | 553 |
546 rtc::PacketOptions options(dscp); | 554 rtc::PacketOptions updated_options; |
555 updated_options = options; | |
547 // Protect if needed. | 556 // Protect if needed. |
548 if (srtp_filter_.IsActive()) { | 557 if (srtp_filter_.IsActive()) { |
549 bool res; | 558 bool res; |
550 uint8_t* data = packet->data(); | 559 uint8_t* data = packet->data(); |
551 int len = static_cast<int>(packet->size()); | 560 int len = static_cast<int>(packet->size()); |
552 if (!rtcp) { | 561 if (!rtcp) { |
553 // If ENABLE_EXTERNAL_AUTH flag is on then packet authentication is not done | 562 // If ENABLE_EXTERNAL_AUTH flag is on then packet authentication is not done |
554 // inside libsrtp for a RTP packet. A external HMAC module will be writing | 563 // inside libsrtp for a RTP packet. A external HMAC module will be writing |
555 // a fake HMAC value. This is ONLY done for a RTP packet. | 564 // a fake HMAC value. This is ONLY done for a RTP packet. |
556 // Socket layer will update rtp sendtime extension header if present in | 565 // Socket layer will update rtp sendtime extension header if present in |
557 // packet with current time before updating the HMAC. | 566 // packet with current time before updating the HMAC. |
558 #if !defined(ENABLE_EXTERNAL_AUTH) | 567 #if !defined(ENABLE_EXTERNAL_AUTH) |
559 res = srtp_filter_.ProtectRtp( | 568 res = srtp_filter_.ProtectRtp( |
560 data, len, static_cast<int>(packet->capacity()), &len); | 569 data, len, static_cast<int>(packet->capacity()), &len); |
561 #else | 570 #else |
562 options.packet_time_params.rtp_sendtime_extension_id = | 571 updated_options.packet_time_params.rtp_sendtime_extension_id = |
563 rtp_abs_sendtime_extn_id_; | 572 rtp_abs_sendtime_extn_id_; |
564 res = srtp_filter_.ProtectRtp( | 573 res = srtp_filter_.ProtectRtp( |
565 data, len, static_cast<int>(packet->capacity()), &len, | 574 data, len, static_cast<int>(packet->capacity()), &len, |
566 &options.packet_time_params.srtp_packet_index); | 575 &updated_options.packet_time_params.srtp_packet_index); |
567 // If protection succeeds, let's get auth params from srtp. | 576 // If protection succeeds, let's get auth params from srtp. |
568 if (res) { | 577 if (res) { |
569 uint8* auth_key = NULL; | 578 uint8* auth_key = NULL; |
570 int key_len; | 579 int key_len; |
571 res = srtp_filter_.GetRtpAuthParams( | 580 res = srtp_filter_.GetRtpAuthParams( |
572 &auth_key, &key_len, &options.packet_time_params.srtp_auth_tag_len); | 581 &auth_key, &key_len, |
582 &updated_options.packet_time_params.srtp_auth_tag_len); | |
573 if (res) { | 583 if (res) { |
574 options.packet_time_params.srtp_auth_key.resize(key_len); | 584 updated_options.packet_time_params.srtp_auth_key.resize(key_len); |
575 options.packet_time_params.srtp_auth_key.assign(auth_key, | 585 updated_options.packet_time_params.srtp_auth_key.assign( |
576 auth_key + key_len); | 586 auth_key, auth_key + key_len); |
577 } | 587 } |
578 } | 588 } |
579 #endif | 589 #endif |
580 if (!res) { | 590 if (!res) { |
581 int seq_num = -1; | 591 int seq_num = -1; |
582 uint32 ssrc = 0; | 592 uint32 ssrc = 0; |
583 GetRtpSeqNum(data, len, &seq_num); | 593 GetRtpSeqNum(data, len, &seq_num); |
584 GetRtpSsrc(data, len, &ssrc); | 594 GetRtpSsrc(data, len, &ssrc); |
585 LOG(LS_ERROR) << "Failed to protect " << content_name_ | 595 LOG(LS_ERROR) << "Failed to protect " << content_name_ |
586 << " RTP packet: size=" << len | 596 << " RTP packet: size=" << len |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1245 FindHeaderExtension(extensions, kRtpAbsoluteSenderTimeHeaderExtension); | 1255 FindHeaderExtension(extensions, kRtpAbsoluteSenderTimeHeaderExtension); |
1246 rtp_abs_sendtime_extn_id_ = | 1256 rtp_abs_sendtime_extn_id_ = |
1247 send_time_extension ? send_time_extension->id : -1; | 1257 send_time_extension ? send_time_extension->id : -1; |
1248 } | 1258 } |
1249 | 1259 |
1250 void BaseChannel::OnMessage(rtc::Message *pmsg) { | 1260 void BaseChannel::OnMessage(rtc::Message *pmsg) { |
1251 switch (pmsg->message_id) { | 1261 switch (pmsg->message_id) { |
1252 case MSG_RTPPACKET: | 1262 case MSG_RTPPACKET: |
1253 case MSG_RTCPPACKET: { | 1263 case MSG_RTCPPACKET: { |
1254 PacketMessageData* data = static_cast<PacketMessageData*>(pmsg->pdata); | 1264 PacketMessageData* data = static_cast<PacketMessageData*>(pmsg->pdata); |
1255 SendPacket(pmsg->message_id == MSG_RTCPPACKET, &data->packet, data->dscp); | 1265 SendPacket(pmsg->message_id == MSG_RTCPPACKET, &data->packet, |
1266 data->options); | |
1256 delete data; // because it is Posted | 1267 delete data; // because it is Posted |
1257 break; | 1268 break; |
1258 } | 1269 } |
1259 case MSG_FIRSTPACKETRECEIVED: { | 1270 case MSG_FIRSTPACKETRECEIVED: { |
1260 SignalFirstPacketReceived(this); | 1271 SignalFirstPacketReceived(this); |
1261 break; | 1272 break; |
1262 } | 1273 } |
1263 } | 1274 } |
1264 } | 1275 } |
1265 | 1276 |
1266 void BaseChannel::FlushRtcpMessages() { | 1277 void BaseChannel::FlushRtcpMessages() { |
1267 // Flush all remaining RTCP messages. This should only be called in | 1278 // Flush all remaining RTCP messages. This should only be called in |
1268 // destructor. | 1279 // destructor. |
1269 ASSERT(rtc::Thread::Current() == worker_thread_); | 1280 ASSERT(rtc::Thread::Current() == worker_thread_); |
1270 rtc::MessageList rtcp_messages; | 1281 rtc::MessageList rtcp_messages; |
1271 worker_thread_->Clear(this, MSG_RTCPPACKET, &rtcp_messages); | 1282 worker_thread_->Clear(this, MSG_RTCPPACKET, &rtcp_messages); |
1272 for (rtc::MessageList::iterator it = rtcp_messages.begin(); | 1283 for (rtc::MessageList::iterator it = rtcp_messages.begin(); |
1273 it != rtcp_messages.end(); ++it) { | 1284 it != rtcp_messages.end(); ++it) { |
1274 worker_thread_->Send(this, MSG_RTCPPACKET, it->pdata); | 1285 worker_thread_->Send(this, MSG_RTCPPACKET, it->pdata); |
1275 } | 1286 } |
1276 } | 1287 } |
1277 | 1288 |
1278 VoiceChannel::VoiceChannel(rtc::Thread* thread, | 1289 VoiceChannel::VoiceChannel(rtc::Thread* thread, |
1279 MediaEngineInterface* media_engine, | 1290 MediaEngineInterface* media_engine, |
1280 VoiceMediaChannel* media_channel, | 1291 VoiceMediaChannel* media_channel, |
1292 webrtc::MediaControllerInterface* media_controller, | |
1281 TransportController* transport_controller, | 1293 TransportController* transport_controller, |
1282 const std::string& content_name, | 1294 const std::string& content_name, |
1283 bool rtcp) | 1295 bool rtcp) |
1284 : BaseChannel(thread, | 1296 : BaseChannel(thread, |
1285 media_channel, | 1297 media_channel, |
1298 media_controller, | |
1286 transport_controller, | 1299 transport_controller, |
1287 content_name, | 1300 content_name, |
1288 rtcp), | 1301 rtcp), |
1289 media_engine_(media_engine), | 1302 media_engine_(media_engine), |
1290 received_media_(false) {} | 1303 received_media_(false) {} |
1291 | 1304 |
1292 VoiceChannel::~VoiceChannel() { | 1305 VoiceChannel::~VoiceChannel() { |
1293 StopAudioMonitor(); | 1306 StopAudioMonitor(); |
1294 StopMediaMonitor(); | 1307 StopMediaMonitor(); |
1295 // this can't be done in the base class, since it calls a virtual | 1308 // this can't be done in the base class, since it calls a virtual |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1589 SignalAudioMonitor(this, info); | 1602 SignalAudioMonitor(this, info); |
1590 } | 1603 } |
1591 | 1604 |
1592 void VoiceChannel::GetSrtpCryptoSuiteNames( | 1605 void VoiceChannel::GetSrtpCryptoSuiteNames( |
1593 std::vector<std::string>* ciphers) const { | 1606 std::vector<std::string>* ciphers) const { |
1594 GetSupportedAudioCryptoSuites(ciphers); | 1607 GetSupportedAudioCryptoSuites(ciphers); |
1595 } | 1608 } |
1596 | 1609 |
1597 VideoChannel::VideoChannel(rtc::Thread* thread, | 1610 VideoChannel::VideoChannel(rtc::Thread* thread, |
1598 VideoMediaChannel* media_channel, | 1611 VideoMediaChannel* media_channel, |
1612 webrtc::MediaControllerInterface* media_controller, | |
1599 TransportController* transport_controller, | 1613 TransportController* transport_controller, |
1600 const std::string& content_name, | 1614 const std::string& content_name, |
1601 bool rtcp) | 1615 bool rtcp) |
1602 : BaseChannel(thread, | 1616 : BaseChannel(thread, |
1603 media_channel, | 1617 media_channel, |
1618 media_controller, | |
1604 transport_controller, | 1619 transport_controller, |
1605 content_name, | 1620 content_name, |
1606 rtcp), | 1621 rtcp), |
1607 renderer_(NULL), | 1622 renderer_(NULL), |
1608 previous_we_(rtc::WE_CLOSE) {} | 1623 previous_we_(rtc::WE_CLOSE) {} |
1609 | 1624 |
1610 bool VideoChannel::Init() { | 1625 bool VideoChannel::Init() { |
1611 if (!BaseChannel::Init()) { | 1626 if (!BaseChannel::Init()) { |
1612 return false; | 1627 return false; |
1613 } | 1628 } |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1984 GetSupportedVideoCryptoSuites(ciphers); | 1999 GetSupportedVideoCryptoSuites(ciphers); |
1985 } | 2000 } |
1986 | 2001 |
1987 DataChannel::DataChannel(rtc::Thread* thread, | 2002 DataChannel::DataChannel(rtc::Thread* thread, |
1988 DataMediaChannel* media_channel, | 2003 DataMediaChannel* media_channel, |
1989 TransportController* transport_controller, | 2004 TransportController* transport_controller, |
1990 const std::string& content_name, | 2005 const std::string& content_name, |
1991 bool rtcp) | 2006 bool rtcp) |
1992 : BaseChannel(thread, | 2007 : BaseChannel(thread, |
1993 media_channel, | 2008 media_channel, |
2009 nullptr, | |
1994 transport_controller, | 2010 transport_controller, |
1995 content_name, | 2011 content_name, |
1996 rtcp), | 2012 rtcp), |
1997 data_channel_type_(cricket::DCT_NONE), | 2013 data_channel_type_(cricket::DCT_NONE), |
1998 ready_to_send_data_(false) {} | 2014 ready_to_send_data_(false) {} |
1999 | 2015 |
2000 DataChannel::~DataChannel() { | 2016 DataChannel::~DataChannel() { |
2001 StopMediaMonitor(); | 2017 StopMediaMonitor(); |
2002 // this can't be done in the base class, since it calls a virtual | 2018 // this can't be done in the base class, since it calls a virtual |
2003 DisableMedia_w(); | 2019 DisableMedia_w(); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2296 return (data_channel_type_ == DCT_RTP); | 2312 return (data_channel_type_ == DCT_RTP); |
2297 } | 2313 } |
2298 | 2314 |
2299 void DataChannel::OnStreamClosedRemotely(uint32 sid) { | 2315 void DataChannel::OnStreamClosedRemotely(uint32 sid) { |
2300 rtc::TypedMessageData<uint32>* message = | 2316 rtc::TypedMessageData<uint32>* message = |
2301 new rtc::TypedMessageData<uint32>(sid); | 2317 new rtc::TypedMessageData<uint32>(sid); |
2302 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2318 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2303 } | 2319 } |
2304 | 2320 |
2305 } // namespace cricket | 2321 } // namespace cricket |
OLD | NEW |