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

Side by Side Diff: webrtc/p2p/base/fakepackettransport.h

Issue 2997983002: Completed the functionalities of SrtpTransport. (Closed)
Patch Set: Fix the chromimum issue. Created 3 years, 3 months 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
« no previous file with comments | « no previous file | webrtc/pc/channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2017 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 SendPacketInternal(packet); 79 SendPacketInternal(packet);
80 } 80 }
81 SentPacket sent_packet(options.packet_id, TimeMillis()); 81 SentPacket sent_packet(options.packet_id, TimeMillis());
82 SignalSentPacket(this, sent_packet); 82 SignalSentPacket(this, sent_packet);
83 return static_cast<int>(len); 83 return static_cast<int>(len);
84 } 84 }
85 int SetOption(Socket::Option opt, int value) override { return true; } 85 int SetOption(Socket::Option opt, int value) override { return true; }
86 bool GetOption(Socket::Option opt, int* value) override { return true; } 86 bool GetOption(Socket::Option opt, int* value) override { return true; }
87 int GetError() override { return 0; } 87 int GetError() override { return 0; }
88 88
89 const CopyOnWriteBuffer* last_sent_packet() { return &last_sent_packet_; }
90
89 private: 91 private:
90 void set_writable(bool writable) { 92 void set_writable(bool writable) {
91 if (writable_ == writable) { 93 if (writable_ == writable) {
92 return; 94 return;
93 } 95 }
94 writable_ = writable; 96 writable_ = writable;
95 if (writable_) { 97 if (writable_) {
96 SignalReadyToSend(this); 98 SignalReadyToSend(this);
97 } 99 }
98 SignalWritableState(this); 100 SignalWritableState(this);
99 } 101 }
100 102
101 void set_receiving(bool receiving) { 103 void set_receiving(bool receiving) {
102 if (receiving_ == receiving) { 104 if (receiving_ == receiving) {
103 return; 105 return;
104 } 106 }
105 receiving_ = receiving; 107 receiving_ = receiving;
106 SignalReceivingState(this); 108 SignalReceivingState(this);
107 } 109 }
108 110
109 void SendPacketInternal(const CopyOnWriteBuffer& packet) { 111 void SendPacketInternal(const CopyOnWriteBuffer& packet) {
112 last_sent_packet_ = packet;
110 if (dest_) { 113 if (dest_) {
111 dest_->SignalReadPacket(dest_, packet.data<char>(), packet.size(), 114 dest_->SignalReadPacket(dest_, packet.data<char>(), packet.size(),
112 CreatePacketTime(0), 0); 115 CreatePacketTime(0), 0);
113 } 116 }
114 } 117 }
115 118
119 CopyOnWriteBuffer last_sent_packet_;
116 AsyncInvoker invoker_; 120 AsyncInvoker invoker_;
117 std::string debug_name_; 121 std::string debug_name_;
118 FakePacketTransport* dest_ = nullptr; 122 FakePacketTransport* dest_ = nullptr;
119 bool async_ = false; 123 bool async_ = false;
120 int async_delay_ms_ = 0; 124 int async_delay_ms_ = 0;
121 bool writable_ = false; 125 bool writable_ = false;
122 bool receiving_ = false; 126 bool receiving_ = false;
123 }; 127 };
124 128
125 } // namespace rtc 129 } // namespace rtc
126 130
127 #endif // WEBRTC_P2P_BASE_FAKEPACKETTRANSPORT_H_ 131 #endif // WEBRTC_P2P_BASE_FAKEPACKETTRANSPORT_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/pc/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698