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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 122 } |
123 return new rtc::Buffer(rtcp_packets_[index]); | 123 return new rtc::Buffer(rtcp_packets_[index]); |
124 } | 124 } |
125 | 125 |
126 int sendbuf_size() const { return sendbuf_size_; } | 126 int sendbuf_size() const { return sendbuf_size_; } |
127 int recvbuf_size() const { return recvbuf_size_; } | 127 int recvbuf_size() const { return recvbuf_size_; } |
128 rtc::DiffServCodePoint dscp() const { return dscp_; } | 128 rtc::DiffServCodePoint dscp() const { return dscp_; } |
129 | 129 |
130 protected: | 130 protected: |
131 virtual bool SendPacket(rtc::Buffer* packet, | 131 virtual bool SendPacket(rtc::Buffer* packet, |
132 rtc::DiffServCodePoint dscp) { | 132 const rtc::PacketOptions& options) { |
133 rtc::CritScope cs(&crit_); | 133 rtc::CritScope cs(&crit_); |
134 | 134 |
135 uint32_t cur_ssrc = 0; | 135 uint32_t cur_ssrc = 0; |
136 if (!GetRtpSsrc(packet->data(), packet->size(), &cur_ssrc)) { | 136 if (!GetRtpSsrc(packet->data(), packet->size(), &cur_ssrc)) { |
137 return false; | 137 return false; |
138 } | 138 } |
139 sent_ssrcs_[cur_ssrc]++; | 139 sent_ssrcs_[cur_ssrc]++; |
140 | 140 |
141 rtp_packets_.push_back(*packet); | 141 rtp_packets_.push_back(*packet); |
142 if (conf_) { | 142 if (conf_) { |
143 rtc::Buffer buffer_copy(*packet); | 143 rtc::Buffer buffer_copy(*packet); |
144 for (size_t i = 0; i < conf_sent_ssrcs_.size(); ++i) { | 144 for (size_t i = 0; i < conf_sent_ssrcs_.size(); ++i) { |
145 if (!SetRtpSsrc(buffer_copy.data(), buffer_copy.size(), | 145 if (!SetRtpSsrc(buffer_copy.data(), buffer_copy.size(), |
146 conf_sent_ssrcs_[i])) { | 146 conf_sent_ssrcs_[i])) { |
147 return false; | 147 return false; |
148 } | 148 } |
149 PostMessage(ST_RTP, buffer_copy); | 149 PostMessage(ST_RTP, buffer_copy); |
150 } | 150 } |
151 } else { | 151 } else { |
152 PostMessage(ST_RTP, *packet); | 152 PostMessage(ST_RTP, *packet); |
153 } | 153 } |
154 return true; | 154 return true; |
155 } | 155 } |
156 | 156 |
157 virtual bool SendRtcp(rtc::Buffer* packet, | 157 virtual bool SendRtcp(rtc::Buffer* packet, |
158 rtc::DiffServCodePoint dscp) { | 158 const rtc::PacketOptions& options) { |
159 rtc::CritScope cs(&crit_); | 159 rtc::CritScope cs(&crit_); |
160 rtcp_packets_.push_back(*packet); | 160 rtcp_packets_.push_back(*packet); |
161 if (!conf_) { | 161 if (!conf_) { |
162 // don't worry about RTCP in conf mode for now | 162 // don't worry about RTCP in conf mode for now |
163 PostMessage(ST_RTCP, *packet); | 163 PostMessage(ST_RTCP, *packet); |
164 } | 164 } |
165 return true; | 165 return true; |
166 } | 166 } |
167 | 167 |
168 virtual int SetOption(SocketType type, rtc::Socket::Option opt, | 168 virtual int SetOption(SocketType type, rtc::Socket::Option opt, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 std::vector<rtc::Buffer> rtp_packets_; | 236 std::vector<rtc::Buffer> rtp_packets_; |
237 std::vector<rtc::Buffer> rtcp_packets_; | 237 std::vector<rtc::Buffer> rtcp_packets_; |
238 int sendbuf_size_; | 238 int sendbuf_size_; |
239 int recvbuf_size_; | 239 int recvbuf_size_; |
240 rtc::DiffServCodePoint dscp_; | 240 rtc::DiffServCodePoint dscp_; |
241 }; | 241 }; |
242 | 242 |
243 } // namespace cricket | 243 } // namespace cricket |
244 | 244 |
245 #endif // TALK_MEDIA_BASE_FAKENETWORKINTERFACE_H_ | 245 #endif // TALK_MEDIA_BASE_FAKENETWORKINTERFACE_H_ |
OLD | NEW |