| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 void SetDestination(DataMediaChannel* dest) { dest_ = dest; } | 47 void SetDestination(DataMediaChannel* dest) { dest_ = dest; } |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 // Called to send raw packet down the wire (e.g. SCTP an packet). | 50 // Called to send raw packet down the wire (e.g. SCTP an packet). |
| 51 virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet, | 51 virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet, |
| 52 const rtc::PacketOptions& options) { | 52 const rtc::PacketOptions& options) { |
| 53 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket"; | 53 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket"; |
| 54 | 54 |
| 55 rtc::CopyOnWriteBuffer* buffer = new rtc::CopyOnWriteBuffer(*packet); | 55 rtc::CopyOnWriteBuffer* buffer = new rtc::CopyOnWriteBuffer(*packet); |
| 56 thread_->Post(this, MSG_PACKET, rtc::WrapMessageData(buffer)); | 56 thread_->Post(RTC_FROM_HERE, this, MSG_PACKET, |
| 57 rtc::WrapMessageData(buffer)); |
| 57 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket, Posted message."; | 58 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket, Posted message."; |
| 58 return true; | 59 return true; |
| 59 } | 60 } |
| 60 | 61 |
| 61 // Called when a raw packet has been recieved. This passes the data to the | 62 // Called when a raw packet has been recieved. This passes the data to the |
| 62 // code that will interpret the packet. e.g. to get the content payload from | 63 // code that will interpret the packet. e.g. to get the content payload from |
| 63 // an SCTP packet. | 64 // an SCTP packet. |
| 64 virtual void OnMessage(rtc::Message* msg) { | 65 virtual void OnMessage(rtc::Message* msg) { |
| 65 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::OnMessage"; | 66 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::OnMessage"; |
| 66 std::unique_ptr<rtc::CopyOnWriteBuffer> buffer( | 67 std::unique_ptr<rtc::CopyOnWriteBuffer> buffer( |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 // Create a new channel 1. | 518 // Create a new channel 1. |
| 518 AddStream(1); | 519 AddStream(1); |
| 519 ASSERT_TRUE(SendData(channel1(), 1, "hi?", &result)); | 520 ASSERT_TRUE(SendData(channel1(), 1, "hi?", &result)); |
| 520 EXPECT_EQ(SDR_SUCCESS, result); | 521 EXPECT_EQ(SDR_SUCCESS, result); |
| 521 EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hi?"), 1000); | 522 EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hi?"), 1000); |
| 522 channel1()->RemoveSendStream(1); | 523 channel1()->RemoveSendStream(1); |
| 523 EXPECT_TRUE_WAIT(chan_2_sig_receiver.StreamCloseCount(1) == 2, 1000); | 524 EXPECT_TRUE_WAIT(chan_2_sig_receiver.StreamCloseCount(1) == 2, 1000); |
| 524 } | 525 } |
| 525 | 526 |
| 526 } // namespace cricket | 527 } // namespace cricket |
| OLD | NEW |