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

Side by Side Diff: webrtc/media/base/fakemediaengine.h

Issue 1803063004: Reset the BWE when the network changes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Removed changes in call dir and leave that in a separate CL. Created 4 years, 8 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 | « webrtc/base/networkroute.h ('k') | webrtc/media/base/mediachannel.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 (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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
11 #ifndef WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ 11 #ifndef WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_
12 #define WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ 12 #define WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_
13 13
14 #include <list> 14 #include <list>
15 #include <map> 15 #include <map>
16 #include <memory> 16 #include <memory>
17 #include <set> 17 #include <set>
18 #include <string> 18 #include <string>
19 #include <vector> 19 #include <vector>
20 20
21 #include "webrtc/audio_sink.h" 21 #include "webrtc/audio_sink.h"
22 #include "webrtc/base/copyonwritebuffer.h" 22 #include "webrtc/base/copyonwritebuffer.h"
23 #include "webrtc/base/networkroute.h"
23 #include "webrtc/base/stringutils.h" 24 #include "webrtc/base/stringutils.h"
24 #include "webrtc/media/base/audiosource.h" 25 #include "webrtc/media/base/audiosource.h"
25 #include "webrtc/media/base/mediaengine.h" 26 #include "webrtc/media/base/mediaengine.h"
26 #include "webrtc/media/base/rtputils.h" 27 #include "webrtc/media/base/rtputils.h"
27 #include "webrtc/media/base/streamparams.h" 28 #include "webrtc/media/base/streamparams.h"
28 #include "webrtc/p2p/base/sessiondescription.h" 29 #include "webrtc/p2p/base/sessiondescription.h"
29 30
30 namespace cricket { 31 namespace cricket {
31 32
32 class FakeMediaEngine; 33 class FakeMediaEngine;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 const std::string rtcp_cname() { 172 const std::string rtcp_cname() {
172 if (send_streams_.empty()) 173 if (send_streams_.empty())
173 return ""; 174 return "";
174 return send_streams_[0].cname; 175 return send_streams_[0].cname;
175 } 176 }
176 177
177 bool ready_to_send() const { 178 bool ready_to_send() const {
178 return ready_to_send_; 179 return ready_to_send_;
179 } 180 }
180 181
182 NetworkRoute last_network_route() const { return last_network_route_; }
183 int num_network_route_changes() const { return num_network_route_changes_; }
184 void set_num_network_route_changes(int changes) {
185 num_network_route_changes_ = changes;
186 }
187
181 protected: 188 protected:
182 bool MuteStream(uint32_t ssrc, bool mute) { 189 bool MuteStream(uint32_t ssrc, bool mute) {
183 if (!HasSendStream(ssrc) && ssrc != 0) { 190 if (!HasSendStream(ssrc) && ssrc != 0) {
184 return false; 191 return false;
185 } 192 }
186 if (mute) { 193 if (mute) {
187 muted_streams_.insert(ssrc); 194 muted_streams_.insert(ssrc);
188 } else { 195 } else {
189 muted_streams_.erase(ssrc); 196 muted_streams_.erase(ssrc);
190 } 197 }
(...skipping 18 matching lines...) Expand all
209 const rtc::PacketTime& packet_time) { 216 const rtc::PacketTime& packet_time) {
210 rtp_packets_.push_back(std::string(packet->data<char>(), packet->size())); 217 rtp_packets_.push_back(std::string(packet->data<char>(), packet->size()));
211 } 218 }
212 virtual void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet, 219 virtual void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet,
213 const rtc::PacketTime& packet_time) { 220 const rtc::PacketTime& packet_time) {
214 rtcp_packets_.push_back(std::string(packet->data<char>(), packet->size())); 221 rtcp_packets_.push_back(std::string(packet->data<char>(), packet->size()));
215 } 222 }
216 virtual void OnReadyToSend(bool ready) { 223 virtual void OnReadyToSend(bool ready) {
217 ready_to_send_ = ready; 224 ready_to_send_ = ready;
218 } 225 }
226 virtual void OnNetworkRouteChanged(const std::string& transport_name,
227 const NetworkRoute& network_route) {
228 last_network_route_ = network_route;
229 ++num_network_route_changes_;
230 }
219 bool fail_set_send_codecs() const { return fail_set_send_codecs_; } 231 bool fail_set_send_codecs() const { return fail_set_send_codecs_; }
220 bool fail_set_recv_codecs() const { return fail_set_recv_codecs_; } 232 bool fail_set_recv_codecs() const { return fail_set_recv_codecs_; }
221 233
222 private: 234 private:
223 bool sending_; 235 bool sending_;
224 bool playout_; 236 bool playout_;
225 std::vector<RtpHeaderExtension> recv_extensions_; 237 std::vector<RtpHeaderExtension> recv_extensions_;
226 std::vector<RtpHeaderExtension> send_extensions_; 238 std::vector<RtpHeaderExtension> send_extensions_;
227 std::list<std::string> rtp_packets_; 239 std::list<std::string> rtp_packets_;
228 std::list<std::string> rtcp_packets_; 240 std::list<std::string> rtcp_packets_;
229 std::vector<StreamParams> send_streams_; 241 std::vector<StreamParams> send_streams_;
230 std::vector<StreamParams> receive_streams_; 242 std::vector<StreamParams> receive_streams_;
231 std::set<uint32_t> muted_streams_; 243 std::set<uint32_t> muted_streams_;
232 std::map<uint32_t, webrtc::RtpParameters> rtp_parameters_; 244 std::map<uint32_t, webrtc::RtpParameters> rtp_parameters_;
233 bool fail_set_send_codecs_; 245 bool fail_set_send_codecs_;
234 bool fail_set_recv_codecs_; 246 bool fail_set_recv_codecs_;
235 uint32_t send_ssrc_; 247 uint32_t send_ssrc_;
236 std::string rtcp_cname_; 248 std::string rtcp_cname_;
237 bool ready_to_send_; 249 bool ready_to_send_;
250 NetworkRoute last_network_route_;
251 int num_network_route_changes_ = 0;
238 }; 252 };
239 253
240 class FakeVoiceMediaChannel : public RtpHelper<VoiceMediaChannel> { 254 class FakeVoiceMediaChannel : public RtpHelper<VoiceMediaChannel> {
241 public: 255 public:
242 struct DtmfInfo { 256 struct DtmfInfo {
243 DtmfInfo(uint32_t ssrc, int event_code, int duration) 257 DtmfInfo(uint32_t ssrc, int event_code, int duration)
244 : ssrc(ssrc), 258 : ssrc(ssrc),
245 event_code(event_code), 259 event_code(event_code),
246 duration(duration) {} 260 duration(duration) {}
247 uint32_t ssrc; 261 uint32_t ssrc;
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 906
893 private: 907 private:
894 std::vector<FakeDataMediaChannel*> channels_; 908 std::vector<FakeDataMediaChannel*> channels_;
895 std::vector<DataCodec> data_codecs_; 909 std::vector<DataCodec> data_codecs_;
896 DataChannelType last_channel_type_; 910 DataChannelType last_channel_type_;
897 }; 911 };
898 912
899 } // namespace cricket 913 } // namespace cricket
900 914
901 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ 915 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_
OLDNEW
« no previous file with comments | « webrtc/base/networkroute.h ('k') | webrtc/media/base/mediachannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698