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

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

Issue 2437503004: Set actual transport overhead in rtp_rtcp (Closed)
Patch Set: Save selected candidate pair in transport channel. Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2009 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_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ 11 #ifndef WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_
12 #define WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ 12 #define WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_
13 13
14 #include <map> 14 #include <map>
15 #include <memory> 15 #include <memory>
16 #include <string> 16 #include <string>
17 #include <vector> 17 #include <vector>
18 18
19 #include "webrtc/p2p/base/candidatepairinterface.h" 19 #include "webrtc/p2p/base/candidatepair.h"
20 #include "webrtc/p2p/base/transport.h" 20 #include "webrtc/p2p/base/transport.h"
21 #include "webrtc/p2p/base/transportchannel.h" 21 #include "webrtc/p2p/base/transportchannel.h"
22 #include "webrtc/p2p/base/transportcontroller.h" 22 #include "webrtc/p2p/base/transportcontroller.h"
23 #include "webrtc/p2p/base/transportchannelimpl.h" 23 #include "webrtc/p2p/base/transportchannelimpl.h"
24 #include "webrtc/base/bind.h" 24 #include "webrtc/base/bind.h"
25 #include "webrtc/base/buffer.h" 25 #include "webrtc/base/buffer.h"
26 #include "webrtc/base/fakesslidentity.h" 26 #include "webrtc/base/fakesslidentity.h"
27 #include "webrtc/base/messagequeue.h" 27 #include "webrtc/base/messagequeue.h"
28 #include "webrtc/base/sigslot.h" 28 #include "webrtc/base/sigslot.h"
29 #include "webrtc/base/sslfingerprint.h" 29 #include "webrtc/base/sslfingerprint.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 476
477 protected: 477 protected:
478 QuicTransportChannel* CreateTransportChannel(int component) override { 478 QuicTransportChannel* CreateTransportChannel(int component) override {
479 FakeTransportChannel* fake_ice_transport_channel = 479 FakeTransportChannel* fake_ice_transport_channel =
480 new FakeTransportChannel(name(), component); 480 new FakeTransportChannel(name(), component);
481 return new QuicTransportChannel(fake_ice_transport_channel); 481 return new QuicTransportChannel(fake_ice_transport_channel);
482 } 482 }
483 }; 483 };
484 #endif 484 #endif
485 485
486 // Fake candidate pair class, which can be passed to BaseChannel for testing
487 // purposes.
488 class FakeCandidatePair : public CandidatePairInterface {
489 public:
490 FakeCandidatePair(const Candidate& local_candidate,
491 const Candidate& remote_candidate)
492 : local_candidate_(local_candidate),
493 remote_candidate_(remote_candidate) {}
494 const Candidate& local_candidate() const override { return local_candidate_; }
495 const Candidate& remote_candidate() const override {
496 return remote_candidate_;
497 }
498
499 private:
500 Candidate local_candidate_;
501 Candidate remote_candidate_;
502 };
503
504 // Fake TransportController class, which can be passed into a BaseChannel object 486 // Fake TransportController class, which can be passed into a BaseChannel object
505 // for test purposes. Can be connected to other FakeTransportControllers via 487 // for test purposes. Can be connected to other FakeTransportControllers via
506 // Connect(). 488 // Connect().
507 // 489 //
508 // This fake is unusual in that for the most part, it's implemented with the 490 // This fake is unusual in that for the most part, it's implemented with the
509 // real TransportController code, but with fake TransportChannels underneath. 491 // real TransportController code, but with fake TransportChannels underneath.
510 class FakeTransportController : public TransportController { 492 class FakeTransportController : public TransportController {
511 public: 493 public:
512 FakeTransportController() 494 FakeTransportController()
513 : TransportController(rtc::Thread::Current(), 495 : TransportController(rtc::Thread::Current(),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 535
554 TransportChannel* CreateTransportChannel_n(const std::string& transport_name, 536 TransportChannel* CreateTransportChannel_n(const std::string& transport_name,
555 int component) override { 537 int component) override {
556 if (fail_create_channel_) { 538 if (fail_create_channel_) {
557 return nullptr; 539 return nullptr;
558 } 540 }
559 return TransportController::CreateTransportChannel_n(transport_name, 541 return TransportController::CreateTransportChannel_n(transport_name,
560 component); 542 component);
561 } 543 }
562 544
563 FakeCandidatePair* CreateFakeCandidatePair( 545 CandidatePair* CreateCandidatePair(const rtc::SocketAddress& local_address,
564 const rtc::SocketAddress& local_address, 546 int16_t local_network_id,
565 int16_t local_network_id, 547 const rtc::SocketAddress& remote_address,
566 const rtc::SocketAddress& remote_address, 548 int16_t remote_network_id) {
567 int16_t remote_network_id) {
568 Candidate local_candidate(0, "udp", local_address, 0u, "", "", "local", 0, 549 Candidate local_candidate(0, "udp", local_address, 0u, "", "", "local", 0,
569 "foundation", local_network_id, 0); 550 "foundation", local_network_id, 0);
570 Candidate remote_candidate(0, "udp", remote_address, 0u, "", "", "local", 0, 551 Candidate remote_candidate(0, "udp", remote_address, 0u, "", "", "local", 0,
571 "foundation", remote_network_id, 0); 552 "foundation", remote_network_id, 0);
572 return new FakeCandidatePair(local_candidate, remote_candidate); 553 return new CandidatePair(local_candidate, remote_candidate);
573 } 554 }
574 555
575 void set_fail_channel_creation(bool fail_channel_creation) { 556 void set_fail_channel_creation(bool fail_channel_creation) {
576 fail_create_channel_ = fail_channel_creation; 557 fail_create_channel_ = fail_channel_creation;
577 } 558 }
578 559
579 protected: 560 protected:
580 Transport* CreateTransport_n(const std::string& transport_name) override { 561 Transport* CreateTransport_n(const std::string& transport_name) override {
581 #ifdef HAVE_QUIC 562 #ifdef HAVE_QUIC
582 if (quic()) { 563 if (quic()) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 } 595 }
615 } 596 }
616 597
617 private: 598 private:
618 bool fail_create_channel_; 599 bool fail_create_channel_;
619 }; 600 };
620 601
621 } // namespace cricket 602 } // namespace cricket
622 603
623 #endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ 604 #endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698