| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 return false; | 197 return false; |
| 198 } | 198 } |
| 199 | 199 |
| 200 if (!SetDtlsSrtpCiphers(transport_channel(), false)) { | 200 if (!SetDtlsSrtpCiphers(transport_channel(), false)) { |
| 201 return false; | 201 return false; |
| 202 } | 202 } |
| 203 if (rtcp() && !SetDtlsSrtpCiphers(rtcp_transport_channel(), true)) { | 203 if (rtcp() && !SetDtlsSrtpCiphers(rtcp_transport_channel(), true)) { |
| 204 return false; | 204 return false; |
| 205 } | 205 } |
| 206 | 206 |
| 207 session_->SignalNewLocalDescription.connect( | |
| 208 this, &BaseChannel::OnNewLocalDescription); | |
| 209 session_->SignalNewRemoteDescription.connect( | |
| 210 this, &BaseChannel::OnNewRemoteDescription); | |
| 211 | |
| 212 // Both RTP and RTCP channels are set, we can call SetInterface on | 207 // Both RTP and RTCP channels are set, we can call SetInterface on |
| 213 // media channel and it can set network options. | 208 // media channel and it can set network options. |
| 214 media_channel_->SetInterface(this); | 209 media_channel_->SetInterface(this); |
| 215 return true; | 210 return true; |
| 216 } | 211 } |
| 217 | 212 |
| 218 void BaseChannel::Deinit() { | 213 void BaseChannel::Deinit() { |
| 219 media_channel_->SetInterface(NULL); | 214 media_channel_->SetInterface(NULL); |
| 220 } | 215 } |
| 221 | 216 |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 651 } |
| 657 | 652 |
| 658 // Push it down to the media channel. | 653 // Push it down to the media channel. |
| 659 if (!rtcp) { | 654 if (!rtcp) { |
| 660 media_channel_->OnPacketReceived(packet, packet_time); | 655 media_channel_->OnPacketReceived(packet, packet_time); |
| 661 } else { | 656 } else { |
| 662 media_channel_->OnRtcpReceived(packet, packet_time); | 657 media_channel_->OnRtcpReceived(packet, packet_time); |
| 663 } | 658 } |
| 664 } | 659 } |
| 665 | 660 |
| 666 void BaseChannel::OnNewLocalDescription( | |
| 667 BaseSession* session, ContentAction action) { | |
| 668 std::string error_desc; | |
| 669 if (!PushdownLocalDescription( | |
| 670 session->local_description(), action, &error_desc)) { | |
| 671 SetSessionError(session_, BaseSession::ERROR_CONTENT, error_desc); | |
| 672 } | |
| 673 } | |
| 674 | |
| 675 void BaseChannel::OnNewRemoteDescription( | |
| 676 BaseSession* session, ContentAction action) { | |
| 677 std::string error_desc; | |
| 678 if (!PushdownRemoteDescription( | |
| 679 session->remote_description(), action, &error_desc)) { | |
| 680 SetSessionError(session_, BaseSession::ERROR_CONTENT, error_desc); | |
| 681 } | |
| 682 } | |
| 683 | |
| 684 bool BaseChannel::PushdownLocalDescription( | 661 bool BaseChannel::PushdownLocalDescription( |
| 685 const SessionDescription* local_desc, ContentAction action, | 662 const SessionDescription* local_desc, ContentAction action, |
| 686 std::string* error_desc) { | 663 std::string* error_desc) { |
| 687 const ContentInfo* content_info = GetFirstContent(local_desc); | 664 const ContentInfo* content_info = GetFirstContent(local_desc); |
| 688 const MediaContentDescription* content_desc = | 665 const MediaContentDescription* content_desc = |
| 689 GetContentDescription(content_info); | 666 GetContentDescription(content_info); |
| 690 if (content_desc && content_info && !content_info->rejected && | 667 if (content_desc && content_info && !content_info->rejected && |
| 691 !SetLocalContent(content_desc, action, error_desc)) { | 668 !SetLocalContent(content_desc, action, error_desc)) { |
| 692 LOG(LS_ERROR) << "Failure in SetLocalContent with action " << action; | 669 LOG(LS_ERROR) << "Failure in SetLocalContent with action " << action; |
| 693 return false; | 670 return false; |
| (...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2502 return (data_channel_type_ == DCT_RTP); | 2479 return (data_channel_type_ == DCT_RTP); |
| 2503 } | 2480 } |
| 2504 | 2481 |
| 2505 void DataChannel::OnStreamClosedRemotely(uint32 sid) { | 2482 void DataChannel::OnStreamClosedRemotely(uint32 sid) { |
| 2506 rtc::TypedMessageData<uint32>* message = | 2483 rtc::TypedMessageData<uint32>* message = |
| 2507 new rtc::TypedMessageData<uint32>(sid); | 2484 new rtc::TypedMessageData<uint32>(sid); |
| 2508 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2485 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
| 2509 } | 2486 } |
| 2510 | 2487 |
| 2511 } // namespace cricket | 2488 } // namespace cricket |
| OLD | NEW |